Skip to contentSkip to conversation

rockchip: Enable USB support for RK3528

PATCH In review Jonas Karlman 2 participants 9 messages Jul 10 – Aug 13

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

cover rockchip: Enable USB support for RK3528

This series picks USB related DT commits from v7.2-rc1-dts to enabled USB support on existing RK3528 boards. It also adds required DT nodes and enables required Kconfig options on the Generic RK3528 target.

The 'Add watchdog node for RK3528' commit was included to fully sync RK3528 DTs up to v7.2-rc1 state, it is not required for USB support.

USB has been verified working on following boards using both generic and the board specific defconfig target.

- ArmSoM Sige1
- FriendlyElec NanoPi Zero2
- Radxa E20C
- Radxa ROCK 2F

Please note that the dts/upstream related patches should be applied after v7.1-dts has been fully pulled into dts/upstream.

Jonas Karlman (7):
arm64: dts: rockchip: Add watchdog node for RK3528
arm64: dts: rockchip: Add USB nodes for RK3528
arm64: dts: rockchip: Enable USB 2.0 ports on Radxa E20C
arm64: dts: rockchip: Enable USB ports on Radxa ROCK 2A/2F
arm64: dts: rockchip: Enable USB 2.0 ports on ArmSoM Sige1
arm64: dts: rockchip: Enable USB 2.0 ports on NanoPi Zero2
rockchip: rk3528-generic: Add support for USB OTG

 arch/arm/dts/rk3528-generic.dts               | 18 +++-
 configs/generic-rk3528_defconfig              | 10 +++
 .../arm64/rockchip/rk3528-armsom-sige1.dts    | 25 ++++++
 .../arm64/rockchip/rk3528-nanopi-zero2.dts    | 29 ++++++
 .../src/arm64/rockchip/rk3528-radxa-e20c.dts  | 60 +++++++++++++
 .../src/arm64/rockchip/rk3528-rock-2.dtsi     | 17 ++++
 .../src/arm64/rockchip/rk3528-rock-2a.dts     | 11 +++
 .../src/arm64/rockchip/rk3528-rock-2f.dts     | 12 +++
 dts/upstream/src/arm64/rockchip/rk3528.dtsi   | 88 +++++++++++++++++++
 9 files changed, 269 insertions(+), 1 deletion(-)
Signature · 1 line
2.54.0
#1 lore raw

PATCH 1/7 arm64: dts: rockchip: Add watchdog node for RK3528

Add the node describing the watchdog on the RK3528 SoC.

[ upstream commit: eb24b60553e0692cbbec2863ca31d2a56bff098d ]

(cherry picked from commit 87fa1af25f01c71bd8cfc51920b3a6d51d38abe5)
---
 dts/upstream/src/arm64/rockchip/rk3528.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
dts/upstream/src/arm64/rockchip/rk3528.dtsi +8 -0
index 806b8109f67d..77d314716b43 100644
@@ -983,6 +983,14 @@
 			status = "disabled";
 		};
 
+		wdt: watchdog@ffac0000 {
+			compatible = "rockchip,rk3528-wdt", "snps,dw-wdt";
+			reg = <0x0 0xffac0000 0x0 0x100>;
+			clocks = <&cru TCLK_WDT_NS>, <&cru PCLK_WDT_NS>;
+			clock-names = "tclk", "pclk";
+			interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
 		saradc: adc@ffae0000 {
 			compatible = "rockchip,rk3528-saradc";
 			reg = <0x0 0xffae0000 0x0 0x10000>;
Signature · 1 line
2.54.0
#2 lore raw

PATCH 2/7 arm64: dts: rockchip: Add USB nodes for RK3528

In reply to Jonas Karlman

Rockchip RK3528 has one USB 3.0 DWC3 controller and oneUSB 2.0 EHCI/OHCI controller and uses an Innosilicon-USB2PHY for USB 2.0. The DWC3 controller additionally uses the Naneng Combo PHY for USB3.

Add device tree nodes to describe these USB controllers along with the USB 2.0 PHYs.

[moved snps,dis_u2_susphy_quirk here from individual boards,
describe both usb2+3 default phy connections, usb2 boards can override]

[ upstream commit: 5f3ae9b12a6c523992a7216bbc4420ac33450b79 ]

(cherry picked from commit 7793aab344678ac6b9fe039d01ff0c1106bc8b0d)
---
 dts/upstream/src/arm64/rockchip/rk3528.dtsi | 80 +++++++++++++++++++++
 1 file changed, 80 insertions(+)
dts/upstream/src/arm64/rockchip/rk3528.dtsi +80 -0
index 77d314716b43..03cd00f88dbb 100644
@@ -336,6 +336,33 @@
 			};
 		};
 
