From: Chen-Yu Yeh <chenyou910331@gmail.com>
To: Vinod Koul <vkoul@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Inochi Amaoto <inochiama@gmail.com>,
Chen Wang <chen.wang@linux.dev>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Hiago De Franco <hfranco@baylibre.com>,
linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
sophgo@lists.linux.dev, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org,
Chen-Yu Yeh <chenyou910331@gmail.com>
Subject: [PATCH 3/3] riscv: dts: sophgo: sg2002-milkv-duo256m: Enable USB role switch
Date: Tue, 3 Nov 2026 16:58:47 +0800 [thread overview]
Message-ID: <20261103085847.338613-4-chenyou910331@gmail.com> (raw)
In-Reply-To: <20261103085847.338613-1-chenyou910331@gmail.com>
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@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
prev parent reply other threads:[~2026-11-03 8:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 8:58 [PATCH 0/3] phy: sophgo: Add USB role switch for CV18XX/SG200X Chen-Yu Yeh
2026-11-03 8:58 ` [PATCH 1/3] dt-bindings: phy: sophgo,cv1800b-usb2-phy: Add USB role switch properties Chen-Yu Yeh
2026-11-03 8:58 ` [PATCH 2/3] phy: sophgo: Add USB role switch support for CV18XX/SG200X Chen-Yu Yeh
2026-11-03 8:58 ` Chen-Yu Yeh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103085847.338613-4-chenyou910331@gmail.com \
--to=chenyou910331@gmail.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=chen.wang@linux.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hfranco@baylibre.com \
--cc=inochiama@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-riscv@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=sophgo@lists.linux.dev \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®