FROMLIST: usb: dwc2: resume root hub to handle disconnect of device
authorWilliam Wu <william.wu@rock-chips.com>
Sat, 27 May 2017 03:23:36 +0000 (11:23 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 31 May 2017 01:47:25 +0000 (09:47 +0800)
When handle disconnect of the hcd during bus_suspend, hcd
needs to resume its root hub, otherwise the root hub will
not disconnect the existing devices under its port.

This issue always happens when connecting with usb devices
which support auto-suspend function (e.g. usb hub).

(am from https://patchwork.kernel.org/patch/9751469/)
Change-Id: I663fdea73f36e89130d9a250612363968cbff941
Signed-off-by: William Wu <william.wu@rock-chips.com>
drivers/usb/dwc2/hcd.c

index 2df3d04d26f5687b9bb84499b0ec55648a0f45a0..3ed5d3398831de11428a5c58dac35da863c52aaf 100644 (file)
@@ -1928,11 +1928,13 @@ void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg, bool force)
         * Without the extra check here we will end calling disconnect
         * and won't get any future interrupts to handle the connect.
         */
-       if (!force) {
-               hprt0 = dwc2_readl(hsotg->regs + HPRT0);
-               if (!(hprt0 & HPRT0_CONNDET) && (hprt0 & HPRT0_CONNSTS))
-                       dwc2_hcd_connect(hsotg);
-       }
+       hprt0 = dwc2_readl(hsotg->regs + HPRT0);
+
+       if (!force && !(hprt0 & HPRT0_CONNDET) &&
+           (hprt0 & HPRT0_CONNSTS))
+               dwc2_hcd_connect(hsotg);
+       else if (hsotg->lx_state != DWC2_L0)
+               usb_hcd_resume_root_hub(hsotg->priv);
 }
 
 /**