+		usb_host0_xhci: usb@fe500000 {
+			compatible = "rockchip,rk3528-dwc3", "snps,dwc3";
+			reg = <0x0 0xfe500000 0x0 0x400000>;
+			clocks = <&cru CLK_REF_USB3OTG>,
+				 <&cru CLK_SUSPEND_USB3OTG>,
+				 <&cru ACLK_USB3OTG>;
+			clock-names = "ref_clk", "suspend_clk", "bus_clk";
+			interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>;
+			power-domains = <&power RK3528_PD_VPU>;
+			resets = <&cru SRST_A_USB3OTG>;
+			dr_mode = "otg";
+			phys = <&usb2phy_otg>, <&combphy PHY_TYPE_USB3>;
+			phy-names = "usb2-phy", "usb3-phy";
+			phy_type = "utmi_wide";
+			snps,dis_enblslpm_quirk;
+			snps,dis_rxdet_inp3_quirk;
+			snps,dis-del-phy-power-chg-quirk;
+			snps,dis-tx-ipgap-linecheck-quirk;
+			snps,dis-u1-entry-quirk;
+			snps,dis-u2-entry-quirk;
+			snps,dis-u2-freeclk-exists-quirk;
+			snps,dis_u2_susphy_quirk;
+			snps,parkmode-disable-hs-quirk;
+			snps,parkmode-disable-ss-quirk;
+			status = "disabled";
+		};
+
 		gic: interrupt-controller@fed01000 {
 			compatible = "arm,gic-400";
 			reg = <0x0 0xfed01000 0 0x1000>,
@@ -349,6 +376,30 @@
 			#interrupt-cells = <3>;
 		};
 
+		usb_host0_ehci: usb@ff100000 {
+			compatible = "generic-ehci";
+			reg = <0x0 0xff100000 0x0 0x40000>;
+			clocks = <&cru HCLK_USBHOST>, <&cru HCLK_USBHOST_ARB>,
+				 <&usb2phy>;
+			interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&usb2phy_host>;
+			phy-names = "usb";
+			power-domains = <&power RK3528_PD_VO>;
+			status = "disabled";
+		};
+
+		usb_host0_ohci: usb@ff140000 {
+			compatible = "generic-ohci";
+			reg = <0x0 0xff140000 0x0 0x40000>;
+			clocks = <&cru HCLK_USBHOST>, <&cru HCLK_USBHOST_ARB>,
+				 <&usb2phy>;
+			interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&usb2phy_host>;
+			phy-names = "usb";
+			power-domains = <&power RK3528_PD_VO>;
+			status = "disabled";
+		};
+
 		qos_crypto_a: qos@ff200000 {
 			compatible = "rockchip,rk3528-qos", "syscon";
 			reg = <0x0 0xff200000 0x0 0x20>;
@@ -1281,6 +1332,35 @@
 			rockchip,pipe-phy-grf = <&pipe_phy_grf>;
 			status = "disabled";
 		};
+
+		usb2phy: usb2phy@ffdf0000 {
+			compatible = "rockchip,rk3528-usb2phy";
+			reg = <0x0 0xffdf0000 0x0 0x10000>;
+			clocks = <&cru CLK_REF_USBPHY>, <&cru PCLK_USBPHY>;
+			clock-names = "phyclk", "pclk";
+			#clock-cells = <0>;
+			clock-output-names = "clk_usbphy_480m";
+			power-domains = <&power RK3528_PD_VO>;
+			rockchip,usbgrf = <&vo_grf>;
+			status = "disabled";
+
+			usb2phy_otg: otg-port {
+				interrupts = <GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-names = "otg-bvalid", "otg-id",
+						  "linestate";
+				#phy-cells = <0>;
+				status = "disabled";
+			};
+
+			usb2phy_host: host-port {
+				interrupts = <GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-names = "linestate";
+				#phy-cells = <0>;
+				status = "disabled";
+			};
+		};
 	};
 };
 
