Skip to contentSkip to conversation

arm64: dts: allwinner: define USB3 Ethernet on NanoPi R1S H5

PATCH In review Chukun Pan 3 participants 6 messages May 2, 2022 – May 9, 2022

Subsystems (2)
lore
Share & tools
lore

Chukun Pan

author
#0 lore raw

PATCH 1/1 arm64: dts: allwinner: define USB3 Ethernet on NanoPi R1S H5

The NanoPi R1S H5 has a Realtek RTL8153B USB 3.0 Ethernet chip connected to the USB 2.0 port of the Allwinner H5 SoC.

---
 arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +7 -1
index 55b369534a08..dd655a491549 100644
@@ -21,7 +21,8 @@ / {
 
 	aliases {
 		ethernet0 = &emac;
-		ethernet1 = &rtl8189etv;
+		ethernet1 = &rtl8153;
+		ethernet2 = &rtl8189etv;
 		serial0 = &uart0;
 	};
 
@@ -116,6 +117,11 @@ &cpu0 {
 
 &ehci1 {
 	status = "okay";
+
+	rtl8153: device@1 {
+		compatible = "usbbda,8153";
+		reg = <1>;
+	};
 };
 
 &ehci2 {
Signature · 7 lines
2.25.1


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

Dne ponedeljek, 02. maj 2022 ob 16:40:09 CEST je Chukun Pan napisal(a):

Review

Quoted 9 lines

The NanoPi R1S H5 has a Realtek RTL8153B USB 3.0 Ethernet chip connected to the USB 2.0 port of the Allwinner H5 SoC.

---
 arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
(quoted diff) renamed from arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +0 -0

arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts

Quoted 14 lines

index 55b369534a08..dd655a491549 100644

arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +2 -1
@@ -21,7 +21,8 @@ / {
 
 	aliases {
 		ethernet0 = &emac;
-		ethernet1 = &rtl8189etv;
+		ethernet1 = &rtl8153;
+		ethernet2 = &rtl8189etv;
 		serial0 = &uart0;
 	};
 

arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts &cpu0 { · line 119

Quoted 3 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +0 -0
@@ -116,6 +117,11 @@ &cpu0 {
 
 &ehci1 {
 	status = "okay";

You need to add #address-cells and #size-cells properties, otherwise "make dtbs_check W=1" generates warnings.

Best regards,
Jernej

Quoted 12 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +5 -0
+
+	rtl8153: device@1 {
+		compatible = "usbbda,8153";
+		reg = <1>;
+	};
 };
 
 &ehci2 {
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Dne torek, 03. maj 2022 ob 19:54:34 CEST je Jernej Škrabec napisal(a):

Quoted 16 lines

Dne ponedeljek, 02. maj 2022 ob 16:40:09 CEST je Chukun Pan napisal(a):

Review

Quoted 9 lines

The NanoPi R1S H5 has a Realtek RTL8153B USB 3.0 Ethernet chip connected to the USB 2.0 port of the Allwinner H5 SoC.

---
 arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
(quoted diff) renamed from arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +0 -0

arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts

Quoted 5 lines

index 55b369534a08..dd655a491549 100644

arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +0 -0
@@ -21,7 +21,8 @@ / {
 
Quoted 5 lines

arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts / { · line 25

Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +2 -1
 	aliases {
 		ethernet0 = &emac;
-		ethernet1 = &rtl8189etv;
+		ethernet1 = &rtl8153;
+		ethernet2 = &rtl8189etv;

Additionally, it's not a good idea to change order of ethernet nodes. It can affect mac address assigning procedure in bootloader.

Best regards,
Jernej

Quoted 29 lines

arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts &cpu0 { · line 119

Quoted 7 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +0 -0
 		serial0 = &uart0;
 	};
 
@@ -116,6 +117,11 @@ &cpu0 {
 
 &ehci1 {
 	status = "okay";

You need to add #address-cells and #size-cells properties, otherwise "make dtbs_check W=1" generates warnings.

Best regards,
Jernej

Quoted 12 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +5 -0
+
+	rtl8153: device@1 {
+		compatible = "usbbda,8153";
+		reg = <1>;
+	};
 };
 
 &ehci2 {
Signature · 1 line
2.25.1
author
#3 lore raw
In reply to Jernej Škrabec
Quoted 4 lines
Quoted 4 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +0 -0
@@ -21,7 +21,8 @@ / {
 
Quoted 8 lines

arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts / { · line 25

Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +2 -1
 	aliases {
 		ethernet0 = &emac;
-		ethernet1 = &rtl8189etv;
+		ethernet1 = &rtl8153;
+		ethernet2 = &rtl8189etv;

Additionally, it's not a good idea to change order of ethernet nodes. It can affect mac address assigning procedure in bootloader.

There is no eth1addr in uboot, so this doesn't affect the mac address. The network order in the kernel is eth0(emac) / eth1(rtl8153) / wlan0, so I think it would be better to change it this way.

Thanks,
Chukun

#4 lore raw

On Sun, 8 May 2022 23:25:05 +0800
Chukun Pan <[email protected]> wrote:

Hi,

Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +0 -0
@@ -21,7 +21,8 @@ / {
 
Quoted 8 lines

arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts / { · line 25

Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts +2 -1
 	aliases {
 		ethernet0 = &emac;
-		ethernet1 = &rtl8189etv;
+		ethernet1 = &rtl8153;
+		ethernet2 = &rtl8189etv;  

Additionally, it's not a good idea to change order of ethernet nodes. It can affect mac address assigning procedure in bootloader.

Quoted 1 line

There is no eth1addr in uboot, so this doesn't affect the mac address.

Really? I don't have a board at hand to double check, but the code I read here says otherwise:
https://source.denx.de/u-boot/u-boot/-/blob/master/board/sunxi/board.c#L791-813
There it checks for up to four ethernet aliases and assigns MAC addresses to them, using the index in the lowest byte.
So this would change the MAC address of the WiFi adapter.

Am I missing something?

Quoted 1 line

The network order in the kernel is eth0(emac) / eth1(rtl8153) / wlan0,

Regardless of the fact that you shouldn't rely on indexes in device names, wouldn't that be that same, regardless of the order of USB and WiFi?

Cheers,
Andre

Quoted 6 lines

so I think it would be better to change it this way.

Thanks,
Chukun

author
#5 lore raw
In reply to Chukun Pan
Quoted 7 lines

Really? I don't have a board at hand to double check, but the code I read here says otherwise:
https://source.denx.de/u-boot/u-boot/-/blob/master/board/sunxi/board.c#L791-813
There it checks for up to four ethernet aliases and assigns MAC addresses to them, using the index in the lowest byte.
So this would change the MAC address of the WiFi adapter.
Am I missing something?

I'm very sorry for this, the rtl8189etv driver assigns the correct mac address to wlan0, so I didn't observe the mac address change. Sorry for my misunderstanding.

Thanks,
Chukun