[PATCH] usb: cdns3: fix cdns3_bind() to avoid returning error and probe parent
Marek Vasut
marek.vasut at mailbox.org
Tue Apr 21 01:15:01 CEST 2026
On 4/6/26 9:03 AM, Siddharth Vadapalli wrote:
[...]
>> Looking at this one more time, drivers/usb/cdns3/cdns3-ti.c is already
>> UCLASS_NOP , that is the parent driver that you are trying to probe in
>> bind here, right ?
>
> Yes.
>
>>
>> Could you instead flag that cdns3-ti.c with dev_or_flags(dev,
>> DM_FLAG_PROBE_AFTER_BIND); so it would probe early ? Would that
>> resolve this problem too ?
>
> DM_FLAG_PROBE_AFTER_BIND will not fix the issue because:
> 1. cdns3-ti.c registers cdns3_bind() as its .bind() callback.
> 2. cdns3_bind() will be called before the .probe() callback of cdns3-ti.c
> even with DM_FLAG_PROBE_AFTER_BIND
> 3. With cdns3_bind() being called before .probe() of cdns3-ti.c, the USB
> Controller is still Powered OFF.
> I have tested it nevertheless and have confirmed that the issue isn't
> fixed.
>
>>
>> And just a follow up idea, if you were to stop DM scan at DT
>> compatible = "ti,j721e-usb"; in dts/upstream/src/arm64/ti/k3-j784s4-
>> j742s2-main- common.dtsi (i.e. the cdns3 driver wouldn't bind at all),
>> maybe you could make the cdns3-ti.c bind the right driver (peripheral
>> or host) the same way
>
> For cdns3-ti.c to bind the right driver, it still needs to read the OTG
> register when dr_mode is set to otg in the device-tree. This would mean
> that the USB Controller has to be powered ON. Since controller is
> powered ON by cdns_ti_probe (.probe callback of cdns3-ti.c), a
> different .bind callback in cdns3-ti.c will still not fix the issue.
>
>> e.g. block device partitions or USB devices are bound during 'mmc
>> rescan' or 'usb reset' . All those devices are instantiated after the
>> initial DM scan and after the controller to which they are attached
>> has been probed. This might be the way to avoid probe in bind too ?
>
> The device-tree node layout and the corresponding drivers / callbacks
> are as follows:
>
> usbss0: usb at 4104000 {
> compatible = "ti,j721e-usb"; => cdns3-ti.c driver
> [...]
> usb0: usb at 6000000 {
> compatible = "cdns,usb3";
> [...]
> };
> };
>
> First, the cdns3-ti.c driver's .bind callback is invoked. Since cdns3-
> ti.c registered cdns3_bind() as the .bind callback, cdns3_bind() is
> invoked before the .probe callback of cdns3-ti.c driver is invoked. As a
> result,
> the USB Controller is still powered OFF for non-USB Boot Modes when
> cdns3_bind() executes.
How about your remove the U_BOOT_DRIVER(cdns_ti) .bind callback altogether ?
First, remove the .bind callback, let the U_BOOT_DRIVER(cdns_ti) bind to
node usb at 4104000 and probe, and therefore power on the controller. Then
you can read out the Vbus/OTG state, right ?
Second, once you have the OTG mode figured out, call device_bind*() on
potentially new U_BOOT_DRIVER(cdns_ti_something) which contains the
.bind callback, which would let you proceed with binding of the cdns
driver. But now you could also use device_bind_with_driver_data() and
even pass the OTG mode to it that way.
What do you think ?
More information about the U-Boot
mailing list