Skip to contentSkip to conversation

arm64: dts: rockchip: rk3328: Enable USB3 on some SBCs

PATCH Applied Chen-Yu Tsai 2 participants 6 messages May 4, 2021 – May 9, 2021

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

cover arm64: dts: rockchip: rk3328: Enable USB3 on some SBCs

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

Here are some patches that enable USB3 on RK3328 SBCs that I own. The changes are quite straightforward, except for the NanoPi R2S, which has a USB3 Ethernet chip attached. I am aware that there's already a patch [1] for that. This is my spin on things using the USB device binding, with comments on how the USB ports are arranged, that I had done but couldn't find the time to send out.

The last patch also results in some warnings from checkpatch.pl:

WARNING: DT compatible string "usbbda,8153" appears un-documented --
check ./Documentation/devicetree/bindings/
#88: FILE: arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts:398:
+ compatible = "usbbda,8153";

WARNING: DT compatible string vendor "usbbda" appears un-documented --
check ./Documentation/devicetree/bindings/vendor-prefixes.yaml
#88: FILE: arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts:398:
+ compatible = "usbbda,8153";

At least the first warning should be covered by the USB device binding

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

while we probably should add an exception to vendor-prefixes.yaml for the second warning.

Please let me know what you think.

Regards
ChenYu

[1] https://lore.kernel.org/linux-rockchip/[email protected]/

Cameron Nemo (1):
arm64: dts: rockchip: rk3328: Enable USB3 for Rock64

Chen-Yu Tsai (3):
arm64: dts: rockchip: rk3328: Enable USB3 for ROC-RK3328-CC
arm64: dts: rockchip: rk3328: Enable USB3 for Rock Pi E
arm64: dts: rockchip: rk3328: Enable USB3 Ethernet on NanoPi R2S

 .../boot/dts/rockchip/rk3328-nanopi-r2s.dts   | 32 +++++++++++++++++++
 .../arm64/boot/dts/rockchip/rk3328-roc-cc.dts |  5 +++
 .../boot/dts/rockchip/rk3328-rock-pi-e.dts    |  5 +++
 .../arm64/boot/dts/rockchip/rk3328-rock64.dts |  5 +++
 4 files changed, 47 insertions(+)
Signature · 7 lines
2.31.1


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

PATCH 1/4 arm64: dts: rockchip: rk3328: Enable USB3 for Rock64

From: Cameron Nemo <[email protected]>

Enable USB3 nodes for the rk3328-based PINE Rock64 board.

The separate power regulator is not added as it is controlled by the same GPIO line as the existing VBUS regulators, so it is already enabled. Also there is no port representation to tie the regulator to.

---
 arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +5 -0
index 3bef1f39bc6e..1b0f7e4551ea 100644
@@ -381,6 +381,11 @@ &usb20_otg {
 	status = "okay";
 };
 
+&usbdrd3 {
+	dr_mode = "host";
+	status = "okay";
+};
+
 &usb_host0_ehci {
 	status = "okay";
 };
Signature · 7 lines
2.31.1


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

PATCH 2/4 arm64: dts: rockchip: rk3328: Enable USB3 for ROC-RK3328-CC

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Enable USB3 nodes for the ROC-RK3328-CC board.

The separate power regulator is not added as it is controlled by the same GPIO line as the existing VBUS regulators, so it is already enabled. Also there is no port representation to tie the regulator to.

---
 arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +5 -0
index a05732b59f38..bdf0ca07eae9 100644
@@ -363,6 +363,11 @@ &usb20_otg {
 	status = "okay";
 };
 
+&usbdrd3 {
+	dr_mode = "host";
+	status = "okay";
+};
+
 &usb_host0_ehci {
 	status = "okay";
 };
Signature · 7 lines
2.31.1


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

PATCH 3/4 arm64: dts: rockchip: rk3328: Enable USB3 for Rock Pi E

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Enable USB3 nodes for the Rock Pi E board.

