summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2
diff options
context:
space:
mode:
authorGregory Herrero <gregory.herrero@intel.com>2015-09-29 12:08:19 +0200
committerFelipe Balbi <balbi@ti.com>2015-10-01 12:40:24 -0500
commit77ba9119adc48a0bb890ca121f6b8f09162c9182 (patch)
treed60f8cbc29173163013da7d639fa85f6583933f7 /drivers/usb/dwc2
parent857512d0ebf838d8a2b600234debdbfc1e97f919 (diff)
downloadlinux-77ba9119adc48a0bb890ca121f6b8f09162c9182.tar.gz
linux-77ba9119adc48a0bb890ca121f6b8f09162c9182.tar.bz2
linux-77ba9119adc48a0bb890ca121f6b8f09162c9182.zip
usb: dwc2: gadget: don't modify pullup state in host mode
Modifying the pullup state during host mode trig a new enumeration of attached device. Thus, avoid modifying pullup in host mode. Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Tested-by: Robert Baldyga <r.baldyga@samsung.com> Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com> Tested-by: John Youn <johnyoun@synopsys.com> Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2')
-rw-r--r--drivers/usb/dwc2/gadget.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 36345ab05f7e..61d102185bf1 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3170,7 +3170,14 @@ static int dwc2_hsotg_pullup(struct usb_gadget *gadget, int is_on)
struct dwc2_hsotg *hsotg = to_hsotg(gadget);
unsigned long flags = 0;
- dev_dbg(hsotg->dev, "%s: is_on: %d\n", __func__, is_on);
+ dev_dbg(hsotg->dev, "%s: is_on: %d op_state: %d\n", __func__, is_on,
+ hsotg->op_state);
+
+ /* Don't modify pullup state while in host mode */
+ if (hsotg->op_state != OTG_STATE_B_PERIPHERAL) {
+ hsotg->enabled = is_on;
+ return 0;
+ }
mutex_lock(&hsotg->init_mutex);
spin_lock_irqsave(&hsotg->lock, flags);