Search code examples
kerneldriveru-boot

usb stick detected in userspace but not detected by u-boot


I need that u-boot recognize my USB stick when i plug it to my custom board based on iMX8M plus. In my linux userspace USB stick is recognized.

When i type usb start the following error is displayed:

u-boot=> usb start
starting USB...
Bus dwc3@38100000: probe failed, error -110
Bus dwc3@38200000: probe failed, error -110
No working controllers found

I found that the error above was in this file : drivers/usb/host/usb-uclass.c

Basically inside usb_init function we have the following bloc of code:

        ret = device_probe(bus);
        if (ret == -ENODEV) {   /* No such device. */
                puts("Port not available.\n");
                controllers_initialized++;
                continue;
        }

        if (ret) {              /* Other error. */
                printf("probe failed, error %d\n", ret); // THIS IS THE ERROR DISPLAYED 
                continue;
        }
        controllers_initialized++;
        usb_started = true;
}

...

/* if we were not able to find at least one working bus, bail out */
if (controllers_initialized == 0)
        printf("No working controllers found\n"); // THIS IS THE ERROR DISPLAYED

return usb_started ? 0 : -1;

So far i managed to fix my device tree: some node related to USB function were commented: vbus-power-supply and some node to USB Integrated Circuits such as CBTL04GP and ptn5110.

I also checked arch/arm/dts/imx8mp.dtsi I noted that the driver (phy-fsl-imx8mq-usb.c ) of the following node is absent from my uboot sources but is present in kernel sources tree:

            usb3_phy0: usb-phy@381f0040 {
                    compatible = "fsl,imx8mp-usb-phy";
                    reg = <0x381f0040 0x40>;
                    clocks = <&clk IMX8MP_CLK_USB_PHY_ROOT>;
                    clock-names = "phy";
                    assigned-clocks = <&clk IMX8MP_CLK_USB_PHY_REF>;
                    assigned-clock-parents = <&clk IMX8MP_CLK_24M>;
                    #phy-cells = <0>;
                    status = "disabled";
            };

When i remove this driver from my kernel sources. My usb sticks is no more recognized in userspace.

Should I try to implement this driver in my uboot sources despite header inclusion hell ?


Solution

  • I had to implement this driver phy-imx8mq-usb.c Then i had to configure the corresponding 24Mhz clock described in device tree in the following filedrivers/clk/imx/clk-imx8mp.c as below:

    clk_dm(IMX8MP_CLK_24M, dev_get_clk_ptr(osc_24m_clk.dev));