Skip to contentSkip to conversation

Improve gmac0 DT config for NanoPi R5S

PATCH Applied Diederik de Haas 3 participants 7 messages Apr 1 – Apr 27

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

cover Improve gmac0 DT config for NanoPi R5S

These 2 patches contain a fix for an incorrect pinctlr definition and replaces several deprecated snps,reset* properties with their non-deprecated replacements.

Diederik de Haas (2):
arm64: dts: rockchip: Fix gmac0 reset pin for NanoPi R5S
arm64: dts: rockchip: Replace deprecated snps,* props for NanoPi R5S

 arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH 1/2 arm64: dts: rockchip: Fix gmac0 reset pin for NanoPi R5S

According to the NanoPi R5S 2204 schematic on page 6, GPIO0_C4 is for GMAC0_INT/PMEB_GPIO0_C4, while GPIO0_C5 is for GMAC0_RSTn_GPIO0_C5. While the 'reset-gpios' property was set correctly, the corresponding pinctrl didn't match that.

Next to fixing the pinctrl definition, also change the node name and phandle to match what is used in the schematic.

Fixes c6629b9a6738 ("arm64: dts: rockchip: Add FriendlyElec Nanopi R5S")
---
 arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts +3 -3
index 718d1a2da8e5..90ce6f0e1dcf 100644
@@ -98,7 +98,7 @@ &mdio0 {
 	rgmii_phy0: ethernet-phy@1 {
 		compatible = "ethernet-phy-ieee802.3-c22";
 		reg = <1>;
-		pinctrl-0 = <&eth_phy0_reset_pin>;
+		pinctrl-0 = <&gmac0_rstn_gpio0_c5_pin>;
 		pinctrl-names = "default";
 	};
 };
