aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen Yu <[email protected]>2017-01-23 14:59:57 -0800
committerFelipe Balbi <[email protected]>2017-01-24 16:19:09 +0200
commit9156a7ef1c3ba482f85f2733edcde2b10189de8c (patch)
tree219460a6883bb17bfe567f892014df04954ff534
parentfc30c4bb44a3665edcc76bd7af93f009bc9dc672 (diff)
usb: dwc2: Force port resume on switching to device mode
We've seen failures when switching between host and gadget mode, which was diagnosed as being caused due to the bus being auto-suspended when we switched. So this patch forces a port resume when switching to device mode if the bus is suspended. Cc: Wei Xu <[email protected]> Cc: Guodong Xu <[email protected]> Cc: Amit Pundir <[email protected]> Cc: Rob Herring <[email protected]> Cc: John Youn <[email protected]> Cc: Douglas Anderson <[email protected]> Cc: Chen Yu <[email protected]> Cc: Vardan Mikayelyan <[email protected]> Cc: Kishon Vijay Abraham I <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: [email protected] Signed-off-by: Chen Yu <[email protected]> Signed-off-by: John Stultz <[email protected]> Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
-rw-r--r--drivers/usb/dwc2/hcd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index e0d152f2c81b..1f670c3429a6 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -54,6 +54,8 @@
#include "core.h"
#include "hcd.h"
+static void dwc2_port_resume(struct dwc2_hsotg *hsotg);
+
/*
* =========================================================================
* Host Core Layer Functions
@@ -3231,6 +3233,11 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
if (gotgctl & GOTGCTL_CONID_B) {
/* Wait for switch to device mode */
dev_dbg(hsotg->dev, "connId B\n");
+ if (hsotg->bus_suspended) {
+ dev_info(hsotg->dev,
+ "Do port resume before switching to device mode\n");
+ dwc2_port_resume(hsotg);
+ }
while (!dwc2_is_device_mode(hsotg)) {
dev_info(hsotg->dev,
"Waiting for Peripheral Mode, Mode=%s\n",