Merge https://source.denx.de/u-boot/custodians/u-boot-usb
authorTom Rini <trini@konsulko.com>
Wed, 9 Jun 2021 12:20:36 +0000 (08:20 -0400)
committerTom Rini <trini@konsulko.com>
Wed, 9 Jun 2021 12:20:36 +0000 (08:20 -0400)
- dwc2 and cdns3 fixes

drivers/usb/cdns3/cdns3-ti.c
drivers/usb/host/dwc2.c

index 7b205c5..4317167 100644 (file)
@@ -101,7 +101,7 @@ static int cdns_ti_probe(struct udevice *dev)
        if (!data->usbss)
                return -EINVAL;
 
-       ret = clk_get_by_name(dev, "usb2_refclk", &usb2_refclk);
+       ret = clk_get_by_name(dev, "ref", &usb2_refclk);
        if (ret) {
                dev_err(dev, "Failed to get usb2_refclk\n");
                return ret;
index ec643e9..43cc2e0 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/io.h>
 #include <dm/device_compat.h>
 #include <linux/delay.h>
+#include <linux/usb/otg.h>
 #include <power/regulator.h>
 #include <reset.h>
 
@@ -1204,7 +1205,13 @@ static int dwc2_init_common(struct udevice *dev, struct dwc2_priv *priv)
 #endif
 
        dwc_otg_core_init(dev);
-       dwc_otg_core_host_init(dev, regs);
+
+       if (usb_get_dr_mode(dev_ofnode(dev)) == USB_DR_MODE_PERIPHERAL) {
+               dev_dbg(dev, "USB device %s dr_mode set to %d. Skipping host_init.\n",
+                       dev->name, usb_get_dr_mode(dev_ofnode(dev)));
+       } else {
+               dwc_otg_core_host_init(dev, regs);
+       }
 
        clrsetbits_le32(&regs->hprt0, DWC2_HPRT0_PRTENA |
                        DWC2_HPRT0_PRTCONNDET | DWC2_HPRT0_PRTENCHNG |