aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/ep0.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/dwc3/ep0.c')
-rw-r--r--drivers/usb/dwc3/ep0.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 900627cf860..13c898b4cc1 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,
191 191
192 /* we share one TRB for ep0/1 */ 192 /* we share one TRB for ep0/1 */
193 if (!list_empty(&dwc->eps[0]->request_list) || 193 if (!list_empty(&dwc->eps[0]->request_list) ||
194 !list_empty(&dwc->eps[1]->request_list) || 194 !list_empty(&dwc->eps[1]->request_list)) {
195 dwc->ep0_status_pending) {
196 ret = -EBUSY; 195 ret = -EBUSY;
197 goto out; 196 goto out;
198 } 197 }
@@ -224,7 +223,6 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
224 dwc3_gadget_giveback(dep, req, -ECONNRESET); 223 dwc3_gadget_giveback(dep, req, -ECONNRESET);
225 } 224 }
226 225
227 dwc->ep0_status_pending = 0;
228 dwc->ep0state = EP0_SETUP_PHASE; 226 dwc->ep0state = EP0_SETUP_PHASE;
229 dwc3_ep0_out_start(dwc); 227 dwc3_ep0_out_start(dwc);
230} 228}
@@ -255,13 +253,9 @@ static struct dwc3_ep *dwc3_wIndex_to_dep(struct dwc3 *dwc, __le16 wIndex_le)
255 return NULL; 253 return NULL;
256} 254}
257 255
258static void dwc3_ep0_send_status_response(struct dwc3 *dwc) 256static void dwc3_ep0_status_cmpl(struct usb_ep *ep, struct usb_request *req)
259{ 257{
260 dwc3_ep0_start_trans(dwc, 1, dwc->setup_buf_addr,
261 dwc->ep0_usb_req.length,
262 DWC3_TRBCTL_CONTROL_DATA);
263} 258}
264
265/* 259/*
266 * ch 9.4.5 260 * ch 9.4.5
267 */ 261 */
@@ -304,9 +298,10 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl
304 response_pkt = (__le16 *) dwc->setup_buf; 298 response_pkt = (__le16 *) dwc->setup_buf;
305 *response_pkt = cpu_to_le16(usb_status); 299 *response_pkt = cpu_to_le16(usb_status);
306 dwc->ep0_usb_req.length = sizeof(*response_pkt); 300 dwc->ep0_usb_req.length = sizeof(*response_pkt);
307 dwc->ep0_status_pending = 1; 301 dwc->ep0_usb_req.dma = dwc->setup_buf_addr;
308 302 dwc->ep0_usb_req.complete = dwc3_ep0_status_cmpl;
309 return 0; 303 return usb_ep_queue(&dwc->eps[1]->endpoint, &dwc->ep0_usb_req,
304 GFP_ATOMIC);
310} 305}
311 306
312static int dwc3_ep0_handle_feature(struct dwc3 *dwc, 307static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
@@ -567,13 +562,8 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
567 562
568 dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; 563 dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS;
569 564
570 if (!dwc->ep0_status_pending) { 565 r = next_request(&dwc->eps[0]->request_list);
571 r = next_request(&dwc->eps[0]->request_list); 566 ur = &r->request;
572 ur = &r->request;
573 } else {
574 ur = &dwc->ep0_usb_req;
575 dwc->ep0_status_pending = 0;
576 }
577 567
578 dwc3_trb_to_nat(dwc->ep0_trb, &trb); 568 dwc3_trb_to_nat(dwc->ep0_trb, &trb);
579 569
@@ -665,11 +655,6 @@ static void dwc3_ep0_do_control_data(struct dwc3 *dwc,
665 dep = dwc->eps[0]; 655 dep = dwc->eps[0];
666 dwc->ep0state = EP0_DATA_PHASE; 656 dwc->ep0state = EP0_DATA_PHASE;
667 657
668 if (dwc->ep0_status_pending) {
669 dwc3_ep0_send_status_response(dwc);
670 return;
671 }
672
673 if (list_empty(&dep->request_list)) { 658 if (list_empty(&dep->request_list)) {
674 dev_vdbg(dwc->dev, "pending request for EP0 Data phase\n"); 659 dev_vdbg(dwc->dev, "pending request for EP0 Data phase\n");
675 dep->flags |= DWC3_EP_PENDING_REQUEST; 660 dep->flags |= DWC3_EP_PENDING_REQUEST;