Commit c2da2ff0 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Felipe Balbi

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: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 1e7618d8
...@@ -190,8 +190,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, ...@@ -190,8 +190,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
} }
/* we share one TRB for ep0/1 */ /* we share one TRB for ep0/1 */
if (!list_empty(&dwc->eps[0]->request_list) || if (!list_empty(&dep->request_list)) {
!list_empty(&dwc->eps[1]->request_list)) {
ret = -EBUSY; ret = -EBUSY;
goto out; goto out;
} }
...@@ -213,8 +212,8 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) ...@@ -213,8 +212,8 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
struct dwc3_ep *dep = dwc->eps[0]; struct dwc3_ep *dep = dwc->eps[0];
/* stall is always issued on EP0 */ /* stall is always issued on EP0 */
__dwc3_gadget_ep_set_halt(dwc->eps[0], 1); __dwc3_gadget_ep_set_halt(dep, 1);
dwc->eps[0]->flags = DWC3_EP_ENABLED; dep->flags = DWC3_EP_ENABLED;
if (!list_empty(&dep->request_list)) { if (!list_empty(&dep->request_list)) {
struct dwc3_request *req; struct dwc3_request *req;
...@@ -300,7 +299,7 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl ...@@ -300,7 +299,7 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl
dwc->ep0_usb_req.length = sizeof(*response_pkt); dwc->ep0_usb_req.length = sizeof(*response_pkt);
dwc->ep0_usb_req.dma = dwc->setup_buf_addr; dwc->ep0_usb_req.dma = dwc->setup_buf_addr;
dwc->ep0_usb_req.complete = dwc3_ep0_status_cmpl; dwc->ep0_usb_req.complete = dwc3_ep0_status_cmpl;
return usb_ep_queue(&dwc->eps[1]->endpoint, &dwc->ep0_usb_req, return usb_ep_queue(&dwc->eps[0]->endpoint, &dwc->ep0_usb_req,
GFP_ATOMIC); GFP_ATOMIC);
} }
...@@ -552,22 +551,21 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, ...@@ -552,22 +551,21 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
struct dwc3_request *r = NULL; struct dwc3_request *r = NULL;
struct usb_request *ur; struct usb_request *ur;
struct dwc3_trb trb; struct dwc3_trb trb;
struct dwc3_ep *dep; struct dwc3_ep *ep0;
u32 transferred; u32 transferred;
u8 epnum; u8 epnum;
epnum = event->endpoint_number; epnum = event->endpoint_number;
dep = dwc->eps[epnum]; ep0 = dwc->eps[0];
dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS;
r = next_request(&dwc->eps[0]->request_list); r = next_request(&ep0->request_list);
ur = &r->request; ur = &r->request;
dwc3_trb_to_nat(dwc->ep0_trb, &trb); dwc3_trb_to_nat(dwc->ep0_trb, &trb);
if (dwc->ep0_bounced) { if (dwc->ep0_bounced) {
struct dwc3_ep *ep0 = dwc->eps[0];
transferred = min_t(u32, ur->length, transferred = min_t(u32, ur->length,
ep0->endpoint.maxpacket - trb.length); ep0->endpoint.maxpacket - trb.length);
...@@ -588,7 +586,7 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, ...@@ -588,7 +586,7 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
* seems to be case when req.length > maxpacket. Could it be? * seems to be case when req.length > maxpacket. Could it be?
*/ */
if (r) if (r)
dwc3_gadget_giveback(dep, r, 0); dwc3_gadget_giveback(ep0, r, 0);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment