[PATCH 3/3] riscv: dts: sophgo: sg2002-milkv-duo256m: Enable USB role switch
Chen-Yu Yeh
chenyou910331 at gmail.com
Tue Nov 3 00:58:47 PST 2026
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 at 48-role-switch/role
Signed-off-by: Chen-Yu Yeh <chenyou910331 at gmail.com>
---
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
More information about the linux-phy
mailing list