The VBUS regulator device node was added when the board was first introduced.

---
 arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts +5 -0
index c02059c0a954..018a3a5075c7 100644
@@ -380,6 +380,11 @@ &uart2 {
 	status = "okay";
 };
 
+&usbdrd3 {
+	dr_mode = "host";
+	status = "okay";
+};
+
 &usb_host0_ehci {
 	status = "okay";
 };
Signature · 7 lines
2.31.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#4 lore raw

PATCH 4/4 arm64: dts: rockchip: rk3328: Enable USB3 Ethernet on NanoPi R2S

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

The NanoPi R2S has a Realtek RTL8153B USB 3.0 Ethernet chip connected to the USB 3.0 pins of the RK3328 SoC. Power to the chip is controlled by a GPIO line toggled transistor switch, which is not a full-blown voltage regulator.

At least in Linux, the USB 3.0 XHCI controller has two ports: the first port is for legacy USB 2.0 and slower, while the second port is for USB 3.0. Since the Ethernet chip supports USB 3.0, it should be described as connected to the second port.

Add the device nodes for the power switch and Ethernet chip, and enable the USB 3.0 controller. The USB device node follows the standard USB device binding.

---
 .../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 f807bc066ccb..64cf07ee3d10 100644
@@ -14,6 +14,7 @@ / {
 	compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328";
 
 	aliases {
+		ethernet1 = &rtl8153;
 		mmc0 = &sdmmc;
 	};
 
@@ -101,6 +102,18 @@ vdd_5v: vdd-5v {
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
 	};
+
+	vdd_5v_lan: vdd-5v-lan {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
+		pinctrl-0 = <&lan_vdd_pin>;
+		pinctrl-names = "default";
+		regulator-name = "vdd_5v_lan";
+		regulator-always-on;
+		regulator-boot-on;
+		vin-supply = <&vdd_5v>;
+	};
 };
 
 &cpu0 {
@@ -309,6 +322,12 @@ wan_led_pin: wan-led-pin {
 		};
 	};
 
+	lan {
+		lan_vdd_pin: lan-vdd-pin {
+			rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
 	pmic {
 		pmic_int_l: pmic-int-l {
 			rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
@@ -368,6 +387,19 @@ &usb20_otg {
 	dr_mode = "host";
 };
 
+&usbdrd3 {
+	dr_mode = "host";
+	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	/* Second port is for USB 3.0 */
+	rtl8153: device@2 {
+		compatible = "usbbda,8153";
+		reg = <2>;
+	};
+};
+
 &usb_host0_ehci {
 	status = "okay";
 };
Signature · 7 lines
2.31.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
maintainer Applied
#5 lore raw
In reply to Chen-Yu Tsai
Quoted 8 lines · Chen-Yu Tsai

Here are some patches that enable USB3 on RK3328 SBCs that I own. The changes are quite straightforward, except for the NanoPi R2S, which has a USB3 Ethernet chip attached. I am aware that there's already a patch [1] for that. This is my spin on things using the USB device binding, with comments on how the USB ports are arranged, that I had done but couldn't find the time to send out.

[...]

Applied, thanks!

[1/4] arm64: dts: rockchip: rk3328: Enable USB3 for Rock64

      commit: bbac8bd65f5402281cb7b0452c1c5f367387b459
[2/4] arm64: dts: rockchip: rk3328: Enable USB3 for ROC-RK3328-CC
      commit: 75f95927334dea863f16f4ecd29cc709edc3c6ad
[3/4] arm64: dts: rockchip: rk3328: Enable USB3 for Rock Pi E
      commit: bf340c8084d2932936f385ebf48c4734b2911457
[4/4] arm64: dts: rockchip: rk3328: Enable USB3 Ethernet on NanoPi R2S
      commit: d49f120e27dc1689e11a14e9714e63a390dd4520

Best regards,

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