Signature · 1 line
2.54.0
#3 lore raw

PATCH 3/7 arm64: dts: rockchip: Enable USB 2.0 ports on Radxa E20C

In reply to Jonas Karlman

The Radxa E20C has one USB2.0 Type-A HOST port and one USB2.0 Type-C port.

The Type-C port is conneced to a FE1.1s_QFN USB hub on the board, with its ports being connected to the XHCI usb controller and an usb-uart bridge.

This also means, the XHCI controller can only be used in device-mode.

Add support for using the USB 2.0 ports on Radxa E20C.

[set xhci to peripheral and add comment about the outward-facing hub]

[ upstream commit: e897bcf81dd920bf80ace6d98ec6f9645c5b50f2 ]

(cherry picked from commit 2e01d9a6eb75fa4c704e421e766b2715000d1a29)
---
 .../src/arm64/rockchip/rk3528-radxa-e20c.dts  | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)
dts/upstream/src/arm64/rockchip/rk3528-radxa-e20c.dts +60 -0
index b32452756155..f872b8d20ebc 100644
@@ -134,6 +134,18 @@
 		regulator-max-microvolt = <5000000>;
 	};
 
+	vcc5v0_usb20: regulator-5v0-vcc-usb20 {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb_host_en>;
+		regulator-name = "vcc5v0_usb20";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc5v0_sys>;
+	};
+
 	vccio_sd: regulator-vccio-sd {
 		compatible = "regulator-gpio";
 		gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>;
@@ -273,6 +285,12 @@
 			rockchip,pins = <4 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
+
+	usb {
+		usb_host_en: usb-host-en {
+			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
 };
 
 &pwm1 {
@@ -320,3 +338,45 @@
 	pinctrl-0 = <&uart0m0_xfer>;
 	status = "okay";
 };
+
+&usb_host0_ehci {
+	status = "okay";
+};
+
+&usb_host0_ohci {
+	status = "okay";
+};
+
+/*
+ * The usb controller can only work in peripheral mode, as it is
+ * connected to one of the ports of an outward-facing usb hub.
+ *
+ * type_c-port (hub-input)
+ *          |
+ *       usb-hub
+ *     |         |
+ * uart-usb   usb-host0
+ *     |
+ *   uart0
+ */
+&usb_host0_xhci {
+	dr_mode = "peripheral";
+	extcon = <&usb2phy>;
+	maximum-speed = "high-speed";
+	phys = <&usb2phy_otg>;
+	phy-names = "usb2-phy";
+	status = "okay";
+};
+
+&usb2phy {
+	status = "okay";
+};
+
+&usb2phy_host {
+	phy-supply = <&vcc5v0_usb20>;
+	status = "okay";
+};
+
+&usb2phy_otg {
+	status = "okay";
+};
Signature · 1 line
2.54.0
#4 lore raw

PATCH 4/7 arm64: dts: rockchip: Enable USB ports on Radxa ROCK 2A/2F

In reply to Jonas Karlman

The ROCK 2A has three USB 2.0 Type-A HOST ports behind an onboard USB hub, and one USB 3.0 Type-A port.

And the ROCK 2F has two USB 2.0 Type-A HOST ports behind an onboard USB hub, and one USB 2.0 Type-C OTG port.

Add support for using the USB ports on Radxa ROCK 2A/2F.

The onboard USB hub handles OHCI so only the EHCI controller is enabled.

[ upstream commit: 4e55d52f5f3b333a9ff5103099df97291aaeb083 ]

(cherry picked from commit dd0101f77912adbf6ed95168a215f4eeceebf241)
---
 .../src/arm64/rockchip/rk3528-rock-2.dtsi       | 17 +++++++++++++++++
 .../src/arm64/rockchip/rk3528-rock-2a.dts       | 11 +++++++++++
 .../src/arm64/rockchip/rk3528-rock-2f.dts       | 12 ++++++++++++
 3 files changed, 40 insertions(+)
dts/upstream/src/arm64/rockchip/rk3528-rock-2.dtsi +17 -0
index aedc7ee9ee46..501a91f4c23e 100644
@@ -166,6 +166,10 @@
 	};
 };
 
+&combphy {
+	status = "okay";
+};
+
 &cpu0 {
 	cpu-supply = <&vdd_arm>;
 };