@@ -132,8 +132,8 @@ &pcie3x2 {
 
 &pinctrl {
 	gmac0 {
-		eth_phy0_reset_pin: eth-phy0-reset-pin {
-			rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_up>;
+		gmac0_rstn_gpio0_c5_pin: gmac0-rstn-gpio0-c5-pin {
+			rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
 		};
 	};
 
Signature · 1 line
2.53.0
#2 lore raw

PATCH 2/2 arm64: dts: rockchip: Replace deprecated snps,* props for NanoPi R5S

In reply to Diederik de Haas

The various snps,reset-* properties are deprecated, so convert them into their replacements.

---
 arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts +3 -4
index 90ce6f0e1dcf..92d044ec696b 100644
@@ -85,10 +85,6 @@ &gmac0_tx_bus2
 		     &gmac0_rx_bus2
 		     &gmac0_rgmii_clk
 		     &gmac0_rgmii_bus>;
-	snps,reset-gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_LOW>;
-	snps,reset-active-low;
-	/* Reset time is 15ms, 50ms for rtl8211f */
-	snps,reset-delays-us = <0 15000 50000>;
 	tx_delay = <0x3c>;
 	rx_delay = <0x2f>;
 	status = "okay";
@@ -100,6 +96,9 @@ rgmii_phy0: ethernet-phy@1 {
 		reg = <1>;
 		pinctrl-0 = <&gmac0_rstn_gpio0_c5_pin>;
 		pinctrl-names = "default";
+		reset-assert-us = <15000>;
+		reset-deassert-us = <50000>;
+		reset-gpios = <&gpio0 RK_PC5 GPIO_ACTIVE_LOW>;
 	};
 };
 
Signature · 1 line
2.53.0
#3 lore raw

Re: [PATCH 2/2] arm64: dts: rockchip: Replace deprecated snps,* props for NanoPi R5S

Quoted 24 lines · Diederik de Haas

The various snps,reset-* properties are deprecated, so convert them into their replacements.

---
 arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts +0 -4
index 90ce6f0e1dcf..92d044ec696b 100644
@@ -85,10 +85,6 @@ &gmac0_tx_bus2
 		     &gmac0_rx_bus2
 		     &gmac0_rgmii_clk
 		     &gmac0_rgmii_bus>;
-	snps,reset-gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_LOW>;
-	snps,reset-active-low;
-	/* Reset time is 15ms, 50ms for rtl8211f */
-	snps,reset-delays-us = <0 15000 50000>;
 	tx_delay = <0x3c>;
 	rx_delay = <0x2f>;
 	status = "okay";

arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts rgmii_phy0: ethernet-phy@1 { · line 104

Quoted 9 lines
arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts +3 -0
@@ -100,6 +96,9 @@ rgmii_phy0: ethernet-phy@1 {
 		reg = <1>;
 		pinctrl-0 = <&gmac0_rstn_gpio0_c5_pin>;
 		pinctrl-names = "default";
+		reset-assert-us = <15000>;
+		reset-deassert-us = <50000>;
+		reset-gpios = <&gpio0 RK_PC5 GPIO_ACTIVE_LOW>;
 	};
 };
 

Please disregard/drop this patch.

I was recently made aware of 'sashiko.dev' and checked whether it had also checked my patch, which it did:
https://sashiko.dev/#/patchset/20260401131551.734456-1-diederik%40cknow-tech.com

And it turns out that the concern raised is valid (thanks Quentin!), so this patch could introduce a regression.
So it looks like staying with the deprecated properties is actually better (in this case?).

Cheers,
Diederik

#4 lore raw

Re: [PATCH 2/2] arm64: dts: rockchip: Replace deprecated snps,* props for NanoPi R5S

Quoted 37 lines · Diederik de Haas
Quoted 24 lines · Diederik de Haas

The various snps,reset-* properties are deprecated, so convert them into their replacements.

---
  arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts +0 -4
index 90ce6f0e1dcf..92d044ec696b 100644
@@ -85,10 +85,6 @@ &gmac0_tx_bus2
  		     &gmac0_rx_bus2
  		     &gmac0_rgmii_clk
  		     &gmac0_rgmii_bus>;
-	snps,reset-gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_LOW>;
-	snps,reset-active-low;
-	/* Reset time is 15ms, 50ms for rtl8211f */
-	snps,reset-delays-us = <0 15000 50000>;
  	tx_delay = <0x3c>;
  	rx_delay = <0x2f>;
  	status = "okay";

arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts rgmii_phy0: ethernet-phy@1 { · line 104

Quoted 9 lines
arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts +3 -0
@@ -100,6 +96,9 @@ rgmii_phy0: ethernet-phy@1 {
  		reg = <1>;
  		pinctrl-0 = <&gmac0_rstn_gpio0_c5_pin>;
  		pinctrl-names = "default";
+		reset-assert-us = <15000>;
+		reset-deassert-us = <50000>;
+		reset-gpios = <&gpio0 RK_PC5 GPIO_ACTIVE_LOW>;
  	};
  };
 

Please disregard/drop this patch.

Quoted 8 lines

I was recently made aware of 'sashiko.dev' and checked whether it had also checked my patch, which it did:
https://sashiko.dev/#/patchset/20260401131551.734456-1-diederik%40cknow-tech.com

And it turns out that the concern raised is valid (thanks Quentin!), so this patch could introduce a regression.
So it looks like staying with the deprecated properties is actually better (in this case?).

Well actually we more or less rely on U-Boot to reset the PHY first now. Many rockchip boards in tree require a reset before the PHY can be recognized, but we just use the generic "ethernet-phy-ieee802.3-c22" compatible.

Another option is to move the reset props to mdio node instead of PHY node, though.

Thanks,
Tianling.

Quoted 3 lines

Cheers,
Diederik

#5 lore raw

Re: [PATCH 2/2] arm64: dts: rockchip: Replace deprecated snps,* props for NanoPi R5S

Quoted 42 lines · Tianling Shen
Quoted 41 lines · Diederik de Haas
Quoted 24 lines · Diederik de Haas

The various snps,reset-* properties are deprecated, so convert them into their replacements.

---
  arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts +0 -4
index 90ce6f0e1dcf..92d044ec696b 100644
@@ -85,10 +85,6 @@ &gmac0_tx_bus2
  		     &gmac0_rx_bus2
  		     &gmac0_rgmii_clk
  		     &gmac0_rgmii_bus>;
-	snps,reset-gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_LOW>;
-	snps,reset-active-low;
-	/* Reset time is 15ms, 50ms for rtl8211f */
-	snps,reset-delays-us = <0 15000 50000>;
  	tx_delay = <0x3c>;
  	rx_delay = <0x2f>;
  	status = "okay";

arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts rgmii_phy0: ethernet-phy@1 { · line 104

Quoted 9 lines
arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5s.dts +3 -0
@@ -100,6 +96,9 @@ rgmii_phy0: ethernet-phy@1 {
  		reg = <1>;
  		pinctrl-0 = <&gmac0_rstn_gpio0_c5_pin>;
  		pinctrl-names = "default";
+		reset-assert-us = <15000>;
+		reset-deassert-us = <50000>;
+		reset-gpios = <&gpio0 RK_PC5 GPIO_ACTIVE_LOW>;
  	};
  };
 

Please disregard/drop this patch.

I was recently made aware of 'sashiko.dev' and checked whether it had also checked my patch, which it did:
https://sashiko.dev/#/patchset/20260401131551.734456-1-diederik%40cknow-tech.com

Quoted 6 lines
Quoted 4 lines

And it turns out that the concern raised is valid (thanks Quentin!), so this patch could introduce a regression.
So it looks like staying with the deprecated properties is actually better (in this case?).

Well actually we more or less rely on U-Boot to reset the PHY first now.

This change would introduce such a dependency where it was not there before, so this could introduce a regression.

Quoted 3 lines

Many rockchip boards in tree require a reset before the PHY can be recognized, but we just use the generic "ethernet-phy-ieee802.3-c22" compatible.

I've identified ~40 Rockchip based boards where there is a dependency on the bootloader due to using that generic compatible. Some from the start and some got it added with a similar conversion as I proposed above. I haven't seen massive bug reports, so it looks like it's currently ok. I don't like having such a dependency and certainly not adding one where it previously was not the case.

In other cases, the generic compatible was replaced with a specific one for the PHY being used, which 'circumvents' the raised concern:
https://lore.kernel.org/linux-rockchip/[email protected]/

According to the FriendlyELEC schematics I checked, they seem to use the RTL8211F a LOT. On the NanoPi R6* they use a/the specific compatible:
https://elixir.bootlin.com/linux/v7.0/source/arch/arm64/boot/dts/rockchip/rk3588s-nanopi-r6.dtsi#L348

I've sent FriendlyELEC an email to ask whether they ONLY used that PHY in the R5S (LTS) in which case it is safe to replace the generic compatible with the specific one. I haven't received a response yet.

Quoted 2 lines

Another option is to move the reset props to mdio node instead of PHY node, though.

I prefer that there's first an agreed upon 'strategy' on how to deal with the above mentioned raised concern so that it can be implemented consistently.

Cheers,
Diederik

maintainer Applied
#6 lore raw

Re: (subset) [PATCH 0/2] Improve gmac0 DT config for NanoPi R5S

In reply to Diederik de Haas
Quoted 9 lines · Diederik de Haas

These 2 patches contain a fix for an incorrect pinctlr definition and replaces several deprecated snps,reset* properties with their non-deprecated replacements.

Diederik de Haas (2):
arm64: dts: rockchip: Fix gmac0 reset pin for NanoPi R5S
arm64: dts: rockchip: Replace deprecated snps,* props for NanoPi R5S

[...]

Applied, thanks!

[1/2] arm64: dts: rockchip: Fix gmac0 reset pin for NanoPi R5S

      commit: c83c4a09d4c01c91d6c52d6d4d77a06892a3e83b

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>