Skip to contentSkip to conversation

ARM: dts: stm32: Add alternate pinmux for ethernet0 pins

PATCH In review Marek Vasut 2 participants 19 messages Jan 6, 2021 – Feb 1, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 ARM: dts: stm32: Add alternate pinmux for ethernet0 pins

Add another mux option for ethernet0 pins, this is used on DHCOM when the ethernet PHY 50 MHz clock is generated by the MCO2 on PG2 pin and then fed back via PA1 pin.

Cc Alexandre Torgue <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>

To: [email protected]

---
 arch/arm/boot/dts/stm32mp15-pinctrl.dtsi | 34 ++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +34 -0
index 769d30593e66..fe0cc9c5991e 100644
@@ -342,6 +342,40 @@ pins1 {
 		};
 	};
 
+	ethernet0_rmii_pins_b: rmii-1 {
+		pins1 {
+			pinmux = <STM32_PINMUX('G', 13, AF11)>, /* ETH1_RMII_TXD0 */
+				 <STM32_PINMUX('G', 14, AF11)>, /* ETH1_RMII_TXD1 */
+				 <STM32_PINMUX('B', 11, AF11)>, /* ETH1_RMII_TX_EN */
+				 <STM32_PINMUX('A', 1, AF11)>,  /* ETH1_RMII_REF_CLK */
+				 <STM32_PINMUX('A', 2, AF11)>,  /* ETH1_MDIO */
+				 <STM32_PINMUX('C', 1, AF11)>;  /* ETH1_MDC */
+			bias-disable;
+			drive-push-pull;
+			slew-rate = <2>;
+		};
+		pins2 {
+			pinmux = <STM32_PINMUX('C', 4, AF11)>,  /* ETH1_RMII_RXD0 */
+				 <STM32_PINMUX('C', 5, AF11)>,  /* ETH1_RMII_RXD1 */
+				 <STM32_PINMUX('A', 7, AF11)>;  /* ETH1_RMII_CRS_DV */
+			bias-disable;
+		};
+	};
+
+	ethernet0_rmii_sleep_pins_b: rmii-sleep-1 {
+		pins1 {
+			pinmux = <STM32_PINMUX('G', 13, ANALOG)>, /* ETH1_RMII_TXD0 */
+				 <STM32_PINMUX('G', 14, ANALOG)>, /* ETH1_RMII_TXD1 */
+				 <STM32_PINMUX('B', 11, ANALOG)>, /* ETH1_RMII_TX_EN */
+				 <STM32_PINMUX('A', 2, ANALOG)>,  /* ETH1_MDIO */
+				 <STM32_PINMUX('C', 1, ANALOG)>,  /* ETH1_MDC */
+				 <STM32_PINMUX('C', 4, ANALOG)>,  /* ETH1_RMII_RXD0 */
+				 <STM32_PINMUX('C', 5, ANALOG)>,  /* ETH1_RMII_RXD1 */
+				 <STM32_PINMUX('A', 1, ANALOG)>,  /* ETH1_RMII_REF_CLK */
+				 <STM32_PINMUX('A', 7, ANALOG)>;  /* ETH1_RMII_CRS_DV */
+		};
+	};
+
 	fmc_pins_a: fmc-0 {
 		pins1 {
 			pinmux = <STM32_PINMUX('D', 4, AF12)>, /* FMC_NOE */
Signature · 7 lines
2.29.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH 2/4 ARM: dts: stm32: Add alternate pinmux for mco2 pins

Add pinmux option for MCO2 pin. This is used on DHCOM when the ethernet PHY 50 MHz clock is generated by the MCO2 on PG2 pin.

Cc Alexandre Torgue <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>

To: [email protected]

---
 arch/arm/boot/dts/stm32mp15-pinctrl.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +15 -0
index fe0cc9c5991e..d8297dfff3e6 100644
@@ -886,6 +886,21 @@ pins {
 		};
 	};
 
+	mco2_pins_a: mco2-0 {
+		pins {
+			pinmux = <STM32_PINMUX('G', 2, AF1)>; /* MCO2 */
+			bias-disable;
+			drive-push-pull;
+			slew-rate = <2>;
+		};
+	};
+
+	mco2_sleep_pins_a: mco2-sleep-0 {
+		pins {
+			pinmux = <STM32_PINMUX('G', 2, ANALOG)>; /* MCO2 */
+		};
+	};
+
 	m_can1_pins_a: m-can1-0 {
 		pins1 {
 			pinmux = <STM32_PINMUX('H', 13, AF9)>; /* CAN1_TX */
Signature · 7 lines
2.29.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

RFC PATCH 3/4 ARM: dts: stm32: Add mux for ETHRX clock

In reply to Marek Vasut

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

First, the ETHRX clock in clk-stm32mp1.c only represents the ETHRXEN gate, however it should represent also ETH_REF_CLK_SEL mux. The problem is that the ETH_REF_CLK_SEL mux is currently configured in the DWMAC4 driver and the ETH_REF_CLK_SEL bit is part of SYSCFG block, not the DWMAC4 or the clock block.

Second, the ETHRX parent clock is either eth_clk_fb (ETHCK_K) or external ETH_RX_CLK/ETH_REF_CLK_SEL, it is never CK_AXI.

This patch attempts to address the clock selection by adding fixed factor clock to DT, which allows the user to select its upstream clock.

Cc Alexandre Torgue <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>

To: [email protected]

---
 arch/arm/boot/dts/stm32mp151.dtsi | 8 ++++++++
 drivers/clk/clk-stm32mp1.c        | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp151.dtsi +8 -0
index 32875eabd357..8c2a5d0875d8 100644
@@ -82,6 +82,14 @@ clk_csi: clk-csi {
 			compatible = "fixed-clock";
 			clock-frequency = <4000000>;
 		};
+
+		clk_eth_rx: eth-rx-clk {
+			compatible = "fixed-factor-clock";
+			clocks = <&rcc ETHCK_K>;
+			#clock-cells = <0>;
+			clock-div = <1>;
+			clock-mult = <1>;
+		};
 	};
 
 	thermal-zones {
drivers/clk/clk-stm32mp1.c +1 -1
index a875649df8b8..63971d40f15c 100644
@@ -1892,7 +1892,7 @@ static const struct clock_config stm32mp1_clock_cfg[] = {
 	PCLK(MDMA, "mdma", "ck_axi", 0, G_MDMA),
 	PCLK(GPU, "gpu", "ck_axi", 0, G_GPU),
 	PCLK(ETHTX, "ethtx", "ck_axi", 0, G_ETHTX),
-	PCLK(ETHRX, "ethrx", "ck_axi", 0, G_ETHRX),
+	PCLK(ETHRX, "ethrx", "eth-rx-clk", 0, G_ETHRX),
 	PCLK(ETHMAC, "ethmac", "ck_axi", 0, G_ETHMAC),
 	PCLK(FMC, "fmc", "ck_axi", CLK_IGNORE_UNUSED, G_FMC),
 	PCLK(QSPI, "qspi", "ck_axi", CLK_IGNORE_UNUSED, G_QSPI),
Signature · 7 lines
2.29.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#3 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Hi Marek

Quoted 4 lines · Marek Vasut

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

Quoted 6 lines

First, the ETHRX clock in clk-stm32mp1.c only represents the ETHRXEN gate, however it should represent also ETH_REF_CLK_SEL mux. The problem is that the ETH_REF_CLK_SEL mux is currently configured in the DWMAC4 driver and the ETH_REF_CLK_SEL bit is part of SYSCFG block, not the DWMAC4 or the clock block.

dwmac4-stm32 doesn't contain code for dwmac4 but it contains the glue around the dwmac4: syscfg, clocks ...

Quoted 3 lines

Second, the ETHRX parent clock is either eth_clk_fb (ETHCK_K) or external ETH_RX_CLK/ETH_REF_CLK_SEL, it is never CK_AXI.

Why CK_AXI ?

Regards
Alex

Quoted 41 lines

This patch attempts to address the clock selection by adding fixed factor clock to DT, which allows the user to select its upstream clock.

Cc Alexandre Torgue <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>

To: [email protected]

---
  arch/arm/boot/dts/stm32mp151.dtsi | 8 ++++++++
  drivers/clk/clk-stm32mp1.c        | 2 +-
  2 files changed, 9 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp151.dtsi +8 -0
index 32875eabd357..8c2a5d0875d8 100644
@@ -82,6 +82,14 @@ clk_csi: clk-csi {
  			compatible = "fixed-clock";
  			clock-frequency = <4000000>;
  		};
+
+		clk_eth_rx: eth-rx-clk {
+			compatible = "fixed-factor-clock";
+			clocks = <&rcc ETHCK_K>;
+			#clock-cells = <0>;
+			clock-div = <1>;
+			clock-mult = <1>;
+		};
  	};
 
  	thermal-zones {
drivers/clk/clk-stm32mp1.c +0 -0
index a875649df8b8..63971d40f15c 100644

drivers/clk/clk-stm32mp1.c static const struct clock_config stm32mp1_clock_cfg[] = { · line 1898

Quoted 8 lines
drivers/clk/clk-stm32mp1.c +1 -1
@@ -1892,7 +1892,7 @@ static const struct clock_config stm32mp1_clock_cfg[] = {
  	PCLK(MDMA, "mdma", "ck_axi", 0, G_MDMA),
  	PCLK(GPU, "gpu", "ck_axi", 0, G_GPU),
  	PCLK(ETHTX, "ethtx", "ck_axi", 0, G_ETHTX),
-	PCLK(ETHRX, "ethrx", "ck_axi", 0, G_ETHRX),
+	PCLK(ETHRX, "ethrx", "eth-rx-clk", 0, G_ETHRX),
  	PCLK(ETHMAC, "ethmac", "ck_axi", 0, G_ETHMAC),
  	PCLK(FMC, "fmc", "ck_axi", CLK_IGNORE_UNUSED, G_FMC),
  	PCLK(QSPI, "qspi", "ck_axi", CLK_IGNORE_UNUSED, G_QSPI),

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 1 line · Alexandre TORGUE

Hi Marek

Hi,

Quoted 9 lines · Marek Vasut
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

So, what I want to model here is this:

PLL4P = 100 MHz
MCO2 is supplied by PLL4P and set to /2 , so MCO2 = 50 MHz SoC pad PG2 is set as MCO2 output, thus a source of 50 MHz signal SoC pad PA1 is set as ETH_RX_CLK and connected to PG2

This works fine in practice, except it cannot be modeled using current DT bindings, even though it should be possible to model it.

Quoted 7 lines
Quoted 5 lines

First, the ETHRX clock in clk-stm32mp1.c only represents the ETHRXEN gate, however it should represent also ETH_REF_CLK_SEL mux. The problem is that the ETH_REF_CLK_SEL mux is currently configured in the DWMAC4 driver and the ETH_REF_CLK_SEL bit is part of SYSCFG block, not the DWMAC4 or the clock block.

dwmac4-stm32 doesn't contain code for dwmac4 but it contains the glue around the dwmac4: syscfg, clocks ...

The problem is that dwmac4-stm32 isn't the right place to configure the ETHRX clock mux, that should be in the clock driver. So the stm32 clock driver should have SYSCFG handle and configure ETH_REF_CLK_SEL mux. The "st,eth-ref-clk-sel" DT prop would then not be needed at all, as the reference clock select would be configured using assigned-clocks in DT.

The default assigned-clocks should be eth_clk_fb , but the user can override it in the DT and provide another clock source (e.g. in my case, that would be PLL4P->MCO2->ETHRX).

Quoted 4 lines
Quoted 2 lines

Second, the ETHRX parent clock is either eth_clk_fb (ETHCK_K) or external ETH_RX_CLK/ETH_REF_CLK_SEL, it is never CK_AXI.

Why CK_AXI ?

See drivers/clk/clk-stm32mp1.c:
1895 PCLK(ETHRX, "ethrx", "ck_axi", 0, G_ETHRX),

[...]

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#5 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 13 lines · Marek Vasut
Quoted 1 line · Alexandre TORGUE

Hi Marek

Hi,

Quoted 8 lines · Marek Vasut
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Quoted 7 lines
Quoted 1 line

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

Quoted 7 lines

So, what I want to model here is this:

PLL4P = 100 MHz
MCO2 is supplied by PLL4P and set to /2 , so MCO2 = 50 MHz SoC pad PG2 is set as MCO2 output, thus a source of 50 MHz signal SoC pad PA1 is set as ETH_RX_CLK and connected to PG2

Ok I see (to be honest IIWR we didn't test i :$) but it should work.

Quoted 1 line

This works fine in practice, except it cannot be modeled using current DT bindings, even though it should be possible to model it.

For dwmac point of view it's quite the same thing to have your PHY clocking by MCO or by a crystal. You just need to configure RX_REF pad and ETH_CLK_SEL to get the 50 MHz RMII reference clock.

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines

First, the ETHRX clock in clk-stm32mp1.c only represents the ETHRXEN gate, however it should represent also ETH_REF_CLK_SEL mux. The problem is that the ETH_REF_CLK_SEL mux is currently configured in the DWMAC4 driver and the ETH_REF_CLK_SEL bit is part of SYSCFG block, not the DWMAC4 or the clock block.

dwmac4-stm32 doesn't contain code for dwmac4 but it contains the glue around the dwmac4: syscfg, clocks ...

The problem is that dwmac4-stm32 isn't the right place to configure the ETHRX clock mux, that should be in the clock driver. So the stm32 clock driver should have SYSCFG handle and configure ETH_REF_CLK_SEL mux. The "st,eth-ref-clk-sel" DT prop would then not be needed at all, as the reference clock select would be configured using assigned-clocks in DT.

Idea was to keep at the same place the Ethernet glue configuration. We can't move all this glue into clock driver as phy interface is needed to well configure some sysconf registers. Current dwamc-stm32 glue is working and documented. I'm not convinced to develop a new one by splitting clock sysconf in clock driver and phy interface management at ethernet level. I think we will get the same functional result (but yes maybe more understandable at dt-bindings level). We could maybe update binding name to be more clear.

Quoted 11 lines

The default assigned-clocks should be eth_clk_fb , but the user can override it in the DT and provide another clock source (e.g. in my case, that would be PLL4P->MCO2->ETHRX).

Quoted 4 lines
Quoted 2 lines

Second, the ETHRX parent clock is either eth_clk_fb (ETHCK_K) or external ETH_RX_CLK/ETH_REF_CLK_SEL, it is never CK_AXI.

Why CK_AXI ?

See drivers/clk/clk-stm32mp1.c:
  1895          PCLK(ETHRX, "ethrx", "ck_axi", 0, G_ETHRX),

Ok I see, and it is the same case for TX also. Discussing with our clock expert it was done for simplification.

regards
Alex

Quoted 1 line

[...]

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#6 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

On 1/15/21 4:22 PM, Alexandre TORGUE wrote:

Hi,

[...]

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

Quoted 7 lines
Quoted 5 lines

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

Quoted 8 lines
Quoted 6 lines

So, what I want to model here is this:

PLL4P = 100 MHz
MCO2 is supplied by PLL4P and set to /2 , so MCO2 = 50 MHz SoC pad PG2 is set as MCO2 output, thus a source of 50 MHz signal SoC pad PA1 is set as ETH_RX_CLK and connected to PG2

Ok I see (to be honest IIWR we didn't test i :$) but it should work.

It does work, I have boards which use this setup already.

Quoted 3 lines
Quoted 1 line

This works fine in practice, except it cannot be modeled using current DT bindings, even though it should be possible to model it.

For dwmac point of view it's quite the same thing to have your PHY clocking by MCO or by a crystal. You just need to configure RX_REF pad and ETH_CLK_SEL to get the 50 MHz RMII reference clock.

Yes

Quoted 11 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

First, the ETHRX clock in clk-stm32mp1.c only represents the ETHRXEN gate, however it should represent also ETH_REF_CLK_SEL mux. The problem is that the ETH_REF_CLK_SEL mux is currently configured in the DWMAC4 driver and the ETH_REF_CLK_SEL bit is part of SYSCFG block, not the DWMAC4 or the clock block.

dwmac4-stm32 doesn't contain code for dwmac4 but it contains the glue around the dwmac4: syscfg, clocks ...

The problem is that dwmac4-stm32 isn't the right place to configure the ETHRX clock mux, that should be in the clock driver. So the stm32 clock driver should have SYSCFG handle and configure ETH_REF_CLK_SEL mux. The "st,eth-ref-clk-sel" DT prop would then not be needed at all, as the reference clock select would be configured using assigned-clocks in DT.

Idea was to keep at the same place the Ethernet glue configuration. We can't move all this glue into clock driver as phy interface is needed to well configure some sysconf registers.

This configuration can be done by the clock driver too. And in fact, I believe it should be done by the clock driver, just like it's done for all the other clock muxes with gates in the clock driver, except in this case the mux is in syscfg and gate is in rcc.

Quoted 1 line

Current dwamc-stm32 glue is working and documented. I'm not convinced to develop a new one by splitting clock sysconf in clock driver and phy interface management at ethernet level. I think we will get the same functional result (but yes maybe more understandable at dt-bindings level). We could maybe update binding name to be more clear.

You don't get the same result, since you cannot model the MCO2 input into ETHRX. Or can you ?

I also think that we won't need new binding altogether, just a slight tweak to the existing ones which would permit modeling the MCO2 input into ETHRX, I am open to suggestions how to do it. Note that the clock framework must be able to turn off both ETHRX gate, MCO2 and all the way up the tree if ETHRX is turned off.

Quoted 5 lines
Quoted 5 lines

The default assigned-clocks should be eth_clk_fb , but the user can override it in the DT and provide another clock source (e.g. in my case, that would be PLL4P->MCO2->ETHRX).

Quoted 3 lines
Quoted 2 lines

Second, the ETHRX parent clock is either eth_clk_fb (ETHCK_K) or external ETH_RX_CLK/ETH_REF_CLK_SEL, it is never CK_AXI.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Why CK_AXI ?

See drivers/clk/clk-stm32mp1.c:
   1895          PCLK(ETHRX, "ethrx", "ck_axi", 0, G_ETHRX),

Ok I see, and it is the same case for TX also. Discussing with our clock expert it was done for simplification.

So, how shall we proceed here ?

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#7 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 17 lines · Marek Vasut

On 1/15/21 4:22 PM, Alexandre TORGUE wrote:

Hi,

[...]

Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

Quoted 24 lines
Quoted 9 lines
Quoted 7 lines

So, what I want to model here is this:

PLL4P = 100 MHz
MCO2 is supplied by PLL4P and set to /2 , so MCO2 = 50 MHz SoC pad PG2 is set as MCO2 output, thus a source of 50 MHz signal SoC pad PA1 is set as ETH_RX_CLK and connected to PG2

Ok I see (to be honest IIWR we didn't test i :$) but it should work.

It does work, I have boards which use this setup already.

Quoted 3 lines
Quoted 1 line

This works fine in practice, except it cannot be modeled using current DT bindings, even though it should be possible to model it.

For dwmac point of view it's quite the same thing to have your PHY clocking by MCO or by a crystal. You just need to configure RX_REF pad and ETH_CLK_SEL to get the 50 MHz RMII reference clock.

Yes

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

First, the ETHRX clock in clk-stm32mp1.c only represents the ETHRXEN gate, however it should represent also ETH_REF_CLK_SEL mux. The problem is that the ETH_REF_CLK_SEL mux is currently configured in the DWMAC4 driver and the ETH_REF_CLK_SEL bit is part of SYSCFG block, not the DWMAC4 or the clock block.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

dwmac4-stm32 doesn't contain code for dwmac4 but it contains the glue around the dwmac4: syscfg, clocks ...

The problem is that dwmac4-stm32 isn't the right place to configure the ETHRX clock mux, that should be in the clock driver. So the stm32 clock driver should have SYSCFG handle and configure ETH_REF_CLK_SEL mux. The "st,eth-ref-clk-sel" DT prop would then not be needed at all, as the reference clock select would be configured using assigned-clocks in DT.

Idea was to keep at the same place the Ethernet glue configuration. We can't move all this glue into clock driver as phy interface is needed to well configure some sysconf registers.

This configuration can be done by the clock driver too. And in fact, I believe it should be done by the clock driver, just like it's done for all the other clock muxes with gates in the clock driver, except in this case the mux is in syscfg and gate is in rcc.

As said, choice has been done to do it in dwmac-stm32, and sorry I see more drawbacks than benefits to move it now.

Quoted 4 lines
Quoted 2 lines

Current dwamc-stm32 glue is working and documented. I'm not convinced to develop a new one by splitting clock sysconf in clock driver and phy interface management at ethernet level. I think we will get the same functional result (but yes maybe more understandable at dt-bindings level). We could maybe update binding name to be more clear.

You don't get the same result, since you cannot model the MCO2 input into ETHRX. Or can you ?

Why do you want to model MCO2 into ETHRX ? MCO2 just replace a crystal, and when a crystal is used, it is not modeled. I think is it the same case for MCO2.

Quoted 10 lines

I also think that we won't need new binding altogether, just a slight tweak to the existing ones which would permit modeling the MCO2 input into ETHRX, I am open to suggestions how to do it. Note that the clock framework must be able to turn off both ETHRX gate, MCO2 and all the way up the tree if ETHRX is turned off.

Quoted 7 lines
Quoted 7 lines

The default assigned-clocks should be eth_clk_fb , but the user can override it in the DT and provide another clock source (e.g. in my case, that would be PLL4P->MCO2->ETHRX).

Quoted 4 lines
Quoted 2 lines

Second, the ETHRX parent clock is either eth_clk_fb (ETHCK_K) or external ETH_RX_CLK/ETH_REF_CLK_SEL, it is never CK_AXI.

Why CK_AXI ?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

See drivers/clk/clk-stm32mp1.c:
   1895          PCLK(ETHRX, "ethrx", "ck_axi", 0, G_ETHRX),

Ok I see, and it is the same case for TX also. Discussing with our clock expert it was done for simplification.

So, how shall we proceed here ?

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#8 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 22 lines · Alexandre TORGUE
Quoted 19 lines · Marek Vasut

On 1/15/21 4:22 PM, Alexandre TORGUE wrote:

Hi,

[...]

Quoted 13 lines
Quoted 13 lines
Quoted 8 lines
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

I am supplying MCO2 with PLL4P, that is PLL4P->MCO2->ETHRX . To enable this entire chain of clock, I need the correct clock tree. Currently that cannot be modeled, can it?

Quoted 25 lines
Quoted 25 lines
Quoted 8 lines
Quoted 6 lines

So, what I want to model here is this:

PLL4P = 100 MHz
MCO2 is supplied by PLL4P and set to /2 , so MCO2 = 50 MHz SoC pad PG2 is set as MCO2 output, thus a source of 50 MHz signal SoC pad PA1 is set as ETH_RX_CLK and connected to PG2

Ok I see (to be honest IIWR we didn't test i :$) but it should work.

It does work, I have boards which use this setup already.

Quoted 3 lines
Quoted 1 line

This works fine in practice, except it cannot be modeled using current DT bindings, even though it should be possible to model it.

For dwmac point of view it's quite the same thing to have your PHY clocking by MCO or by a crystal. You just need to configure RX_REF pad and ETH_CLK_SEL to get the 50 MHz RMII reference clock.

Yes

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

First, the ETHRX clock in clk-stm32mp1.c only represents the ETHRXEN gate, however it should represent also ETH_REF_CLK_SEL mux. The problem is that the ETH_REF_CLK_SEL mux is currently configured in the DWMAC4 driver and the ETH_REF_CLK_SEL bit is part of SYSCFG block, not the DWMAC4 or the clock block.

dwmac4-stm32 doesn't contain code for dwmac4 but it contains the glue around the dwmac4: syscfg, clocks ...

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

The problem is that dwmac4-stm32 isn't the right place to configure the ETHRX clock mux, that should be in the clock driver. So the stm32 clock driver should have SYSCFG handle and configure ETH_REF_CLK_SEL mux. The "st,eth-ref-clk-sel" DT prop would then not be needed at all, as the reference clock select would be configured using assigned-clocks in DT.

Idea was to keep at the same place the Ethernet glue configuration. We can't move all this glue into clock driver as phy interface is needed to well configure some sysconf registers.

This configuration can be done by the clock driver too. And in fact, I believe it should be done by the clock driver, just like it's done for all the other clock muxes with gates in the clock driver, except in this case the mux is in syscfg and gate is in rcc.

As said, choice has been done to do it in dwmac-stm32, and sorry I see more drawbacks than benefits to move it now.

Surely a backward-compatible implementation would be possible, how do you feel about that ?

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Current dwamc-stm32 glue is working and documented. I'm not convinced to develop a new one by splitting clock sysconf in clock driver and phy interface management at ethernet level. I think we will get the same functional result (but yes maybe more understandable at dt-bindings level). We could maybe update binding name to be more clear.

You don't get the same result, since you cannot model the MCO2 input into ETHRX. Or can you ?

Why do you want to model MCO2 into ETHRX ? MCO2 just replace a crystal, and when a crystal is used, it is not modeled. I think is it the same case for MCO2.

I need to correctly enable all the clock instead of keeping MCO2 enabled all the time. If ethrx is not needed, the clock are disabled and if even the upstream clock are no longer needed, they (MCO2, and then PLL4P) can be disabled too.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#9 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 25 lines · Marek Vasut
Quoted 24 lines · Alexandre TORGUE
Quoted 21 lines · Marek Vasut

On 1/15/21 4:22 PM, Alexandre TORGUE wrote:

Hi,

[...]

Quoted 15 lines
Quoted 14 lines
Quoted 8 lines
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

I am supplying MCO2 with PLL4P, that is PLL4P->MCO2->ETHRX . To enable this entire chain of clock, I need the correct clock tree. Currently that cannot be modeled, can it?

Maybe I miss something, I thought your setup was like that:

First clock path to your PHY:
--------------------

PLL4P ---> MCO2 ---> X1 (PHY input clock which replaces crystal)
It is not directly linked to the dwmac-stm32. You "just" provide a clock to MCO2. After that you can use MCO2 pins for any usages.

Second clock patch:
--------------------

50MHz (refclk coming from phy) --> ETH_REF_CLK pad This one is already covered in dwmac-stm32.

Why do you want to link the both clock paths ?

Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 8 lines
Quoted 6 lines

So, what I want to model here is this:

PLL4P = 100 MHz
MCO2 is supplied by PLL4P and set to /2 , so MCO2 = 50 MHz SoC pad PG2 is set as MCO2 output, thus a source of 50 MHz signal SoC pad PA1 is set as ETH_RX_CLK and connected to PG2

Ok I see (to be honest IIWR we didn't test i :$) but it should work.

It does work, I have boards which use this setup already.

Quoted 3 lines
Quoted 1 line

This works fine in practice, except it cannot be modeled using current DT bindings, even though it should be possible to model it.

For dwmac point of view it's quite the same thing to have your PHY clocking by MCO or by a crystal. You just need to configure RX_REF pad and ETH_CLK_SEL to get the 50 MHz RMII reference clock.

Yes

Quoted 10 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

First, the ETHRX clock in clk-stm32mp1.c only represents the ETHRXEN gate, however it should represent also ETH_REF_CLK_SEL mux. The problem is that the ETH_REF_CLK_SEL mux is currently configured in the DWMAC4 driver and the ETH_REF_CLK_SEL bit is part of SYSCFG block, not the DWMAC4 or the clock block.

dwmac4-stm32 doesn't contain code for dwmac4 but it contains the glue around the dwmac4: syscfg, clocks ...

The problem is that dwmac4-stm32 isn't the right place to configure the ETHRX clock mux, that should be in the clock driver. So the stm32 clock driver should have SYSCFG handle and configure ETH_REF_CLK_SEL mux. The "st,eth-ref-clk-sel" DT prop would then not be needed at all, as the reference clock select would be configured using assigned-clocks in DT.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Idea was to keep at the same place the Ethernet glue configuration. We can't move all this glue into clock driver as phy interface is needed to well configure some sysconf registers.

This configuration can be done by the clock driver too. And in fact, I believe it should be done by the clock driver, just like it's done for all the other clock muxes with gates in the clock driver, except in this case the mux is in syscfg and gate is in rcc.

As said, choice has been done to do it in dwmac-stm32, and sorry I see more drawbacks than benefits to move it now.

Surely a backward-compatible implementation would be possible, how do you feel about that ?

Well done I can't say "no" in this case.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Current dwamc-stm32 glue is working and documented. I'm not convinced to develop a new one by splitting clock sysconf in clock driver and phy interface management at ethernet level. I think we will get the same functional result (but yes maybe more understandable at dt-bindings level). We could maybe update binding name to be more clear.

You don't get the same result, since you cannot model the MCO2 input into ETHRX. Or can you ?

Why do you want to model MCO2 into ETHRX ? MCO2 just replace a crystal, and when a crystal is used, it is not modeled. I think is it the same case for MCO2.

I need to correctly enable all the clock instead of keeping MCO2 enabled all the time. If ethrx is not needed, the clock are disabled and if even the upstream clock are no longer needed, they (MCO2, and then PLL4P) can be disabled too.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#10 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

On 1/26/21 11:54 AM, Alexandre TORGUE wrote:
[...]

Quoted 32 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 8 lines
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

I am supplying MCO2 with PLL4P, that is PLL4P->MCO2->ETHRX . To enable this entire chain of clock, I need the correct clock tree. Currently that cannot be modeled, can it?

Maybe I miss something, I thought your setup was like that:

First clock path to your PHY:
--------------------

PLL4P ---> MCO2 ---> X1 (PHY input clock which replaces crystal)
It is not directly linked to the dwmac-stm32. You "just" provide a clock to MCO2. After that you can use MCO2 pins for any usages.

Quoted 7 lines

Second clock patch:
--------------------

50MHz (refclk coming from phy) --> ETH_REF_CLK pad This one is already covered in dwmac-stm32.

Why do you want to link the both clock paths ?

Because the X1 (MCO2 output) is the same net as 50 MHz ETH_REF_CLK input. MCO2 output is routed on a SoC pin and that is connected with a wire to ETH_REF_CLK SoC pin (input).

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#11 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 38 lines · Marek Vasut

On 1/26/21 11:54 AM, Alexandre TORGUE wrote:
[...]

Quoted 36 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

I am supplying MCO2 with PLL4P, that is PLL4P->MCO2->ETHRX . To enable this entire chain of clock, I need the correct clock tree. Currently that cannot be modeled, can it?

Maybe I miss something, I thought your setup was like that:

First clock path to your PHY:
--------------------

PLL4P ---> MCO2 ---> X1 (PHY input clock which replaces crystal)
It is not directly linked to the dwmac-stm32. You "just" provide a clock to MCO2. After that you can use MCO2 pins for any usages.

Second clock patch:
--------------------

Quoted 6 lines
Quoted 4 lines

50MHz (refclk coming from phy) --> ETH_REF_CLK pad This one is already covered in dwmac-stm32.

Why do you want to link the both clock paths ?

Because the X1 (MCO2 output) is the same net as 50 MHz ETH_REF_CLK input. MCO2 output is routed on a SoC pin and that is connected with a wire to ETH_REF_CLK SoC pin (input).

Ok I see, but I don't think you have to link both clocks.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#12 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 41 lines · Alexandre TORGUE
Quoted 38 lines · Marek Vasut

On 1/26/21 11:54 AM, Alexandre TORGUE wrote:
[...]

Quoted 36 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

I am supplying MCO2 with PLL4P, that is PLL4P->MCO2->ETHRX . To enable this entire chain of clock, I need the correct clock tree. Currently that cannot be modeled, can it?

Maybe I miss something, I thought your setup was like that:

First clock path to your PHY:
--------------------

PLL4P ---> MCO2 ---> X1 (PHY input clock which replaces crystal)
It is not directly linked to the dwmac-stm32. You "just" provide a clock to MCO2. After that you can use MCO2 pins for any usages.

Second clock patch:
--------------------

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

50MHz (refclk coming from phy) --> ETH_REF_CLK pad This one is already covered in dwmac-stm32.

Why do you want to link the both clock paths ?

Because the X1 (MCO2 output) is the same net as 50 MHz ETH_REF_CLK input. MCO2 output is routed on a SoC pin and that is connected with a wire to ETH_REF_CLK SoC pin (input).

Ok I see, but I don't think you have to link both clocks.

If I don't, then MCO2 will not have any consumer and would be turned off by the kernel.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#13 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 45 lines · Marek Vasut
Quoted 44 lines · Alexandre TORGUE
Quoted 41 lines · Marek Vasut

On 1/26/21 11:54 AM, Alexandre TORGUE wrote:
[...]

Quoted 39 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

I am supplying MCO2 with PLL4P, that is PLL4P->MCO2->ETHRX . To enable this entire chain of clock, I need the correct clock tree. Currently that cannot be modeled, can it?

Maybe I miss something, I thought your setup was like that:

First clock path to your PHY:
--------------------

PLL4P ---> MCO2 ---> X1 (PHY input clock which replaces crystal)
It is not directly linked to the dwmac-stm32. You "just" provide a clock to MCO2. After that you can use MCO2 pins for any usages.

Second clock patch:
--------------------

50MHz (refclk coming from phy) --> ETH_REF_CLK pad This one is already covered in dwmac-stm32.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Why do you want to link the both clock paths ?

Because the X1 (MCO2 output) is the same net as 50 MHz ETH_REF_CLK input. MCO2 output is routed on a SoC pin and that is connected with a wire to ETH_REF_CLK SoC pin (input).

Ok I see, but I don't think you have to link both clocks.

If I don't, then MCO2 will not have any consumer and would be turned off by the kernel.

I agree, but IMO the MCO clock should be declared with CLK_IGNORE_UNUSED flag in stm32mp1 clock driver.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#14 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 50 lines · Alexandre TORGUE
Quoted 47 lines · Marek Vasut
Quoted 46 lines · Alexandre TORGUE
Quoted 43 lines · Marek Vasut

On 1/26/21 11:54 AM, Alexandre TORGUE wrote:
[...]

Quoted 40 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not permit selecting the clock input from SoC pad. To make things worse, the implementation of this is partly present and is split between the clock driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

I am supplying MCO2 with PLL4P, that is PLL4P->MCO2->ETHRX . To enable this entire chain of clock, I need the correct clock tree. Currently that cannot be modeled, can it?

Maybe I miss something, I thought your setup was like that:

First clock path to your PHY:
--------------------

PLL4P ---> MCO2 ---> X1 (PHY input clock which replaces crystal)
It is not directly linked to the dwmac-stm32. You "just" provide a clock to MCO2. After that you can use MCO2 pins for any usages.

Second clock patch:
--------------------

50MHz (refclk coming from phy) --> ETH_REF_CLK pad This one is already covered in dwmac-stm32.

Why do you want to link the both clock paths ?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Because the X1 (MCO2 output) is the same net as 50 MHz ETH_REF_CLK input. MCO2 output is routed on a SoC pin and that is connected with a wire to ETH_REF_CLK SoC pin (input).

Ok I see, but I don't think you have to link both clocks.

If I don't, then MCO2 will not have any consumer and would be turned off by the kernel.

I agree, but IMO the MCO clock should be declared with CLK_IGNORE_UNUSED flag in stm32mp1 clock driver.

Why? It can be safely turned off if it is only used to supply ETHRX. And if the clock tree is correctly modeled, that is what happens.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#15 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 53 lines · Marek Vasut
Quoted 52 lines · Alexandre TORGUE
Quoted 49 lines · Marek Vasut
Quoted 48 lines · Alexandre TORGUE
Quoted 44 lines · Marek Vasut

On 1/26/21 11:54 AM, Alexandre TORGUE wrote:
[...]

Quoted 33 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not
permit selecting the clock input from SoC pad. To make things worse, the
implementation of this is partly present and is split between the clock
driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

I am supplying MCO2 with PLL4P, that is PLL4P->MCO2->ETHRX . To enable this entire chain of clock, I need the correct clock tree. Currently that cannot be modeled, can it?

Maybe I miss something, I thought your setup was like that:

First clock path to your PHY:
--------------------

PLL4P ---> MCO2 ---> X1 (PHY input clock which replaces crystal)
It is not directly linked to the dwmac-stm32. You "just" provide a clock to MCO2. After that you can use MCO2 pins for any usages.

Quoted 7 lines

Second clock patch:
--------------------

50MHz (refclk coming from phy) --> ETH_REF_CLK pad This one is already covered in dwmac-stm32.

Why do you want to link the both clock paths ?

Because the X1 (MCO2 output) is the same net as 50 MHz ETH_REF_CLK input. MCO2 output is routed on a SoC pin and that is connected with a wire to ETH_REF_CLK SoC pin (input).

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ok I see, but I don't think you have to link both clocks.

If I don't, then MCO2 will not have any consumer and would be turned off by the kernel.

I agree, but IMO the MCO clock should be declared with CLK_IGNORE_UNUSED flag in stm32mp1 clock driver.

Why? It can be safely turned off if it is only used to supply ETHRX. And if the clock tree is correctly modeled, that is what happens.

You're right. I think we could only add an optional clock inside dwmac stm32 glue to take this phy clock (here MCO2)

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#16 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 58 lines · Alexandre TORGUE
Quoted 55 lines · Marek Vasut
Quoted 54 lines · Alexandre TORGUE
Quoted 51 lines · Marek Vasut
Quoted 49 lines · Alexandre TORGUE
Quoted 38 lines · Marek Vasut

On 1/26/21 11:54 AM, Alexandre TORGUE wrote:
[...]

Quoted 36 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 9 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not
permit selecting the clock input from SoC pad. To make things worse, the
implementation of this is partly present and is split between the clock
driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

I am supplying MCO2 with PLL4P, that is PLL4P->MCO2->ETHRX . To enable this entire chain of clock, I need the correct clock tree. Currently that cannot be modeled, can it?

Maybe I miss something, I thought your setup was like that:

First clock path to your PHY:
--------------------

PLL4P ---> MCO2 ---> X1 (PHY input clock which replaces crystal)
It is not directly linked to the dwmac-stm32. You "just" provide a clock to MCO2. After that you can use MCO2 pins for any usages.

Second clock patch:
--------------------

Quoted 6 lines
Quoted 4 lines

50MHz (refclk coming from phy) --> ETH_REF_CLK pad This one is already covered in dwmac-stm32.

Why do you want to link the both clock paths ?

Because the X1 (MCO2 output) is the same net as 50 MHz ETH_REF_CLK input. MCO2 output is routed on a SoC pin and that is connected with a wire to ETH_REF_CLK SoC pin (input).

Ok I see, but I don't think you have to link both clocks.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

If I don't, then MCO2 will not have any consumer and would be turned off by the kernel.

I agree, but IMO the MCO clock should be declared with CLK_IGNORE_UNUSED flag in stm32mp1 clock driver.

Why? It can be safely turned off if it is only used to supply ETHRX. And if the clock tree is correctly modeled, that is what happens.

You're right. I think we could only add an optional clock inside dwmac stm32 glue to take this phy clock (here MCO2)

But you already do have clock in the glue, it's the ETHRX clock. There are no additional clock that have to be added to the glue.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#17 lore raw

Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock

Quoted 61 lines · Marek Vasut
Quoted 60 lines · Alexandre TORGUE
Quoted 57 lines · Marek Vasut
Quoted 56 lines · Alexandre TORGUE
Quoted 52 lines · Marek Vasut
Quoted 41 lines · Alexandre TORGUE
Quoted 38 lines · Marek Vasut

On 1/26/21 11:54 AM, Alexandre TORGUE wrote:
[...]

Quoted 36 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines

The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not
permit selecting the clock input from SoC pad. To make things worse, the
implementation of this is partly present and is split between the clock
driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we can handle all possible cases for RMII. At the glue layer (dwmac-stm32.c) clocks gates and syscfg are set regarding device tree binding (see the tab in dwmac-stm32.c). You could have a look here for more details: https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you want to select this path. Our current "clock tree" is done to fit with our ST reference boards (we have more peripherals than PLL outputs so we have to make choices). So yes for customer/partners boards this clock tree has to be modified to better fit with the need (either using assigned-clock-parent or by modifying bootloader clock tree (tf-a or u-boot)).

I don't think you handle all the configuration options, but I might also be confused.

See Figure 83. Peripheral clock distribution for Ethernet in the MP1 datasheet for the below.

The current setup I have needs 50 MHz on SoC pad PA1 to drive the PHY clock, and uses eth_clk_fb to supply ETH_RX_CLK. However, the 50 MHz is sourced directly from PLL4P, which then has to run at 50 MHz and that in turn reduces clock frequency for other blocks connected to PLL4P (e.g. SDMMC, where the impact is noticable).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ok that's the common path to clock a PHY a 50MHz without using the ref_clk coming from the PHY. And yes I can understand that the drawback is huge).

So lets fix it.

There is no issue in code. It is just clock tree configuration issue. Either you don't use PLL4P for Ethernet (what you're doing) or you don't use PLL4P for SDMMC. But yes, there are not a lot of possibilities.

I am supplying MCO2 with PLL4P, that is PLL4P->MCO2->ETHRX . To enable this entire chain of clock, I need the correct clock tree. Currently that cannot be modeled, can it?

Maybe I miss something, I thought your setup was like that:

First clock path to your PHY:
--------------------

PLL4P ---> MCO2 ---> X1 (PHY input clock which replaces crystal)
It is not directly linked to the dwmac-stm32. You "just" provide a clock to MCO2. After that you can use MCO2 pins for any usages.

Second clock patch:
--------------------

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

50MHz (refclk coming from phy) --> ETH_REF_CLK pad This one is already covered in dwmac-stm32.

Why do you want to link the both clock paths ?

Because the X1 (MCO2 output) is the same net as 50 MHz ETH_REF_CLK input. MCO2 output is routed on a SoC pin and that is connected with a wire to ETH_REF_CLK SoC pin (input).

Ok I see, but I don't think you have to link both clocks.

If I don't, then MCO2 will not have any consumer and would be turned off by the kernel.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I agree, but IMO the MCO clock should be declared with CLK_IGNORE_UNUSED flag in stm32mp1 clock driver.

Why? It can be safely turned off if it is only used to supply ETHRX. And if the clock tree is correctly modeled, that is what happens.

You're right. I think we could only add an optional clock inside dwmac stm32 glue to take this phy clock (here MCO2)

But you already do have clock in the glue, it's the ETHRX clock. There are no additional clock that have to be added to the glue.

Yes this one is for ETHRX/REFCLK, but the one I talk about is the one to clock the PHY (which replaces the crystal). In your case it is the same net but it is not always the case.

cheers
alex

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#18 lore raw

RFC PATCH 4/4 ARM: dts: stm32: Switch DWMAC RMII clock to MCO2 on DHCOM

In reply to Marek Vasut

Using the MCO2 output for the LAN8710i PHY clock and feedback clock into the DWMAC reduces EMI, switch to MCO2.

Cc Alexandre Torgue <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>

To: [email protected]

---
 arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +9 -3
index dc70ddd09e9d..ff70bd03a017 100644
@@ -110,15 +110,21 @@ &dts {
 	status = "okay";
 };
 
+&clk_eth_rx {
+	clocks = <&rcc CK_MCO2>;
+	assigned-clocks = <&rcc CK_MCO2>;
+	assigned-clock-parents = <&rcc PLL4_P>;
+	assigned-clock-rates = <50000000>;
+};
+
 &ethernet0 {
 	status = "okay";
-	pinctrl-0 = <&ethernet0_rmii_pins_a>;
-	pinctrl-1 = <&ethernet0_rmii_sleep_pins_a>;
+	pinctrl-0 = <&ethernet0_rmii_pins_b &mco2_pins_a>;
+	pinctrl-1 = <&ethernet0_rmii_sleep_pins_b &mco2_sleep_pins_a>;
 	pinctrl-names = "default", "sleep";
 	phy-mode = "rmii";
 	max-speed = <100>;
 	phy-handle = <&phy0>;
-	st,eth-ref-clk-sel;
 	phy-reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
 
 	mdio0 {
Signature · 7 lines
2.29.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel