Skip to contentSkip to conversation

rockchip: enabled LAN port on NanoPi R2S

PATCH In review Tianling Shen 3 participants 4 messages Apr 5, 2021 – Apr 6, 2021

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

PATCH v2 1/1 rockchip: enabled LAN port on NanoPi R2S

From: David Bauer <[email protected]>

Enable the USB3 port on the FriendlyARM NanoPi R2S. This is required for the USB3 attached LAN port to work.

[added device node for USB Ethernet controller]
---
 .../boot/dts/rockchip/rk3328-nanopi-r2s.dts   | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +32 -0
index faf496d789cf..18936b393d9d 100644
@@ -13,6 +13,10 @@
 	model = "FriendlyElec NanoPi R2S";
 	compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328";
 
+	aliases {
+		ethernet1 = &r8153;
+	};
+
 	chosen {
 		stdout-path = "serial2:1500000n8";
 	};
@@ -37,6 +41,16 @@
 		};
 	};
 
+	vcc_rtl8153: vcc-rtl8153-regulator {
+		compatible = "regulator-fixed";
+		gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&rtl8153_en_drv>;
+		regulator-always-on;
+		regulator-name = "vcc_rtl8153";
+		enable-active-high;
+	};
+
 	leds {
 		compatible = "gpio-leds";
 		pinctrl-0 = <&lan_led_pin>,  <&sys_led_pin>, <&wan_led_pin>;
@@ -265,6 +279,12 @@
 			};
 		};
 	};
+
+	usb {
+		rtl8153_en_drv: rtl8153-en-drv {
+			rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
 };
 
 &io_domains {
@@ -364,6 +384,18 @@
 	dr_mode = "host";
 };
 
+&usbdrd3 {
+	dr_mode = "host";
+	status = "okay";
+
+	r8153: usb-eth@2 {
+		compatible = "realtek,rtl8153";
+		reg = <2>;
+
+		local-mac-address = [ 00 00 00 00 00 00 ]; /* Filled in by U-Boot */
+	};
+};
+
 &usb_host0_ehci {
 	status = "okay";
 };
Signature · 1 line
2.17.1
#1 lore raw

Hi Tianling,

Quoted 28 lines · Tianling Shen

From: David Bauer <[email protected]>

Enable the USB3 port on the FriendlyARM NanoPi R2S. This is required for the USB3 attached LAN port to work.

[added device node for USB Ethernet controller]
---
 .../boot/dts/rockchip/rk3328-nanopi-r2s.dts   | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +4 -0
index faf496d789cf..18936b393d9d 100644
@@ -13,6 +13,10 @@
 	model = "FriendlyElec NanoPi R2S";
 	compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328";
 
+	aliases {
+		ethernet1 = &r8153;
+	};
+
 	chosen {
 		stdout-path = "serial2:1500000n8";
 	};

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 45

Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
@@ -37,6 +41,16 @@
 		};
 	};
 
 
+	vcc_rtl8153: vcc-rtl8153-regulator {

sort nodename

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 50

Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +6 -0
+		compatible = "regulator-fixed";
+		gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&rtl8153_en_drv>;
+		regulator-always-on;
 
+		regulator-name = "vcc_rtl8153";

exception to the sort rule
sort regulator-name above all other regulator properties

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 51

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
+		enable-active-high;

sort

----
Heiko's sort rules:

compatible
reg
interrupts
[alphabetical]
status [if needed]

----

Quoted 19 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +2 -0
+	};
+
 	leds {
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +6 -0
 		compatible = "gpio-leds";
 		pinctrl-0 = <&lan_led_pin>,  <&sys_led_pin>, <&wan_led_pin>;
@@ -265,6 +279,12 @@
 			};
 		};
 	};
