diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2011-10-18 19:13:29 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-12-12 10:48:21 +0100 |
commit | 8ee6270c7f0aeba07355eee82d687efcd8ca9d39 (patch) | |
tree | 8ec4379f26fbfe5c25ab80e4fbb1069419ccaf5b /drivers/usb/dwc3/ep0.c | |
parent | usb: dwc3: reset pending status flag in error case (diff) | |
download | linux-8ee6270c7f0aeba07355eee82d687efcd8ca9d39.tar.xz linux-8ee6270c7f0aeba07355eee82d687efcd8ca9d39.zip |
usb: dwc3: remove special status request handling in ep0
The GetStatus (STD)-request is handled the driver and uses a tiny hack
to send the two bytes long answer. This patch removes the custom hack
uses the normal usb_ep_queue() for that.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/ep0.c')
-rw-r--r-- | drivers/usb/dwc3/ep0.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 900627cf8603..13c898b4cc1d 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -191,8 +191,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, /* we share one TRB for ep0/1 */ if (!list_empty(&dwc->eps[0]->request_list) || - !list_empty(&dwc->eps[1]->request_list) || - dwc->ep0_status_pending) { + !list_empty(&dwc->eps[1]->request_list)) { ret = -EBUSY; goto out; } @@ -224,7 +223,6 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) dwc3_gadget_giveback(dep, req, -ECONNRESET); } - dwc->ep0_status_pending = 0; dwc->ep0state = EP0_SETUP_PHASE; dwc3_ep0_out_start(dwc); } @@ -255,13 +253,9 @@ static struct dwc3_ep *dwc3_wIndex_to_dep(struct dwc3 *dwc, __le16 wIndex_le) return NULL; } -static void dwc3_ep0_send_status_response(struct dwc3 *dwc) +static void dwc3_ep0_status_cmpl(struct usb_ep *ep, struct usb_request *req) { - dwc3_ep0_start_trans(dwc, 1, dwc->setup_buf_addr, - dwc->ep0_usb_req.length, - DWC3_TRBCTL_CONTROL_DATA); } - /* * ch 9.4.5 */ @@ -304,9 +298,10 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl response_pkt = (__le16 *) dwc->setup_buf; *response_pkt = cpu_to_le16(usb_status); dwc->ep0_usb_req.length = sizeof(*response_pkt); - dwc->ep0_status_pending = 1; - - return 0; + dwc->ep0_usb_req.dma = dwc->setup_buf_addr; + dwc->ep0_usb_req.complete = dwc3_ep0_status_cmpl; + return usb_ep_queue(&dwc->eps[1]->endpoint, &dwc->ep0_usb_req, + GFP_ATOMIC); } static int dwc3_ep0_handle_feature(struct dwc3 *dwc, @@ -567,13 +562,8 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; - if (!dwc->ep0_status_pending) { - r = next_request(&dwc->eps[0]->request_list); - ur = &r->request; - } else { - ur = &dwc->ep0_usb_req; - dwc->ep0_status_pending = 0; - } + r = next_request(&dwc->eps[0]->request_list); + ur = &r->request; dwc3_trb_to_nat(dwc->ep0_trb, &trb); @@ -665,11 +655,6 @@ static void dwc3_ep0_do_control_data(struct dwc3 *dwc, dep = dwc->eps[0]; dwc->ep0state = EP0_DATA_PHASE; - if (dwc->ep0_status_pending) { - dwc3_ep0_send_status_response(dwc); - return; - } - if (list_empty(&dep->request_list)) { dev_vdbg(dwc->dev, "pending request for EP0 Data phase\n"); dep->flags |= DWC3_EP_PENDING_REQUEST; |