summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWesley Cheng <wcheng@codeaurora.org>2021-03-19 02:31:25 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-23 13:01:11 +0100
commit71ca43f30df9c642970f9dc9b2d6f463f4967e7b (patch)
tree67abf9e67dbc2ec95ee83c781ad70b3bb06d77f7
parent02fa4b980245087a04ea34ae7541ebdc56a5daa4 (diff)
usb: dwc3: gadget: Ignore EP queue requests during bus reset
The current dwc3_gadget_reset_interrupt() will stop any active transfers, but only addresses blocking of EP queuing for while we are coming from a disconnected scenario, i.e. after receiving the disconnect event. If the host decides to issue a bus reset on the device, the connected parameter will still be set to true, allowing for EP queuing to continue while we are disabling the functions. To avoid this, set the connected flag to false until the stop active transfers is complete. Signed-off-by: Wesley Cheng <wcheng@codeaurora.org> Link: https://lore.kernel.org/r/1616146285-19149-3-git-send-email-wcheng@codeaurora.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/dwc3/gadget.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index d366f414d7a7..e1442fc763e1 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -3332,6 +3332,15 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
u32 reg;
/*
+ * Ideally, dwc3_reset_gadget() would trigger the function
+ * drivers to stop any active transfers through ep disable.
+ * However, for functions which defer ep disable, such as mass
+ * storage, we will need to rely on the call to stop active
+ * transfers here, and avoid allowing of request queuing.
+ */
+ dwc->connected = false;
+
+ /*
* WORKAROUND: DWC3 revisions <1.88a have an issue which
* would cause a missing Disconnect Event if there's a
* pending Setup Packet in the FIFO.