2021-05-04 08:40:25

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH 0/4] 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(+)

--
2.31.1


2021-05-04 08:41:11

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH 4/4] arm64: dts: rockchip: rk3328: Enable USB3 Ethernet on NanoPi R2S

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.

Signed-off-by: Chen-Yu Tsai <[email protected]>
---
.../boot/dts/rockchip/rk3328-nanopi-r2s.dts | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
index f807bc066ccb..64cf07ee3d10 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
@@ -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";
};
--
2.31.1

2021-05-04 09:03:44

by Chen-Yu Tsai

[permalink] [raw]
Subject: [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.

Signed-off-by: Heiko Stuebner <[email protected]>
Signed-off-by: Cameron Nemo <[email protected]>
[[email protected]: Rewrote commit message]
[[email protected]: Rebased onto v5.12]
Signed-off-by: Chen-Yu Tsai <[email protected]>
---
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
index 3bef1f39bc6e..1b0f7e4551ea 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
@@ -381,6 +381,11 @@ &usb20_otg {
status = "okay";
};

+&usbdrd3 {
+ dr_mode = "host";
+ status = "okay";
+};
+
&usb_host0_ehci {
status = "okay";
};
--
2.31.1

2021-05-09 23:56:29

by Heiko Stuebner

[permalink] [raw]
Subject: Re: [PATCH 0/4] arm64: dts: rockchip: rk3328: Enable USB3 on some SBCs

On Tue, 4 May 2021 16:36:12 +0800, Chen-Yu Tsai wrote:
> 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,
--
Heiko Stuebner <[email protected]>