Skip to contentSkip to conversation

add NETCMIX block control support on i.MX95

PATCH Superseded Wei Fang 3 participants 10 messages Jul 10, 2024 – Jul 22, 2024

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Wei Fang

author
#0 lore raw

v2 cover add NETCMIX block control support on i.MX95

The NETCMIX block control consists of registers for configuration of peripherals in the NETC domain, such as MQS, SAI and NETC. So add the NETCMIX block control support on i.MX95 platform.

---
V2:
1. Patch 2 is new patch.
2. Add rmii reference clock mux for ENETC0 and ENETC1 in patch 3. Link to V1: https://lore.kernel.org/all/[email protected]/
---

Wei Fang (4):
dt-bindings: clock: add i.MX95 NETCMIX block control
dt-bindings: clock: add RMII clock selection
clk: imx95: enable the clock of NETCMIX block control
arm64: dts: imx95: Add NETCMIX block control support

 .../bindings/clock/nxp,imx95-blk-ctl.yaml     |  1 +
 arch/arm64/boot/dts/freescale/imx95.dtsi      | 12 ++++++++
 drivers/clk/imx/clk-imx95-blk-ctl.c           | 30 +++++++++++++++++++
 include/dt-bindings/clock/nxp,imx95-clock.h   |  3 ++
 4 files changed, 46 insertions(+)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/4 dt-bindings: clock: add i.MX95 NETCMIX block control

Add 'nxp,imx95-netcmix-blk-ctrl' compatible string for i.MX95 platform.

---
V2:
No changes.

---
 Documentation/devicetree/bindings/clock/nxp,imx95-blk-ctl.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/nxp,imx95-blk-ctl.yaml +1 -0
index 2dffc02dcd8b..b0072bae12d9 100644
@@ -17,6 +17,7 @@ properties:
           - nxp,imx95-display-csr
           - nxp,imx95-camera-csr
           - nxp,imx95-vpu-csr
+          - nxp,imx95-netcmix-blk-ctrl
       - const: syscon
 
   reg:
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v2 2/4 dt-bindings: clock: add RMII clock selection

In reply to Wei Fang

Add RMII clock selection for ENETC0 and ENETC1.

---
V2:
new patch.

---
 include/dt-bindings/clock/nxp,imx95-clock.h | 3 +++
 1 file changed, 3 insertions(+)
include/dt-bindings/clock/nxp,imx95-clock.h +3 -0
index 782662c3e740..b7a713a9ac8c 100644
@@ -25,4 +25,7 @@
 #define IMX95_CLK_DISPMIX_ENG0_SEL		0
 #define IMX95_CLK_DISPMIX_ENG1_SEL		1
 
+#define IMX95_CLK_NETCMIX_ENETC0_RMII		0
+#define IMX95_CLK_NETCMIX_ENETC1_RMII		1
+
 #endif	/* __DT_BINDINGS_CLOCK_IMX95_H */
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH v2 3/4 clk: imx95: enable the clock of NETCMIX block control

In reply to Wei Fang

The NETCMIX block control consists of registers for configuration of peripherals in the NETC domain, so enable the clock of NETCMIX to support the configuration.

---
V2:
Add RMII reference clock mux for ENETC0 and ENETC1.

---
 drivers/clk/imx/clk-imx95-blk-ctl.c | 30 +++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
drivers/clk/imx/clk-imx95-blk-ctl.c +30 -0
index 74f595f9e5e3..19a62da74be4 100644
@@ -248,6 +248,35 @@ static const struct imx95_blk_ctl_dev_data dispmix_csr_dev_data = {
 	.clk_reg_offset = 0,
 };
 
