mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
usb: dwc3: gadget: Disable gadget IRQ during pullup disable
Current sequence utilizes dwc3_gadget_disable_irq() alongside
synchronize_irq() to ensure that no further DWC3 events are generated.
However, the dwc3_gadget_disable_irq() API only disables device
specific events. Endpoint events can still be generated. Briefly
disable the interrupt line, so that the cleanup code can run to
prevent device and endpoint events. (i.e. __dwc3_gadget_stop() and
dwc3_stop_active_transfers() respectively)
Without doing so, it can lead to both the interrupt handler and the
pullup disable routine both writing to the GEVNTCOUNT register, which
will cause an incorrect count being read from future interrupts.
Fixes: ae7e86108b
("usb: dwc3: Stop active transfers before halting the controller")
Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Link: https://lore.kernel.org/r/1621571037-1424-1-git-send-email-wcheng@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8124c8a6b3
commit
8212937305
1 changed files with 5 additions and 6 deletions
|
@ -2261,13 +2261,10 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Synchronize any pending event handling before executing the controller
|
* Synchronize and disable any further event handling while controller
|
||||||
* halt routine.
|
* is being enabled/disabled.
|
||||||
*/
|
*/
|
||||||
if (!is_on) {
|
disable_irq(dwc->irq_gadget);
|
||||||
dwc3_gadget_disable_irq(dwc);
|
|
||||||
synchronize_irq(dwc->irq_gadget);
|
|
||||||
}
|
|
||||||
|
|
||||||
spin_lock_irqsave(&dwc->lock, flags);
|
spin_lock_irqsave(&dwc->lock, flags);
|
||||||
|
|
||||||
|
@ -2305,6 +2302,8 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
|
||||||
|
|
||||||
ret = dwc3_gadget_run_stop(dwc, is_on, false);
|
ret = dwc3_gadget_run_stop(dwc, is_on, false);
|
||||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||||
|
enable_irq(dwc->irq_gadget);
|
||||||
|
|
||||||
pm_runtime_put(dwc->dev);
|
pm_runtime_put(dwc->dev);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue