On Mon, Sep 14, 2026 at 09:31:25PM +0200, Marek Vasut wrote:
> On 9/14/26 9:42 AM, Stefan Eichenberger wrote:
> > From: Stefan Eichenberger <[email protected]>
> >
> > The i.MX95 SoC has two USB controllers, a DWC3 controller and a ChipIdea
> > controller. However, U-Boot might select a controller that is marked as
> > host only in the device tree when attempting to set up a USB gadget,
> > leading to failures in gadget mode.
> >
> > Iterate over usb devices and skipping any that are marked host-only when
> > selecting the controller for gadget mode. This ensures that a controller
> > that is marked as device or otg is used for USB gadget functionality.
> >
> > Verified on Verdin iMX95 hardware: "ums 0 mmc 0" now correctly flips
> > the ChipIdea OTG controller into device mode and enumerates on the
> > host PC.
>
> What was the previous incorrect behavior ?
When I did a ums 0 mmc 0, the host only DWC3 controller was selected. It
is not host only by itself, but it is marked as host only for our board
in the device tree.
>
> Does your board DT have /aliases { usb0 = &... } entry pointing to the
> chipidea controller already ? The controller indexing should match the
> aliases ordering.
Yes we use aliases. Interstingly the dwc3 controller is usb1 and the
chipidea controller is usb0.
aliases {
...
usb0 = &usb2;
usb1 = &usb3;
...
};
&usb2 {
dr_mode = "otg";
...
};
&usb3 {
...
&usb3_dwc3 {
dr_mode = "host";
};
...
};
So it seems this ordering is not respected when selecting the controller
for gadget mode. I have to test that again. However, I still think host
only devices should never be selected for gadget mode which is what this
patch tries to address. Or should e.g. ums 1 mmc 0 just fail for host
only controllers? In this scenario I assume the ordering is correct so
ums 1 would select the dwc3 host only controller.
Regards,
Stefan