Skip to contentSkip to conversation

ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM

PATCH In review Marek Vasut 3 participants 9 messages Apr 8, 2021 – Jun 28, 2021

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

PATCH 1/1 ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM

The Microchip LAN8710Ai PHY requires XTAL1/CLKIN external clock to be enabled when the nRST is toggled according to datasheet Microchip LAN8710A/LAN8710Ai DS00002164B page 35 section 3.8.5.1 Hardware Reset:
"
A Hardware reset is asserted by driving the nRST input pin low. When driven, nRST should be held low for the minimum time detailed in Section 5.5.3, "Power-On nRST & Configuration Strap Timing," on page 59 to ensure a proper transceiver reset. During a Hardware reset, an external clock must be supplied to the XTAL1/CLKIN signal.
"
This is accidentally fulfilled in the current setup, where ETHCK_K is used to supply both PHY XTAL1/CLKIN and is also fed back through eth_clk_fb to supply ETHRX clock of the DWMAC. Hence, the DWMAC enables ETHRX clock, that has ETHCK_K as parent, so ETHCK_K clock are also enabled, and then the PHY reset toggles.

However, this is not always the case, e.g. in case the PHY XTAL1/CLKIN clock are supplied by some other clock source than ETHCK_K or in case ETHRX clock are not supplied by ETHCK_K. In the later case, ETHCK_K would be kept disabled, while ETHRX clock would be enabled, so the PHY would not be receiving XTAL1/CLKIN clock and the reset would fail.

Improve the DT by adding the PHY clock phandle into the PHY node, which then also requires moving the PHY reset GPIO specifier in the same place and that then also requires correct PHY reset GPIO timing, so add that too.

A brief note regarding the timing, the datasheet says the reset should stay asserted for at least 100uS and software should wait at least 200nS after deassertion. Set both delays to 500uS which should be plenty.

Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")
Cc Alexandre Torgue <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>

To: [email protected]

---
 arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +7 -1
