[RFC PATCH v1 0/2] phy: rockchip: inno-usb2: fix USB gadget hot-plug on peripheral-only OTG ports
Manivannan Sadhasivam
mani at kernel.org
Wed Sep 9 09:49:31 PDT 2026
On Tue, Jul 07, 2026 at 12:36:25AM +0200, Andreas Zdziarstek wrote:
> Hi All,
>
> I had an interesting time trying out the USB OTG micro-USB port on the
> Odroid-M1S (Rockchip RK3566) on the mainline Kernel. My intention was to
> set up a cdc_ncm+cdc_acm peripheral gadget as a hot-pluggable debug
> port.
>
> For the most part that went swimmingly. Just not quite with the
> hot-plugging. The apparent first problem was that peripheral mode only
> works if the host is connected at boot time of the RK3566 Kernel,
> regardless if the dr_mode settings is "otg" or "peripheral". When no
> connection is present at boot, gadget setup fails with a
> "failed to enable ep0out" error and the port seems to end up in an
> unrecoverable state afterwards.
>
> I investigated a little as to why. With my very limited understanding
> of the subsystems involved, I think I have identified some problems.
> All seem largely related to each other.
>
> * The M1S references its 5V OTG VBUS switch as phy-supply of the OTG
> port in its DT. The phy core unconditionally enables that on phy
> power_on. From then on it powers its own VBUSDET input, making further
> cable VBUS detection impossible. Also, apparently, after reading the
> schematic, that means even with a cable connected at boot (and
> peripheral mode therefore working), the board will try to back-power
> the host. Seems my host port is pretty robust, luckily.
> * The inno-usb2 driver seems to generally lack DRP power supply VBUS
> switching support? At least PHY and VBUS supply are semantically
> treated the same.
> * The inno-usb2 driver's state machine powers off the Phy in several
> places: on an initial no-VBUS sample, on DCP detection and on
> disconnect. That seems to happen unrelated to controller-initiated
> phy_power_on/off calls and looks like the main cause the gadget setup
> fails and then borks the controller state.
>
> My proposed fixes are in two places:
>
> * set the micro-USB M1S port to "peripheral" in DTS and remove the
> supply node. The board has two USB-A host ports, so device mode is the
> most likely usage scenario for the microUSB and real compliant DRP
> does not seem to be in the cards in the current state. Also, this
> fixes the potentially harmful back-powering issue. (2nd patch)
> * keep the inno-usb2 phy driver from autonomously powering off when in
> peripheral mode. This makes hot-plugging and gadget-setup without a
> connected cable work. (1st patch)
>
I'm not an USB expert, but your proposed fix does cause high power consumption
by keeping PHY always ON even when the cable is not connected.
To fix this issue properly, first I would investigate whether
rockchip_usb2phy_power_on() is called during cable connect or not and also at
the right time i.e., before the DWC3 gadget driver starts to drive the
interface. If there is a race here, it would still cause the interface to be not
up.
- Mani
--
மணிவண்ணன் சதாசிவம்
More information about the Linux-rockchip
mailing list