rk: revert 20f3d0b+v3.0.66 to v3.0
[firefly-linux-kernel-4.4.55.git] / drivers / usb / host / ehci-hub.c
index f5d7fed4a4c0d728ece11c7678091d7bb3b5fd28..ea6184bf48d05d2730e899b901201bec985e11b3 100644 (file)
@@ -343,7 +343,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
        u32                     temp;
        u32                     power_okay;
        int                     i;
-       unsigned long           resume_needed = 0;
+       u8                      resume_needed = 0;
 
        if (time_before (jiffies, ehci->next_statechange))
                msleep(5);
@@ -416,7 +416,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
                if (test_bit(i, &ehci->bus_suspended) &&
                                (temp & PORT_SUSPEND)) {
                        temp |= PORT_RESUME;
-                       set_bit(i, &resume_needed);
+                       resume_needed = 1;
                }
                ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
        }
@@ -431,7 +431,8 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
        i = HCS_N_PORTS (ehci->hcs_params);
        while (i--) {
                temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
-               if (test_bit(i, &resume_needed)) {
+               if (test_bit(i, &ehci->bus_suspended) &&
+                               (temp & PORT_SUSPEND)) {
                        temp &= ~(PORT_RWC_BITS | PORT_RESUME);
                        ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
                        ehci_vdbg (ehci, "resumed port %d\n", i + 1);
@@ -890,11 +891,10 @@ static int ehci_hub_control (
                         * power switching; they're allowed to just limit the
                         * current.  khubd will turn the power back on.
                         */
-                       if ((temp & PORT_OC) && HCS_PPC(ehci->hcs_params)) {
+                       if (HCS_PPC (ehci->hcs_params)){
                                ehci_writel(ehci,
                                        temp & ~(PORT_RWC_BITS | PORT_POWER),
                                        status_reg);
-                               temp = ehci_readl(ehci, status_reg);
                        }
                }
 
@@ -1120,19 +1120,7 @@ static int ehci_hub_control (
                        if (!selector || selector > 5)
                                goto error;
                        ehci_quiesce(ehci);
-
-                       /* Put all enabled ports into suspend */
-                       while (ports--) {
-                               u32 __iomem *sreg =
-                                               &ehci->regs->port_status[ports];
-
-                               temp = ehci_readl(ehci, sreg) & ~PORT_RWC_BITS;
-                               if (temp & PORT_PE)
-                                       ehci_writel(ehci, temp | PORT_SUSPEND,
-                                                       sreg);
-                       }
                        ehci_halt(ehci);
-                       temp = ehci_readl(ehci, status_reg);
                        temp |= selector << 16;
                        ehci_writel(ehci, temp, status_reg);
                        break;