index 272a1a67a9ad..31d08423a32f 100644
@@ -123,7 +123,6 @@ &ethernet0 {
 	max-speed = <100>;
 	phy-handle = <&phy0>;
 	st,eth-ref-clk-sel;
-	phy-reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
 
 	mdio0 {
 		#address-cells = <1>;
@@ -132,6 +131,13 @@ mdio0 {
 
 		phy0: ethernet-phy@1 {
 			reg = <1>;
+			/* LAN8710Ai */
+			compatible = "ethernet-phy-id0007.c0f0",
+				     "ethernet-phy-ieee802.3-c22";
+			clocks = <&rcc ETHCK_K>;
+			reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
+			reset-assert-us = <500>;
+			reset-deassert-us = <500>;
 			interrupt-parent = <&gpioi>;
 			interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
 		};
Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#1 lore raw
Quoted 59 lines · Marek Vasut

The Microchip LAN8710Ai PHY requires XTAL1/CLKIN external clock to be enabled when the nRST is toggled according to datasheet Microchip LAN8710A/LAN8710Ai DS00002164B page 35 section 3.8.5.1 Hardware Reset:
"
A Hardware reset is asserted by driving the nRST input pin low. When driven, nRST should be held low for the minimum time detailed in Section 5.5.3, "Power-On nRST & Configuration Strap Timing," on page 59 to ensure a proper transceiver reset. During a Hardware reset, an external clock must be supplied to the XTAL1/CLKIN signal. "
This is accidentally fulfilled in the current setup, where ETHCK_K is used to supply both PHY XTAL1/CLKIN and is also fed back through eth_clk_fb to supply ETHRX clock of the DWMAC. Hence, the DWMAC enables ETHRX clock, that has ETHCK_K as parent, so ETHCK_K clock are also enabled, and then the PHY reset toggles.

However, this is not always the case, e.g. in case the PHY XTAL1/CLKIN clock are supplied by some other clock source than ETHCK_K or in case ETHRX clock are not supplied by ETHCK_K. In the later case, ETHCK_K would be kept disabled, while ETHRX clock would be enabled, so the PHY would not be receiving XTAL1/CLKIN clock and the reset would fail.

Improve the DT by adding the PHY clock phandle into the PHY node, which then also requires moving the PHY reset GPIO specifier in the same place and that then also requires correct PHY reset GPIO timing, so add that too.

A brief note regarding the timing, the datasheet says the reset should stay asserted for at least 100uS and software should wait at least 200nS after deassertion. Set both delays to 500uS which should be plenty.

Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")
Cc Alexandre Torgue <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Patrick Delaunay <[email protected]>

To: [email protected]

---
  arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +0 -1
index 272a1a67a9ad..31d08423a32f 100644
@@ -123,7 +123,6 @@ &ethernet0 {
  	max-speed = <100>;
  	phy-handle = <&phy0>;
  	st,eth-ref-clk-sel;
-	phy-reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
 
  	mdio0 {
  		#address-cells = <1>;
@@ -132,6 +131,13 @@ mdio0 {
 
  		phy0: ethernet-phy@1 {
  			reg = <1>;

arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi mdio0 { · line 143

Quoted 10 lines
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +7 -0
+			/* LAN8710Ai */
+			compatible = "ethernet-phy-id0007.c0f0",
+				     "ethernet-phy-ieee802.3-c22";
+			clocks = <&rcc ETHCK_K>;
+			reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
+			reset-assert-us = <500>;
+			reset-deassert-us = <500>;
  			interrupt-parent = <&gpioi>;
  			interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
  		};

Applied on stm32-next.

Thanks.
Alex

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

#2 lore raw
In reply to Marek Vasut
Quoted 3 lines · Marek Vasut

The Microchip LAN8710Ai PHY requires XTAL1/CLKIN external clock to be enabled when the nRST is toggled according to datasheet Microchip LAN8710A/LAN8710Ai DS00002164B page 35 section 3.8.5.1 Hardware Reset:

[...]

Quoted 1 line
Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")

Adding stable to CC.

Patch is now part of Linux 5.13 as commit

1cebcf9932ab ("ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM")

It would be nice to pick it into stable, since it fixes ethernet stability issues on the device.

maintainer
#3 lore raw
Quoted 7 lines · Marek Vasut
Quoted 3 lines · Marek Vasut

The Microchip LAN8710Ai PHY requires XTAL1/CLKIN external clock to be enabled when the nRST is toggled according to datasheet Microchip LAN8710A/LAN8710Ai DS00002164B page 35 section 3.8.5.1 Hardware Reset:

[...]

Quoted 7 lines
Quoted 1 line
Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")

Adding stable to CC.

Patch is now part of Linux 5.13 as commit

1cebcf9932ab ("ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM")

$ git show 1cebcf9932ab
fatal: ambiguous argument '1cebcf9932ab': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Are you sure?

#4 lore raw
Quoted 14 lines · Greg KH
Quoted 13 lines · Marek Vasut
Quoted 3 lines · Marek Vasut

The Microchip LAN8710Ai PHY requires XTAL1/CLKIN external clock to be enabled when the nRST is toggled according to datasheet Microchip LAN8710A/LAN8710Ai DS00002164B page 35 section 3.8.5.1 Hardware Reset:

[...]

Quoted 1 line
Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")

Adding stable to CC.

Patch is now part of Linux 5.13 as commit

Quoted 8 lines
Quoted 1 line

1cebcf9932ab ("ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM")

$ git show 1cebcf9932ab
fatal: ambiguous argument '1cebcf9932ab': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Are you sure?

This would seem to indicate so:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1cebcf9932ab76102e8cfc555879574693ba8956

linux-2.6$ git describe 1cebcf9932ab76102e8cfc555879574693ba8956 v5.13-rc1-1-g1cebcf9932ab

Did the commit get abbreviated too much ?

maintainer
#5 lore raw
Quoted 24 lines · Marek Vasut
Quoted 14 lines · Greg KH
Quoted 13 lines · Marek Vasut
Quoted 3 lines · Marek Vasut

The Microchip LAN8710Ai PHY requires XTAL1/CLKIN external clock to be enabled when the nRST is toggled according to datasheet Microchip LAN8710A/LAN8710Ai DS00002164B page 35 section 3.8.5.1 Hardware Reset:

[...]

Quoted 1 line
Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")

Adding stable to CC.

Patch is now part of Linux 5.13 as commit

Quoted 8 lines
Quoted 1 line

1cebcf9932ab ("ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM")

$ git show 1cebcf9932ab
fatal: ambiguous argument '1cebcf9932ab': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Are you sure?

Quoted 8 lines

This would seem to indicate so:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1cebcf9932ab76102e8cfc555879574693ba8956

linux-2.6$ git describe 1cebcf9932ab76102e8cfc555879574693ba8956 v5.13-rc1-1-g1cebcf9932ab

Did the commit get abbreviated too much ?

Something is really odd, as that commit _is_ in linux-next, but it is not in my local copy of Linus's tree.

So how it is showing up in that link above is beyond me. Can you see it locally on your machine?

thanks,

greg k-h

#6 lore raw
Quoted 32 lines · Greg KH
Quoted 31 lines · Marek Vasut
Quoted 14 lines · Greg KH
Quoted 13 lines · Marek Vasut
Quoted 3 lines · Marek Vasut

The Microchip LAN8710Ai PHY requires XTAL1/CLKIN external clock to be enabled when the nRST is toggled according to datasheet Microchip LAN8710A/LAN8710Ai DS00002164B page 35 section 3.8.5.1 Hardware Reset:

[...]

Quoted 1 line
Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")

Adding stable to CC.

Patch is now part of Linux 5.13 as commit

Quoted 8 lines
Quoted 1 line

1cebcf9932ab ("ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM")

$ git show 1cebcf9932ab
fatal: ambiguous argument '1cebcf9932ab': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Are you sure?

This would seem to indicate so:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1cebcf9932ab76102e8cfc555879574693ba8956

linux-2.6$ git describe 1cebcf9932ab76102e8cfc555879574693ba8956 v5.13-rc1-1-g1cebcf9932ab

Quoted 7 lines
Quoted 1 line

Did the commit get abbreviated too much ?

Something is really odd, as that commit _is_ in linux-next, but it is not in my local copy of Linus's tree.

So how it is showing up in that link above is beyond me. Can you see it locally on your machine?

Yes, that's where the git describe came from. And I used a different repo than the one from which I submitted the patch originally, so the commit must've come from fetching origin (i.e. linus tree).

Could it be this "ambiguous argument '1cebcf9932ab'" , which would indicate the commit hash got abbreviated too much ?

maintainer
#7 lore raw
Quoted 41 lines · Marek Vasut
Quoted 32 lines · Greg KH
Quoted 31 lines · Marek Vasut
Quoted 14 lines · Greg KH
Quoted 13 lines · Marek Vasut
Quoted 3 lines · Marek Vasut

The Microchip LAN8710Ai PHY requires XTAL1/CLKIN external clock to be enabled when the nRST is toggled according to datasheet Microchip LAN8710A/LAN8710Ai DS00002164B page 35 section 3.8.5.1 Hardware Reset:

[...]

Quoted 1 line
Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")

Adding stable to CC.

Patch is now part of Linux 5.13 as commit

Quoted 8 lines
Quoted 1 line

1cebcf9932ab ("ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM")

$ git show 1cebcf9932ab
fatal: ambiguous argument '1cebcf9932ab': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Are you sure?

This would seem to indicate so:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1cebcf9932ab76102e8cfc555879574693ba8956

linux-2.6$ git describe 1cebcf9932ab76102e8cfc555879574693ba8956 v5.13-rc1-1-g1cebcf9932ab

Quoted 7 lines
Quoted 1 line

Did the commit get abbreviated too much ?

Something is really odd, as that commit _is_ in linux-next, but it is not in my local copy of Linus's tree.

So how it is showing up in that link above is beyond me. Can you see it locally on your machine?

Quoted 6 lines

Yes, that's where the git describe came from. And I used a different repo than the one from which I submitted the patch originally, so the commit must've come from fetching origin (i.e. linus tree).

Could it be this "ambiguous argument '1cebcf9932ab'" , which would indicate the commit hash got abbreviated too much ?

The web site "lies" it has a shared backend. Trust your local copy of the tree, that shows that this commit is NOT in Linus's tree just yet. Please let stable@vger know when it does hit Linus's tree and we will be glad to take it.

thanks,

greg k-h

#8 lore raw
Quoted 46 lines · Greg KH
Quoted 45 lines · Marek Vasut
Quoted 32 lines · Greg KH
Quoted 31 lines · Marek Vasut
Quoted 14 lines · Greg KH
Quoted 13 lines · Marek Vasut
Quoted 3 lines · Marek Vasut

The Microchip LAN8710Ai PHY requires XTAL1/CLKIN external clock to be enabled when the nRST is toggled according to datasheet Microchip LAN8710A/LAN8710Ai DS00002164B page 35 section 3.8.5.1 Hardware Reset:

[...]

Quoted 1 line
Fixes 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")

Adding stable to CC.

Patch is now part of Linux 5.13 as commit

Quoted 8 lines
Quoted 1 line

1cebcf9932ab ("ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM")

$ git show 1cebcf9932ab
fatal: ambiguous argument '1cebcf9932ab': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Are you sure?

This would seem to indicate so:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1cebcf9932ab76102e8cfc555879574693ba8956

linux-2.6$ git describe 1cebcf9932ab76102e8cfc555879574693ba8956 v5.13-rc1-1-g1cebcf9932ab

Quoted 7 lines
Quoted 1 line

Did the commit get abbreviated too much ?

Something is really odd, as that commit _is_ in linux-next, but it is not in my local copy of Linus's tree.

So how it is showing up in that link above is beyond me. Can you see it locally on your machine?

Yes, that's where the git describe came from. And I used a different repo than the one from which I submitted the patch originally, so the commit must've come from fetching origin (i.e. linus tree).

Quoted 7 lines
Quoted 2 lines

Could it be this "ambiguous argument '1cebcf9932ab'" , which would indicate the commit hash got abbreviated too much ?

The web site "lies" it has a shared backend. Trust your local copy of the tree, that shows that this commit is NOT in Linus's tree just yet. Please let stable@vger know when it does hit Linus's tree and we will be glad to take it.

Doh, of course, it is in next and not linus tree, now it makes sense.
I'll wait a bit until it is there and revisit this, unless it gets picked automatically by the Fixes tag.

Sorry for the noise.