+static const struct imx95_blk_ctl_clk_dev_data netxmix_clk_dev_data[] = {
+	[IMX95_CLK_NETCMIX_ENETC0_RMII] = {
+		.name = "enetc0_rmii_sel",
+		.parent_names = (const char *[]){"ext_enetref", "enetref"},
+		.num_parents = 2,
+		.reg = 4,
+		.bit_idx = 5,
+		.bit_width = 1,
+		.type = CLK_MUX,
+		.flags = CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
+	},
+	[IMX95_CLK_NETCMIX_ENETC1_RMII] = {
+		.name = "enetc1_rmii_sel",
+		.parent_names = (const char *[]){"ext_enetref", "enetref"},
+		.num_parents = 2,
+		.reg = 4,
+		.bit_idx = 10,
+		.bit_width = 1,
+		.type = CLK_MUX,
+		.flags = CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
+	},
+};
+
+static const struct imx95_blk_ctl_dev_data netcmix_dev_data = {
+	.num_clks = ARRAY_SIZE(netxmix_clk_dev_data),
+	.clk_dev_data = netxmix_clk_dev_data,
+	.clk_reg_offset = 0,
+};
+
 static int imx95_bc_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -419,6 +448,7 @@ static const struct of_device_id imx95_bc_of_match[] = {
 	{ .compatible = "nxp,imx95-lvds-csr", .data = &lvds_csr_dev_data },
 	{ .compatible = "nxp,imx95-display-csr", .data = &dispmix_csr_dev_data },
 	{ .compatible = "nxp,imx95-vpu-csr", .data = &vpublk_dev_data },
+	{ .compatible = "nxp,imx95-netcmix-blk-ctrl", .data = &netcmix_dev_data},
 	{ /* Sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, imx95_bc_of_match);
Signature · 1 line
2.34.1
reviewer
#5 lore raw

RE: [PATCH v2 3/4] clk: imx95: enable the clock of NETCMIX block control

Quoted 44 lines

Subject: [PATCH v2 3/4] clk: imx95: enable the clock of NETCMIX block control

The NETCMIX block control consists of registers for configuration of peripherals in the NETC domain, so enable the clock of NETCMIX to support the configuration.

---
V2:
Add RMII reference clock mux for ENETC0 and ENETC1.

---
 drivers/clk/imx/clk-imx95-blk-ctl.c | 30
+++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
drivers/clk/imx/clk- renamed from drivers/clk/imx/clk-imx95-blk-ctl.c +0 -0

imx95-blk-ctl.c
index 74f595f9e5e3..19a62da74be4 100644

drivers/clk/imx/clk-imx95-blk-ctl.c +10 -0
@@ -248,6 +248,35 @@ static const struct imx95_blk_ctl_dev_data
 dispmix_csr_dev_data = {
 	.clk_reg_offset = 0,
 };
 
+static const struct imx95_blk_ctl_clk_dev_data
 netxmix_clk_dev_data[] = {
+	[IMX95_CLK_NETCMIX_ENETC0_RMII] = {
+		.name = "enetc0_rmii_sel",
+		.parent_names = (const char *[]){"ext_enetref",
 "enetref"},
+		.num_parents = 2,
+		.reg = 4,
+		.bit_idx = 5,
+		.bit_width = 1,
+		.type = CLK_MUX,
+		.flags = CLK_SET_RATE_NO_REPARENT |

CLK_SET_RATE_PARENT,

drivers/clk/imx/clk-imx95-blk-ctl.c +4 -0
+	},
+	[IMX95_CLK_NETCMIX_ENETC1_RMII] = {
+		.name = "enetc1_rmii_sel",
+		.parent_names = (const char *[]){"ext_enetref",

"enetref"},

drivers/clk/imx/clk-imx95-blk-ctl.c

Quoted 2 lines
drivers/clk/imx/clk-imx95-blk-ctl.c +2 -0
+		.num_parents = 2,
+		.reg = 4,

Both the entry use reg address 4, use a lock to protect?

Regards,
Peng.

Quoted 31 lines
drivers/clk/imx/clk-imx95-blk-ctl.c +4 -0
+		.bit_idx = 10,
+		.bit_width = 1,
+		.type = CLK_MUX,
+		.flags = CLK_SET_RATE_NO_REPARENT |

CLK_SET_RATE_PARENT,

drivers/clk/imx/clk-imx95-blk-ctl.c +9 -0
+	},
+};
+
+static const struct imx95_blk_ctl_dev_data netcmix_dev_data = {
+	.num_clks = ARRAY_SIZE(netxmix_clk_dev_data),
+	.clk_dev_data = netxmix_clk_dev_data,
+	.clk_reg_offset = 0,
+};
+
 static int imx95_bc_probe(struct platform_device *pdev)  {
 	struct device *dev = &pdev->dev;
@@ -419,6 +448,7 @@ static const struct of_device_id
 imx95_bc_of_match[] = {
 	{ .compatible = "nxp,imx95-lvds-csr", .data =
 &lvds_csr_dev_data },
 	{ .compatible = "nxp,imx95-display-csr", .data =
 &dispmix_csr_dev_data },
 	{ .compatible = "nxp,imx95-vpu-csr", .data =

&vpublk_dev_data },

drivers/clk/imx/clk-imx95-blk-ctl.c +2 -1
+	{ .compatible = "nxp,imx95-netcmix-blk-ctrl", .data =
+&netcmix_dev_data},
 	{ /* Sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, imx95_bc_of_match);
--

2.34.1

author
#6 lore raw

RE: [PATCH v2 3/4] clk: imx95: enable the clock of NETCMIX block control

Quoted 53 lines

-----Original Message-----
From: Peng Fan <[email protected]>
Sent: 2024年7月18日 15:35
To: Wei Fang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v2 3/4] clk: imx95: enable the clock of NETCMIX block control

Quoted 40 lines

Subject: [PATCH v2 3/4] clk: imx95: enable the clock of NETCMIX block control

The NETCMIX block control consists of registers for configuration of peripherals in the NETC domain, so enable the clock of NETCMIX to support the configuration.

---
V2:
Add RMII reference clock mux for ENETC0 and ENETC1.

---
 drivers/clk/imx/clk-imx95-blk-ctl.c | 30
+++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
(quoted diff) +0 -0

b/drivers/clk/imx/clk- imx95-blk-ctl.c index
74f595f9e5e3..19a62da74be4 100644

drivers/clk/imx/clk-imx95-blk-ctl.c +10 -0
@@ -248,6 +248,35 @@ static const struct imx95_blk_ctl_dev_data
 dispmix_csr_dev_data = {
 	.clk_reg_offset = 0,
 };
 
+static const struct imx95_blk_ctl_clk_dev_data
 netxmix_clk_dev_data[] = {
+	[IMX95_CLK_NETCMIX_ENETC0_RMII] = {
+		.name = "enetc0_rmii_sel",
+		.parent_names = (const char *[]){"ext_enetref",
 "enetref"},
+		.num_parents = 2,
+		.reg = 4,
+		.bit_idx = 5,
+		.bit_width = 1,
+		.type = CLK_MUX,
+		.flags = CLK_SET_RATE_NO_REPARENT |

CLK_SET_RATE_PARENT,

drivers/clk/imx/clk-imx95-blk-ctl.c +1 -0
+	},
Quoted 9 lines

drivers/clk/imx/clk-imx95-blk-ctl.c

Quoted 6 lines
drivers/clk/imx/clk-imx95-blk-ctl.c +3 -0
+	[IMX95_CLK_NETCMIX_ENETC1_RMII] = {
+		.name = "enetc1_rmii_sel",
+		.parent_names = (const char *[]){"ext_enetref",

"enetref"},

drivers/clk/imx/clk-imx95-blk-ctl.c +2 -0
+		.num_parents = 2,
+		.reg = 4,

Both the entry use reg address 4, use a lock to protect?

I think there is already a lock (bc->lock) to protect it, right?

if (data->type == CLK_MUX) {
			hws[i] = clk_hw_register_mux(dev, data->name, data->parent_names,
					data->num_parents, data->flags, reg,
					data->bit_idx, data->bit_width,
					data->flags2, &bc->lock);
}

Or did I misunderstand the usage of bc->lock?

reviewer Reviewed-by on v2 3/4
#7 lore raw

RE: [PATCH v2 3/4] clk: imx95: enable the clock of NETCMIX block control

In reply to Wei Fang
Quoted 9 lines

Subject: [PATCH v2 3/4] clk: imx95: enable the clock of NETCMIX block control

The NETCMIX block control consists of registers for configuration of peripherals in the NETC domain, so enable the clock of NETCMIX to support the configuration.

---

author
#8 lore raw

PATCH v2 4/4 arm64: dts: imx95: Add NETCMIX block control support

In reply to Wei Fang

Add NETCMIX block control support.

---
V2:
no changes.

---
 arch/arm64/boot/dts/freescale/imx95.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/freescale/imx95.dtsi +12 -0
index 1bbf9a0468f6..6e86aa98b431 100644
@@ -1188,5 +1188,17 @@ pcie1_ep: pcie-ep@4c380000 {
 			power-domains = <&scmi_devpd IMX95_PD_HSIO_TOP>;
 			status = "disabled";
 		};
+
+		netcmix_blk_ctrl: syscon@4c810000 {
+			compatible = "nxp,imx95-netcmix-blk-ctrl", "syscon";
+			reg = <0x0 0x4c810000 0x0 0x10000>;
+			#clock-cells = <1>;
+			clocks = <&scmi_clk IMX95_CLK_BUSNETCMIX>;
+			assigned-clocks = <&scmi_clk IMX95_CLK_BUSNETCMIX>;
+			assigned-clock-parents = <&scmi_clk IMX95_CLK_SYSPLL1_PFD1_DIV2>;
+			assigned-clock-rates = <133333333>;
+			power-domains = <&scmi_devpd IMX95_PD_NETC>;
+			status = "disabled";
+		};
 	};
 };
Signature · 1 line
2.34.1
author
#9 lore raw

RE: [PATCH v2 4/4] arm64: dts: imx95: Add NETCMIX block control support

Quoted 45 lines

-----Original Message-----
From: Wei Fang
Sent: 2024年7月10日 16:57
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Peng Fan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH v2 4/4] arm64: dts: imx95: Add NETCMIX block control support

Add NETCMIX block control support.

---
V2:
no changes.

---
 arch/arm64/boot/dts/freescale/imx95.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/freescale/imx95.dtsi +12 -0
index 1bbf9a0468f6..6e86aa98b431 100644
@@ -1188,5 +1188,17 @@ pcie1_ep: pcie-ep@4c380000 {
 			power-domains = <&scmi_devpd IMX95_PD_HSIO_TOP>;
 			status = "disabled";
 		};
+
+		netcmix_blk_ctrl: syscon@4c810000 {
+			compatible = "nxp,imx95-netcmix-blk-ctrl", "syscon";
+			reg = <0x0 0x4c810000 0x0 0x10000>;
+			#clock-cells = <1>;
+			clocks = <&scmi_clk IMX95_CLK_BUSNETCMIX>;
+			assigned-clocks = <&scmi_clk IMX95_CLK_BUSNETCMIX>;
+			assigned-clock-parents = <&scmi_clk
 IMX95_CLK_SYSPLL1_PFD1_DIV2>;
+			assigned-clock-rates = <133333333>;
+			power-domains = <&scmi_devpd IMX95_PD_NETC>;
+			status = "disabled";
+		};
 	};
Quoted 3 lines

};
--
2.34.1

Kindly ping...