@@ -291,3 +295,16 @@
 	pinctrl-0 = <&uart0m0_xfer>;
 	status = "okay";
 };
+
+&usb_host0_ehci {
+	status = "okay";
+};
+
+&usb2phy {
+	status = "okay";
+};
+
+&usb2phy_host {
+	phy-supply = <&vcc5v0_usb20>;
+	status = "okay";
+};
dts/upstream/src/arm64/rockchip/rk3528-rock-2a.dts +11 -0
index 0b696d49b71f..5e17ec2758d5 100644
@@ -79,3 +79,14 @@
 		};
 	};
 };
+
+&usb_host0_xhci {
+	dr_mode = "host";
+	extcon = <&usb2phy>;
+	status = "okay";
+};
+
+&usb2phy_otg {
+	phy-supply = <&vcc5v0_usb30_otg>;
+	status = "okay";
+};
dts/upstream/src/arm64/rockchip/rk3528-rock-2f.dts +12 -0
index 3e2b9b685cb2..f2b021ff5046 100644
@@ -8,3 +8,15 @@
 	model = "Radxa ROCK 2F";
 	compatible = "radxa,rock-2f", "rockchip,rk3528";
 };
+
+&usb_host0_xhci {
+	extcon = <&usb2phy>;
+	maximum-speed = "high-speed";
+	phys = <&usb2phy_otg>;
+	phy-names = "usb2-phy";
+	status = "okay";
+};
+
+&usb2phy_otg {
+	status = "okay";
+};
Signature · 1 line
2.54.0
#5 lore raw

PATCH 5/7 arm64: dts: rockchip: Enable USB 2.0 ports on ArmSoM Sige1

In reply to Jonas Karlman

The ArmSoM Sige1 has two USB 2.0 Type-A HOST ports behind an onboard USB hub, and one USB 2.0 Type-C OTG port.

Add support for using the USB 2.0 ports on ArmSoM Sige1.

The onboard USB hub handles OHCI so only the EHCI controller is enabled.

[ upstream commit: b6b74087f90a201cfdd6da6a43e7b92dba8370e3 ]

(cherry picked from commit 959d0d70460b569e212c0daa70404b794cbcd37c)
---
 .../arm64/rockchip/rk3528-armsom-sige1.dts    | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
dts/upstream/src/arm64/rockchip/rk3528-armsom-sige1.dts +25 -0
index c41af8fc0c8d..ee4183fb980d 100644
@@ -480,3 +480,28 @@
 		vddio-supply = <&vcc_1v8>;
 	};
 };
+
+&usb_host0_ehci {
+	status = "okay";
+};
+
+&usb_host0_xhci {
+	extcon = <&usb2phy>;
+	maximum-speed = "high-speed";
+	phys = <&usb2phy_otg>;
+	phy-names = "usb2-phy";
+	status = "okay";
+};
+
+&usb2phy {
+	status = "okay";
+};
+
+&usb2phy_host {
+	status = "okay";
+};
+
+&usb2phy_otg {
+	phy-supply = <&vcc5v0_usb_otg>;
+	status = "okay";
+};
Signature · 1 line
2.54.0
#6 lore raw

PATCH 6/7 arm64: dts: rockchip: Enable USB 2.0 ports on NanoPi Zero2

In reply to Jonas Karlman

The NanoPi Zero2 has one USB 2.0 Type-A HOST port and one USB 2.0 Type-C OTG port.

Add support for using the USB 2.0 ports on NanoPi Zero2.

[ upstream commit: ff660109f4129a13bbdc31bc14ca233ebf0c9450 ]

(cherry picked from commit 2f28b83dd0d59cddb15927dbf30eb6960fbf772d)
---
 .../arm64/rockchip/rk3528-nanopi-zero2.dts    | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
dts/upstream/src/arm64/rockchip/rk3528-nanopi-zero2.dts +29 -0
index 9f683033c5f3..97d85124d21b 100644
@@ -338,3 +338,32 @@
 	pinctrl-0 = <&uart0m0_xfer>;
 	status = "okay";
 };
