Some controllers need to have external power supplied before toggling
the internal PORT_POWER bit.

Fixes: 11a7e5940514 (usb: ehci: add ehci_port_power interface) on i.MX51
where the controller would hang the machine when trying to enable PORT_POWER.

Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
Cc: sta...@vger.kernel.org [3.18+]
---
 drivers/usb/host/ehci-hub.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 118edb7bdca2..aad5b3b32d0e 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -1306,13 +1306,13 @@ static int ehci_port_power(struct ehci_hcd *ehci, int 
portnum, bool enable)
        u32 __iomem *status_reg = &ehci->regs->port_status[portnum];
        u32 temp = ehci_readl(ehci, status_reg) & ~PORT_RWC_BITS;
 
+       if (hcd->driver->port_power)
+                       hcd->driver->port_power(hcd, portnum, enable);
+
        if (enable)
                ehci_writel(ehci, temp | PORT_POWER, status_reg);
        else
                ehci_writel(ehci, temp & ~PORT_POWER, status_reg);
 
-       if (hcd->driver->port_power)
-               hcd->driver->port_power(hcd, portnum, enable);
-
        return 0;
 }
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to