From: Gregory Herrero Date: Tue, 29 Sep 2015 10:08:19 +0000 (+0200) Subject: usb: dwc2: gadget: don't modify pullup state in host mode X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=77ba9119adc48a0bb890ca121f6b8f09162c9182;p=deliverable%2Flinux.git 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 Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn Signed-off-by: Felipe Balbi --- 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);