+
+	usb {
+		rtl8153_en_drv: rtl8153-en-drv {
+			rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
 };
 
 &io_domains {

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 392

Quoted 9 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +5 -0
@@ -364,6 +384,18 @@
 	dr_mode = "host";
 };
 
+&usbdrd3 {
+	dr_mode = "host";
+	status = "okay";
+
 
+	r8153: usb-eth@2 {

With YAML undocumented additional properties and nodes generate notifications.
We need a change in the documents below for that. rockchip,dwc3.yaml > usb-drd.yaml > usb.yaml

Is there a standard for the usb-eth nodename?

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 392

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
+		compatible = "realtek,rtl8153";

Since a while Rob has improved has scripts. There's no escape anymore.
Add a YAML document to this serie for "realtek,rtl8153".

Improve checking for undocumented compatible strings
https://github.com/devicetree-org/dt-schema/commit/93e7ada8d53af099074cb5d53f7caa12835784e0

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 393

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
+		reg = <2>;

Why 2 ?

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 395

Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +2 -0
+
 
+		local-mac-address = [ 00 00 00 00 00 00 ]; /* Filled in by U-Boot */

This is a private property.
In a generic dts that's up to the user.

Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +3 -0
+	};
+};
+
 &usb_host0_ehci {

status = "okay";
};

#2 lore raw
Quoted 93 lines · Johan Jonker

Hi Tianling,

Quoted 28 lines · Tianling Shen

From: David Bauer <[email protected]>

Enable the USB3 port on the FriendlyARM NanoPi R2S. This is required for the USB3 attached LAN port to work.

[added device node for USB Ethernet controller]
---
 .../boot/dts/rockchip/rk3328-nanopi-r2s.dts   | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +4 -0
index faf496d789cf..18936b393d9d 100644
@@ -13,6 +13,10 @@
      model = "FriendlyElec NanoPi R2S";
      compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328";
 
+     aliases {
+             ethernet1 = &r8153;
+     };
+
      chosen {
              stdout-path = "serial2:1500000n8";
      };

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 45

Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
@@ -37,6 +41,16 @@
              };
      };
 
 
+     vcc_rtl8153: vcc-rtl8153-regulator {

sort nodename

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 50

Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +6 -0
+             compatible = "regulator-fixed";
+             gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
+             pinctrl-names = "default";
+             pinctrl-0 = <&rtl8153_en_drv>;
+             regulator-always-on;
 
+             regulator-name = "vcc_rtl8153";

exception to the sort rule
sort regulator-name above all other regulator properties

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 51

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
+             enable-active-high;

sort

----
Heiko's sort rules:

compatible
reg
interrupts
[alphabetical]
status [if needed]

----

Quoted 26 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +2 -0
+     };
+
      leds {
              compatible = "gpio-leds";
              pinctrl-0 = <&lan_led_pin>,  <&sys_led_pin>, <&wan_led_pin>;
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +10 -0
@@ -265,6 +279,12 @@
                      };
              };
      };
+
+     usb {
+             rtl8153_en_drv: rtl8153-en-drv {
+                     rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+             };
+     };
 };
 
 &io_domains {
@@ -364,6 +384,18 @@
      dr_mode = "host";
 };
 
+&usbdrd3 {
+     dr_mode = "host";
+     status = "okay";
+
Quoted 8 lines

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 391

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
+     r8153: usb-eth@2 {

With YAML undocumented additional properties and nodes generate notifications.
We need a change in the documents below for that. rockchip,dwc3.yaml > usb-drd.yaml > usb.yaml

Is there a standard for the usb-eth nodename?

The USB devices binding seems to specify "device" and then "interface" sub-nodes.

Quoted 5 lines

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 392

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
+             compatible = "realtek,rtl8153";

Since a while Rob has improved has scripts. There's no escape anymore.
Add a YAML document to this serie for "realtek,rtl8153".

Actually it should be "usbbda,8153", which conforms to

Documentation/devicetree/bindings/usb/usb-device.yaml

Giving "realtek,rtl8153" to the kernel will not help it match any device.

ChenYu

Quoted 22 lines

Improve checking for undocumented compatible strings
https://github.com/devicetree-org/dt-schema/commit/93e7ada8d53af099074cb5d53f7caa12835784e0

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 393

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
+             reg = <2>;

Why 2 ?

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 395

Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +2 -0
+
 
+             local-mac-address = [ 00 00 00 00 00 00 ]; /* Filled in by U-Boot */

This is a private property.
In a generic dts that's up to the user.

Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +3 -0
+     };
+};
+
 &usb_host0_ehci {
      status = "okay";

};

