Merge git://git.denx.de/u-boot-arc
[oweals/u-boot.git] / drivers / usb / host / dwc2.c
index 30b51b3d7f296b1b31cfd3b0937c96ae965d3203..d253b946f334a2fae4cfad5f7a89da60c4433266 100644 (file)
@@ -1088,6 +1088,15 @@ static int dwc2_init_common(struct dwc2_priv *priv)
                }
        }
 
+       /*
+        * Add a 1 second delay here. This gives the host controller
+        * a bit time before the comminucation with the USB devices
+        * is started (the bus is scanned) and  fixes the USB detection
+        * problems with some problematic USB keys.
+        */
+       if (readl(&regs->gintsts) & DWC2_GINTSTS_CURMODE_HOST)
+               mdelay(1000);
+
        return 0;
 }
 
@@ -1190,8 +1199,8 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
        priv->regs = (struct dwc2_core_regs *)addr;
 
-       prop = fdt_getprop(gd->fdt_blob, dev->of_offset, "disable-over-current",
-                          NULL);
+       prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
+                          "disable-over-current", NULL);
        if (prop)
                priv->oc_disable = true;