aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/dwc2
diff options
context:
space:
mode:
authorGregory Herrero2015-04-29 22:09:08 +0200
committerFelipe Balbi2015-04-29 15:19:19 -0500
commit7ababa926c66c5c5a862489b475ff5d96a7dd03a (patch)
tree8a33132478b56169437201adad16d3d883fddc11 /drivers/usb/dwc2
parent9e779778ad7e503434aa76bfc96f98d7d7b2d139 (diff)
usb: dwc2: gadget: prevent new request submission during suspend
If usb controller is in partial power down, any write to registers may cause unpredictable behavior. Thus, prevent any new request submission once controller is in partial power down. Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2')
-rw-r--r--drivers/usb/dwc2/gadget.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index a360f49d3fd0..732761f9466b 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -790,6 +790,13 @@ static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
ep->name, req, req->length, req->buf, req->no_interrupt,
req->zero, req->short_not_ok);
+ /* Prevent new request submission when controller is suspended */
+ if (hs->lx_state == DWC2_L2) {
+ dev_dbg(hs->dev, "%s: don't submit request while suspended\n",
+ __func__);
+ return -EAGAIN;
+ }
+
/* initialise status of the request */
INIT_LIST_HEAD(&hs_req->queue);
req->actual = 0;