Devicetree
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: rockchip: Enable USB device mode on rk3588s-roc-pc
@ 2026-07-09  0:50 Fabio Estevam
  2026-07-09  1:01 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2026-07-09  0:50 UTC (permalink / raw)
  To: heiko
  Cc: robh, krzk+dt, conor+dt, devicetree, linux-arm-kernel,
	linux-rockchip, Fabio Estevam

From: Fabio Estevam <festevam@nabladev.com>

The USB3 OTG controller on the ROC-PC can be used in device mode,
but the board description only enabled the DWC3 controller and USB2 PHY.
The USBDP PHY remained disabled and the controller had no role-switch
default, so DWC3 did not register a UDC and USB gadget drivers such
as g_mass_storage failed to bind.

Enable the USBDP PHY and describe the controller as a USB role switch
with peripheral as the default role. This lets the controller register
as a UDC when no external role provider has selected a host role.

Tested on a Firefly Station M3 by binding g_mass_storage to expose the
eMMC as a USB mass-storage gadget.

Signed-off-by: Fabio Estevam <festevam@nabladev.com>
---
 arch/arm64/boot/dts/rockchip/rk3588s-roc-pc.dts | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-roc-pc.dts b/arch/arm64/boot/dts/rockchip/rk3588s-roc-pc.dts
index 99853880aaac..7150d5f7684d 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588s-roc-pc.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588s-roc-pc.dts
@@ -833,6 +833,12 @@ &usb_host0_ohci {
 
 &usb_host0_xhci {
 	extcon = <&u2phy0>;
+	role-switch-default-mode = "peripheral";
+	usb-role-switch;
+	status = "okay";
+};
+
+&usbdp_phy0 {
 	status = "okay";
 };
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm64: dts: rockchip: Enable USB device mode on rk3588s-roc-pc
  2026-07-09  0:50 [PATCH] arm64: dts: rockchip: Enable USB device mode on rk3588s-roc-pc Fabio Estevam
@ 2026-07-09  1:01 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-09  1:01 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: robh, conor+dt, devicetree

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Adding `usb-role-switch` nullifies existing `extcon` functionality, permanently breaking automatic OTG role switching.
--

--- Patch [1]: [PATCH] arm64: dts: rockchip: Enable USB device mode on rk3588s-roc-pc ---
commit 5791d34a99b00bf3d67aa350284aa7287f468661
Author: Fabio Estevam <festevam@nabladev.com>

arm64: dts: rockchip: Enable USB device mode on rk3588s-roc-pc

This commit configures the DWC3 controller on the rk3588s-roc-pc to act as a
USB role switch defaulting to peripheral mode. It also enables the USBDP PHY
to allow the controller to register as a UDC, enabling USB gadget drivers to
bind.

> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-roc-pc.dts b/arch/arm64/boot/dts/rockchip/rk3588s-roc-pc.dts
> index 7e179862da6e5..cf2e83664305d 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588s-roc-pc.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3588s-roc-pc.dts
> @@ -813,6 +813,12 @@ &usb_host0_ohci {
>  
>  &usb_host0_xhci {
>  	extcon = <&u2phy0>;
> +	role-switch-default-mode = "peripheral";
> +	usb-role-switch;

[Severity: Medium]
Will adding usb-role-switch here nullify the existing extcon functionality and
permanently break automatic OTG role switching?

During initialization, DWC3's dwc3_drd_init() unconditionally returns early if
the usb-role-switch property is set, which skips the extcon_register_notifier()
call entirely.

Because the board's PHY driver (phy-rockchip-inno-usb2) broadcasts ID pin state
changes exclusively via extcon and does not implement a usb_role_switch
provider, it appears DWC3 will never receive role switch events. Will this
cause the OTG port to be permanently locked into peripheral mode, preventing
USB host mode from functioning when an OTG cable is attached?

> +	status = "okay";
> +};

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260709005006.413145-1-festevam@gmail.com?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-09  1:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09  0:50 [PATCH] arm64: dts: rockchip: Enable USB device mode on rk3588s-roc-pc Fabio Estevam
2026-07-09  1:01 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox