diff options
author | Felipe Balbi <balbi@ti.com> | 2011-12-08 11:56:27 (GMT) |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-12-12 09:48:47 (GMT) |
commit | 68d3e668d245bb8300c7c6ddbc8508ddfe352e0f (patch) | |
tree | 544c200d4c45a2755cad9e711aac70a9bfa1d4a2 | |
parent | c90bfaece97c18d1ad66b9d4c717b1cb55a647ad (diff) | |
download | linux-68d3e668d245bb8300c7c6ddbc8508ddfe352e0f.tar.xz |
usb: dwc3: ep0: fix for possible early delayed_status
There is a very small possibility (previously unimagined
by us) that the whole Mass Storage delayed status happens
rather early, before we even get our XferNotReady event.
In that case, we will be queueing a request to ep0 while
we're still on Setup Phase and we would be waiting for
another usb_ep_queue() forever.
Handle such cases by clearing dwc->delayed_status so that
we start control status from the next XferNotReady like
there was no wait for Delayed Status.
Tested against Linux 3.2-rc3 and USB30CV tool from USB-IF
(on a Windows XP with USB3 PCIe card).
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/dwc3/ep0.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index d6bfc73..2f51de5 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -165,10 +165,13 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep, req->request.dma, req->request.length, type); dep->flags &= ~(DWC3_EP_PENDING_REQUEST | DWC3_EP0_DIR_IN); - - } else if (dwc->delayed_status && (dwc->ep0state == EP0_STATUS_PHASE)) { + } else if (dwc->delayed_status) { dwc->delayed_status = false; - dwc3_ep0_do_control_status(dwc, 1); + + if (dwc->ep0state == EP0_STATUS_PHASE) + dwc3_ep0_do_control_status(dwc, 1); + else + dev_dbg(dwc->dev, "too early for delayed status\n"); } return ret; |