+
+&usb_host0_ehci {
+	status = "okay";
+};
+
+&usb_host0_ohci {
+	status = "okay";
+};
+
+&usb_host0_xhci {
+	extcon = <&usb2phy>;
+	maximum-speed = "high-speed";
+	phys = <&usb2phy_otg>;
+	phy-names = "usb2-phy";
+	status = "okay";
+};
+
+&usb2phy {
+	status = "okay";
+};
+
+&usb2phy_host {
+	phy-supply = <&usb2_host_5v>;
+	status = "okay";
+};
+
+&usb2phy_otg {
+	status = "okay";
+};
Signature · 1 line
2.54.0
#7 lore raw

PATCH 7/7 rockchip: rk3528-generic: Add support for USB OTG

In reply to Jonas Karlman

Add support for USB OTG, RockUSB and UMS to the generic RK3528 target.

USB OTG tested on following boards:
- ArmSoM Sige1
- FriendlyElec NanoPi Zero2
- Radxa E20C
- Radxa ROCK 2F

---
 arch/arm/dts/rk3528-generic.dts  | 18 +++++++++++++++++-
 configs/generic-rk3528_defconfig | 10 ++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
arch/arm/dts/rk3528-generic.dts +17 -1
index 637ca03325ed..34d614452ece 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Minimal generic DT for RK3528 with eMMC and SD-card enabled
+ * Minimal generic DT for RK3528 with eMMC, SD-card and USB OTG enabled
  */
 
 /dts-v1/;
@@ -45,3 +45,19 @@
 	pinctrl-0 = <&uart0m0_xfer>;
 	status = "okay";
 };
+
+&usb_host0_xhci {
+	dr_mode = "peripheral";
+	maximum-speed = "high-speed";
+	phys = <&usb2phy_otg>;
+	phy-names = "usb2-phy";
+	status = "okay";
+};
+
+&usb2phy {
+	status = "okay";
+};
+
+&usb2phy_otg {
+	status = "okay";
+};
configs/generic-rk3528_defconfig +10 -0
index c989263e014a..130aa124298a 100644
@@ -19,6 +19,8 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MISC=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_ROCKUSB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_RNG=y
 # CONFIG_SPL_DOS_PARTITION is not set
@@ -26,6 +28,7 @@ CONFIG_CMD_RNG=y
 CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_NO_NET=y
 # CONFIG_ADC is not set
+# CONFIG_USB_FUNCTION_FASTBOOT is not set
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SUPPORT_EMMC_RPMB=y
 CONFIG_MMC_DW=y
@@ -33,7 +36,14 @@ CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_BAUDRATE=1500000
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550_MEM32=y
+CONFIG_USB=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_FUNCTION_ROCKUSB=y
 CONFIG_ERRNO_STR=y
Signature · 1 line
2.54.0
#8 lore raw
In reply to Jonas Karlman
Quoted 8 lines · Jonas Karlman

This series picks USB related DT commits from v7.2-rc1-dts to enabled USB support on existing RK3528 boards. It also adds required DT nodes and enables required Kconfig options on the Generic RK3528 target.

The 'Add watchdog node for RK3528' commit was included to fully sync RK3528 DTs up to v7.2-rc1 state, it is not required for USB support.

[...]

Applied to https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip (u-boot-rockchip-2027.01), thanks!

[1/7] arm64: dts: rockchip: Add watchdog node for RK3528

      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/a29794199190dee25a809210aad66ce5a18ef27f
[2/7] arm64: dts: rockchip: Add USB nodes for RK3528
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/42437844e1dc7b78661d8d66cb9939ad0f981734
[3/7] arm64: dts: rockchip: Enable USB 2.0 ports on Radxa E20C
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/34aecf3758bbb0251159cda1e0fa5c8a7aaa3f4f
[4/7] arm64: dts: rockchip: Enable USB ports on Radxa ROCK 2A/2F
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/7382b32c71b1c160c96678b32ccad6737f6cd5aa
[5/7] arm64: dts: rockchip: Enable USB 2.0 ports on ArmSoM Sige1
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/6426f2d2b3105e75a45e703ae4e6a90a7bc603f9
[6/7] arm64: dts: rockchip: Enable USB 2.0 ports on NanoPi Zero2
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/a6c6a2fd5bdd71fa6eedaf79ed6c55921741c9c9
[7/7] rockchip: rk3528-generic: Add support for USB OTG
      https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip/-/commit/8d913de45891bc79dcf2337e03da6b7ec4e83518

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>