usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tue, 21 Feb 2017 10:59:48 +0000 (19:59 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2017 04:24:49 +0000 (13:24 +0900)
This patch fixes an issue that a usb 1.1 device is not connected in
system resume and then the following message appeared if debug messages
are enabled:
usb 2-1: Waited 2000ms for CONNECT

To resolve this issue, the EHCI controller must be resumed after its
companion controllers. So, this patch adds such code on the driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ehci-platform.c

index a268d9e8d6cfb17b214278e23c44267cf8c06e33..3214300396a0d7d7506e36c9e49f9e1a3988c061 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include <linux/usb/ehci_pdriver.h>
+#include <linux/usb/of.h>
 
 #include "ehci.h"
 
@@ -297,6 +298,7 @@ static int ehci_platform_probe(struct platform_device *dev)
                goto err_power;
 
        device_wakeup_enable(hcd->self.controller);
+       device_enable_async_suspend(hcd->self.controller);
        platform_set_drvdata(dev, hcd);
 
        return err;
@@ -370,6 +372,7 @@ static int ehci_platform_resume(struct device *dev)
        struct usb_ehci_pdata *pdata = dev_get_platdata(dev);
        struct platform_device *pdev = to_platform_device(dev);
        struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
+       struct device *companion_dev;
 
        if (pdata->power_on) {
                int err = pdata->power_on(pdev);
@@ -377,6 +380,10 @@ static int ehci_platform_resume(struct device *dev)
                        return err;
        }
 
+       companion_dev = usb_of_get_companion_dev(hcd->self.controller);
+       if (companion_dev)
+               device_pm_wait_for_dev(hcd->self.controller, companion_dev);
+
        ehci_resume(hcd, priv->reset_on_resume);
        return 0;
 }