#3 lore raw
In reply to Johan Jonker

Hi Johan,

Quoted 58 lines · Johan Jonker

Hi Tianling,

Quoted 28 lines · Tianling Shen

From: David Bauer <[email protected]>

Enable the USB3 port on the FriendlyARM NanoPi R2S. This is required for the USB3 attached LAN port to work.

[added device node for USB Ethernet controller]
---
 .../boot/dts/rockchip/rk3328-nanopi-r2s.dts   | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +4 -0
index faf496d789cf..18936b393d9d 100644
@@ -13,6 +13,10 @@
      model = "FriendlyElec NanoPi R2S";
      compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328";
 
+     aliases {
+             ethernet1 = &r8153;
+     };
+
      chosen {
              stdout-path = "serial2:1500000n8";
      };

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 45

Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
@@ -37,6 +41,16 @@
              };
      };
 
 
+     vcc_rtl8153: vcc-rtl8153-regulator {

sort nodename

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 50

Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +6 -0
+             compatible = "regulator-fixed";
+             gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
+             pinctrl-names = "default";
+             pinctrl-0 = <&rtl8153_en_drv>;
+             regulator-always-on;
 
+             regulator-name = "vcc_rtl8153";

exception to the sort rule
sort regulator-name above all other regulator properties

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 51

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
+             enable-active-high;

sort

----
Heiko's sort rules:

Quoted 7 lines

compatible
reg
interrupts
[alphabetical]
status [if needed]

----

Thank you very much, and I will update it in v3.

Quoted 35 lines
Quoted 20 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +2 -0
+     };
+
      leds {
              compatible = "gpio-leds";
              pinctrl-0 = <&lan_led_pin>,  <&sys_led_pin>, <&wan_led_pin>;
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +6 -0
@@ -265,6 +279,12 @@
                      };
              };
      };
+
+     usb {
+             rtl8153_en_drv: rtl8153-en-drv {
+                     rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+             };
+     };
 };
 
 &io_domains {

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 392

Quoted 9 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +5 -0
@@ -364,6 +384,18 @@
      dr_mode = "host";
 };
 
+&usbdrd3 {
+     dr_mode = "host";
+     status = "okay";
+
 
+     r8153: usb-eth@2 {

With YAML undocumented additional properties and nodes generate notifications.
We need a change in the documents below for that. rockchip,dwc3.yaml > usb-drd.yaml > usb.yaml

Quoted 7 lines

Is there a standard for the usb-eth nodename?

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 392

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
+             compatible = "realtek,rtl8153";

Since a while Rob has improved has scripts. There's no escape anymore.
Add a YAML document to this serie for "realtek,rtl8153".

This is actually added by another patch[1], but doesn't go to upstream yet. I'll ask David if he would like to submit it.

Kindly ping David.

1:
https://github.com/openwrt/openwrt/blob/master/target/linux/rockchip/patches-5.10/002-net-usb-r8152-add-LED-configuration-from-OF.patch
https://github.com/openwrt/openwrt/blob/master/target/linux/rockchip/patches-5.10/003-dt-bindings-net-add-RTL8152-binding-documentation.patch

Quoted 8 lines

Improve checking for undocumented compatible strings
https://github.com/devicetree-org/dt-schema/commit/93e7ada8d53af099074cb5d53f7caa12835784e0

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 393

Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +1 -0
+             reg = <2>;

Why 2 ?

This is the device number on the USB bus.

Quoted 6 lines

arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts line 395

Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +2 -0
+
 
+             local-mac-address = [ 00 00 00 00 00 00 ]; /* Filled in by U-Boot */

This is a private property.
In a generic dts that's up to the user.

Okay I will drop this.

Thanks,
Tianling.

Quoted 9 lines
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +3 -0
+     };
+};
+
 &usb_host0_ehci {
      status = "okay";

};