usb: dwc3: gadget: stop gadget even if fail to stop ctrl
authorWu Liang feng <wulf@rock-chips.com>
Thu, 25 Aug 2016 12:08:00 +0000 (20:08 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 1 Sep 2016 03:58:40 +0000 (11:58 +0800)
In dwc3_gadget_suspend(), if fail to stop DWC3 controller,
and return without do __dwc3_gadget_stop(), it will not
disable ep0 and ep1, and the dep->flags stays in the state
DWC3_EP_ENABLED, this will casue gadget connect failed.

A typical case is:
DWC3 works as DRD mode, fist plug in OTG HOST cable and
works as HOST mode, then plug out HOST calbe, after this
operation, it will do runtime supend -> dwc3_gadget_suspend()
-> dwc3_gadget_run_stop() fail -> return without stop gadget,
and then plug in OTG device cable, fail to connect with PC.

Change-Id: I79daff8a9e8175cd13ac57e2abc63d4e5f694b1c
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
drivers/usb/dwc3/gadget.c

index 9bddcd27005ebb8d633d69b19c6c404d0fcc7613..4842f934e9d52836b72a6692008e87d9bcc4ab42 100644 (file)
@@ -3084,7 +3084,7 @@ int dwc3_gadget_suspend(struct dwc3 *dwc)
 
        ret = dwc3_gadget_run_stop(dwc, false, false);
        if (ret < 0)
-               return ret;
+               dev_err(dwc->dev, "dwc3 gadget stop timeout\n");
 
        dwc3_disconnect_gadget(dwc);
        __dwc3_gadget_stop(dwc);