[PATCH 3/3] riscv: dts: sophgo: sg2002-milkv-duo256m: Enable USB role switch
From: Chen-Yu Yeh
Date: Tue Nov 03 2026 - 04:04:24 EST
The USB-C port of the Milk-V Duo 256M is the only USB connector on the
bare board, and the vendor image uses it in device mode by default.
Host mode is mainly needed with the USB & Ethernet IO board, whose USB
hub hangs off the same controller.
Use the role switch in the PHY so that one DTB can do both, and default
to peripheral to match the vendor image.
This changes the default of the port from host to device. To use host
mode, including the hub on the IO board, select it at runtime:
echo host > /sys/class/usb_role/3000000.syscon:phy@48-role-switch/role
Signed-off-by: Chen-Yu Yeh <chenyou910331@xxxxxxxxx>
---
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts b/arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts
index d4e86c15664e..0ad1dfd9449c 100644
--- a/arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts
+++ b/arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts
@@ -105,6 +105,11 @@ &uart0 {
};
&usb {
- dr_mode = "host";
+ dr_mode = "otg";
status = "okay";
};
+
+&usbphy {
+ usb-role-switch;
+ role-switch-default-mode = "peripheral";
+};
--
2.43.0