aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/ep0.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-10-20 13:04:16 -0400
committerFelipe Balbi <balbi@ti.com>2011-12-12 04:48:25 -0500
commitc2da2ff00606ae008f0e233bd29c3307d0c3ce85 (patch)
treedae0f51cbc09d667eb7e477e52897cfeb401a62a /drivers/usb/dwc3/ep0.c
parent1e7618d8a1ad7aac6904c3a3915bf63f411344c2 (diff)
usb: dwc3: ep0: don't use ep0in for transfers
In "usb: dwc3: remove special status request handling in ep0" I simplied a few things and used the generic API for the status transfers. The bug I introcuded here is that we queue now requests to dep[1] but we don't clear that list in the stall+start case. Actually we don't need to use dep[1] at all. We only did in the past to talk to the correct endpoint (i.e. in or out). This is now take care of in a diffent place within the ep0 code. So we could queue the in transfers to dep[0] and don't use dep[1] at all. 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.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 7760d00cb902..7da25e181889 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -190,8 +190,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
190 } 190 }
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(&dep->request_list)) {
194 !list_empty(&dwc->eps[1]->request_list)) {
195 ret = -EBUSY; 194 ret = -EBUSY;
196 goto out; 195 goto out;
197 } 196 }
@@ -213,8 +212,8 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
213 struct dwc3_ep *dep = dwc->eps[0]; 212 struct dwc3_ep *dep = dwc->eps[0];
214 213
215 /* stall is always issued on EP0 */ 214 /* stall is always issued on EP0 */
216 __dwc3_gadget_ep_set_halt(dwc->eps[0], 1); 215 __dwc3_gadget_ep_set_halt(dep, 1);
217 dwc->eps[0]->flags = DWC3_EP_ENABLED; 216 dep->flags = DWC3_EP_ENABLED;
218 217
219 if (!list_empty(&dep->request_list)) { 218 if (!list_empty(&dep->request_list)) {
220 struct dwc3_request *req; 219 struct dwc3_request *req;
@@ -300,7 +299,7 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl
300 dwc->ep0_usb_req.length = sizeof(*response_pkt); 299 dwc->ep0_usb_req.length = sizeof(*response_pkt);
301 dwc->ep0_usb_req.dma = dwc->setup_buf_addr; 300 dwc->ep0_usb_req.dma = dwc->setup_buf_addr;
302 dwc->ep0_usb_req.complete = dwc3_ep0_status_cmpl; 301 dwc->ep0_usb_req.complete = dwc3_ep0_status_cmpl;
303 return usb_ep_queue(&dwc->eps[1]->endpoint, &dwc->ep0_usb_req, 302 return usb_ep_queue(&dwc->eps[0]->endpoint, &dwc->ep0_usb_req,
304 GFP_ATOMIC); 303 GFP_ATOMIC);
305} 304}
306 305
@@ -552,22 +551,21 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
552 struct dwc3_request *r = NULL; 551 struct dwc3_request *r = NULL;
553 struct usb_request *ur; 552 struct usb_request *ur;
554 struct dwc3_trb trb; 553 struct dwc3_trb trb;
555 struct dwc3_ep *dep; 554 struct dwc3_ep *ep0;
556 u32 transferred; 555 u32 transferred;
557 u8 epnum; 556 u8 epnum;
558 557
559 epnum = event->endpoint_number; 558 epnum = event->endpoint_number;
560 dep = dwc->eps[epnum]; 559 ep0 = dwc->eps[0];
561 560
562 dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; 561 dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS;
563 562
564 r = next_request(&dwc->eps[0]->request_list); 563 r = next_request(&ep0->request_list);
565 ur = &r->request; 564 ur = &r->request;
566 565
567 dwc3_trb_to_nat(dwc->ep0_trb, &trb); 566 dwc3_trb_to_nat(dwc->ep0_trb, &trb);
568 567
569 if (dwc->ep0_bounced) { 568 if (dwc->ep0_bounced) {
570 struct dwc3_ep *ep0 = dwc->eps[0];
571 569
572 transferred = min_t(u32, ur->length, 570 transferred = min_t(u32, ur->length,
573 ep0->endpoint.maxpacket - trb.length); 571 ep0->endpoint.maxpacket - trb.length);
@@ -588,7 +586,7 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
588 * seems to be case when req.length > maxpacket. Could it be? 586 * seems to be case when req.length > maxpacket. Could it be?
589 */ 587 */
590 if (r) 588 if (r)
591 dwc3_gadget_giveback(dep, r, 0); 589 dwc3_gadget_giveback(ep0, r, 0);
592 } 590 }
593} 591}
594 592