From: Inochi Amaoto <inochiama@gmail.com>
To: Chen-Yu Yeh <chenyou910331@gmail.com>,
Inochi Amaoto <inochiama@gmail.com>
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
chen.wang@linux.dev, pjw@kernel.org, palmer@dabbelt.com,
aou@eecs.berkeley.edu, alex@ghiti.fr, hminas@synopsys.com,
gregkh@linuxfoundation.org, looong.bin@gmail.com,
dinguyen@opensource.altera.com, paulz@synopsys.com, balbi@ti.com,
dlan@gentoo.org, devicetree@vger.kernel.org,
sophgo@lists.linux.dev, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH 0/4] usb: dwc2: Add USB DRD support on CV1800 Series SoC
Date: Wed, 18 Nov 2026 19:36:04 +0800 [thread overview]
Message-ID: <av2M-6w1u5mOyqDM@inochi.infowork> (raw)
In-Reply-To: <20261113072305.220610-1-chenyou910331@gmail.com>
On Fri, Nov 13, 2026 at 03:23:05PM +0800, Chen-Yu Yeh wrote:
> On Tue, Nov 10, 2026 at 03:06:21PM +0800, Inochi Amaoto wrote:
> > The current DRD implementation of DRD will cause a interrupt flow on
> > CV1800 Series SoC. It has two reasons:
> > 1. The DRD does not sync the phy mode when change the controller mode,
> > it is a violation of the DRD as it does not rely on a OTG phy.
> > 2. The CV1800 is entered with a Session End Detected interrupt, but the
> > DRD code has no change on it, so the controller will enter the
> > interrupt storm.
>
> Thanks, fixing this in dwc2 makes sense to me. I am dropping my PHY
> series [1].
>
> I tested patches 1-3 on a Milk-V Duo 256M (SG2002), on top of
> f66469d9905b, with this on the board DTS:
>
> &usb {
> dr_mode = "otg";
> usb-role-switch;
> role-switch-default-mode = "peripheral";
> status = "okay";
> };
>
> R=/sys/class/usb_role/4340000.usb-role-switch below.
>
> Bare board on a PC, after booting:
>
> # echo device > $R/role
> # devmem 0x03000048 32
> 0x000003C0
> # cat /sys/class/udc/*/state
> configured
>
> PC$ lsusb | grep 0525
> Bus 003 Device 012: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
>
> # echo host > $R/role
> # devmem 0x04340000 32 (GOTGCTL)
> 0x002C00FC
> # devmem 0x04340004 32 (GOTGINT)
> 0x00000000
>
> The interrupt count did not move over one second in host mode, so no
> storm. Switching back to device gave "configured" again, and "none"
> went back to device. I did one host/device round on each of two boots.
>
> On the USB & Ethernet IO board, with a USB stick plugged in:
>
> # echo host > $R/role
> [ 136.556790] hub 1-1:1.0: 4 ports detected
> [ 136.837392] usb 1-1.1: new high-speed USB device number 3 using dwc2
> [ 139.174764] sda: sda1 sda2 sda3 sda4
>
> GINTMSK 0xF300081E, HPRT0 0x00001005
>
> Tested-by: Chen-Yu Yeh <chenyou910331@gmail.com> # Milk-V Duo 256M
>
> > Note: This patches set does not resolve all the problems, as
> > usb_add_hcd() will override the role set by dwc2, but I am not
> > sure whether it should change skip_phy_initialization of hcd.
> > So I kept it as it is and users still needs to set the role
> > in the userspace as "role-switch-default-mode" in devicetree
> > takes no effect.
>
> I see the same at boot, and the "set mode" print in the PHY driver
> shows the order:
>
> [ 1.777738] phy phy-3000000.syscon:phy@48.0: set mode 6
> [ 1.778979] phy phy-3000000.syscon:phy@48.0: set mode 5
> [ 1.779005] phy phy-3000000.syscon:phy@48.0: set mode 1
>
> That is PHY_MODE_USB_DEVICE from dwc2_drd_init(), then HOST_SS (not
> supported by the PHY) and HOST from usb_add_hcd(). The PHY ends up in
> host (0x03000048 = 0x142) while the controller is still in device mode
> (GINTSTS = 0x04000020). On the bare board the UDC stays "not attached"
> and the PC sees nothing. On the IO board the hub does not show up
> either. So until a role is written, the port does not work in either
> mode. This was the same on all three boots.
>
> I am happy to test the next versions on the Duo 256M, in both device
> and host mode, and send a Tested-by.
>
If there are no other bug in this patch. There should be no new
version. The device probe problem is not a very big one. And I have
no idea about these thing. Since my time is tight, you are free to
send the fix for the device mode.
> Once your series is merged, would you like me to send the DTS change
> for the Duo 256M, or would you prefer to do it yourself?
>
> [1] https://lore.kernel.org/all/avLC68zOj8WKuslb@inochi.infowork/
>
> Regards,
> Chen-Yu
It depends, if you accept setting this to host, I can add them
at once. (Note: once set, no change will be accepted).
Regards,
Inochi
prev parent reply other threads:[~2026-11-18 11:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 7:06 Inochi Amaoto
2026-11-10 7:06 ` [PATCH 1/4] usb: dwc2: gadget: honor pullup requests in core_connect Inochi Amaoto
2026-11-10 7:06 ` [PATCH 2/4] usb: dwc2: drd: Sync the generic PHY mode with role requests Inochi Amaoto
2026-11-10 7:06 ` [PATCH 3/4] usb: dwc2: Add USB DRD support on CV1800 series SoC Inochi Amaoto
2026-11-10 7:06 ` [PATCH 4/4] riscv: dts: sophgo: Enable USB role switch on Huashan PI Inochi Amaoto
2026-11-10 10:41 ` Krzysztof Kozlowski
2026-11-10 11:21 ` Inochi Amaoto
2026-11-13 7:23 ` [PATCH 0/4] usb: dwc2: Add USB DRD support on CV1800 Series SoC Chen-Yu Yeh
2026-11-18 11:36 ` Inochi Amaoto [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=av2M-6w1u5mOyqDM@inochi.infowork \
--to=inochiama@gmail.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=balbi@ti.com \
--cc=chen.wang@linux.dev \
--cc=chenyou910331@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dinguyen@opensource.altera.com \
--cc=dlan@gentoo.org \
--cc=gregkh@linuxfoundation.org \
--cc=hminas@synopsys.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=looong.bin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=paulz@synopsys.com \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=sophgo@lists.linux.dev \
/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®