]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/usb/host/ehci-hub.c
USB: EHCI: add condition for delay during the resume
[karo-tx-linux.git] / drivers / usb / host / ehci-hub.c
index 914ce9370e70f4a1d9a956ccf50fae9b97973b21..a7ec827ca2ca697344418a58a9dc3d0c27aae316 100644 (file)
@@ -384,11 +384,24 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
        ehci_writel(ehci, ehci->command, &ehci->regs->command);
        ehci->rh_state = EHCI_RH_RUNNING;
 
-       /* Some controller/firmware combinations need a delay during which
-        * they set up the port statuses.  See Bugzilla #8190. */
-       spin_unlock_irq(&ehci->lock);
-       msleep(8);
-       spin_lock_irq(&ehci->lock);
+       /*
+        * According to Bugzilla #8190, the port status for some controllers
+        * will be wrong without a delay. At their wrong status, the port
+        * is enabled, but not suspended neither resumed.
+        */
+       i = HCS_N_PORTS(ehci->hcs_params);
+       while (i--) {
+               temp = ehci_readl(ehci, &ehci->regs->port_status[i]);
+               if ((temp & PORT_PE) &&
+                               !(temp & (PORT_SUSPEND | PORT_RESUME))) {
+                       ehci_dbg(ehci, "Port status(0x%x) is wrong\n", temp);
+                       spin_unlock_irq(&ehci->lock);
+                       msleep(8);
+                       spin_lock_irq(&ehci->lock);
+                       break;
+               }
+       }
+
        if (ehci->shutdown)
                goto shutdown;