
On Fri, Dec 06, 2024 at 11:17:28AM +0200, Roger Quadros wrote:
Hello Siddharth,
On 06/12/2024 09:19, Siddharth Vadapalli wrote:
[...]
While this fixes the issue, I am wondering if the issue lies elsewhere. In U-Boot, the compatible "snps,dwc3" is associated with: drivers/usb/host/xhci-dwc3.c while in Linux, the compatible "snps,dwc3" is associated with: drivers/usb/dwc3/core.c
So there seem to be two alternatives that I could think of:
- Modify U-Boot to match Linux in the sense that we associate
"snps,dwc3" with drivers/usb/dwc3/core.c in U-Boot.
Many platforms (grep for CONFIG_USB_XHCI_DWC3 in configs/) use xhci-dwc3 to get Host mode working without the need for core.c. Maybe it was more simpler that way? Also see USB_XHCI_DWC3_OF_SIMPLE.
So if we drop "snps,dwc3" from xhci-dwc3, we will have to ensure each and every platform works.
Yes, that will require significant effort and testing.
- With the understanding that "dr_mode" doesn't have to be host/otg for
the compatible "snps,dwc3" which is tied to drivers/usb/host/xhci-dwc3.c, do the following to exit probe when "dr_mode" is "peripheral":
diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c index e3e0ceff43e..edfd7b97a73 100644 --- a/drivers/usb/host/xhci-dwc3.c +++ b/drivers/usb/host/xhci-dwc3.c @@ -208,6 +208,8 @@ static int xhci_dwc3_probe(struct udevice *dev) writel(reg, &dwc3_reg->g_usb2phycfg[0]);
dr_mode = usb_get_dr_mode(dev_ofnode(dev));
if (dr_mode == USB_DR_MODE_PERIPHERAL)
return -ENODEV; if (dr_mode == USB_DR_MODE_OTG && dev_read_bool(dev, "usb-role-switch")) { dr_mode = usb_get_role_switch_default_mode(dev_ofnode(dev));
which will still show "xhci-dwc3" in the output of "dm tree" after "usb start", but the driver won't be probed (absence of "+" in the "Probed" column of "dm tree" output).
I agree with your second proposal. But it is a separate bug (in xhci-dwc3 driver) which also fixes the issue this patch is fixing.
Regardless, I think both fixes should go in.
Could you please send a patch to fix xhci-dwc3? Thanks!
Sure. Thank you for reviewing the suggestions and sharing your feedback.
Regards, Siddharth.