Commit b992e681 authored by Paul Zimmerman's avatar Paul Zimmerman Committed by Felipe Balbi

usb: dwc3: gadget: add 'force' argument to stop_active_transfer

It's not always we need to force a transfer to be removed
from the core's internal cache. This extra argument will
help differentiating those two cases.
Signed-off-by: default avatarPaul Zimmerman <paulz@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 356363bf
...@@ -570,13 +570,13 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, ...@@ -570,13 +570,13 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep,
return 0; return 0;
} }
static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum); static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum, bool force);
static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep) static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
{ {
struct dwc3_request *req; struct dwc3_request *req;
if (!list_empty(&dep->req_queued)) { if (!list_empty(&dep->req_queued)) {
dwc3_stop_active_transfer(dwc, dep->number); dwc3_stop_active_transfer(dwc, dep->number, true);
/* - giveback all requests to gadget driver */ /* - giveback all requests to gadget driver */
while (!list_empty(&dep->req_queued)) { while (!list_empty(&dep->req_queued)) {
...@@ -1099,7 +1099,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) ...@@ -1099,7 +1099,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
*/ */
if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
if (list_empty(&dep->req_queued)) { if (list_empty(&dep->req_queued)) {
dwc3_stop_active_transfer(dwc, dep->number); dwc3_stop_active_transfer(dwc, dep->number, true);
dep->flags = DWC3_EP_ENABLED; dep->flags = DWC3_EP_ENABLED;
} }
return 0; return 0;
...@@ -1185,7 +1185,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, ...@@ -1185,7 +1185,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
} }
if (r == req) { if (r == req) {
/* wait until it is processed */ /* wait until it is processed */
dwc3_stop_active_transfer(dwc, dep->number); dwc3_stop_active_transfer(dwc, dep->number, true);
goto out1; goto out1;
} }
dev_err(dwc->dev, "request %p was not queued to %s\n", dev_err(dwc->dev, "request %p was not queued to %s\n",
...@@ -1881,7 +1881,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, ...@@ -1881,7 +1881,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
*/ */
dep->flags = DWC3_EP_PENDING_REQUEST; dep->flags = DWC3_EP_PENDING_REQUEST;
} else { } else {
dwc3_stop_active_transfer(dwc, dep->number); dwc3_stop_active_transfer(dwc, dep->number, true);
dep->flags = DWC3_EP_ENABLED; dep->flags = DWC3_EP_ENABLED;
} }
return 1; return 1;
...@@ -2028,7 +2028,7 @@ static void dwc3_disconnect_gadget(struct dwc3 *dwc) ...@@ -2028,7 +2028,7 @@ static void dwc3_disconnect_gadget(struct dwc3 *dwc)
} }
} }
static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum) static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum, bool force)
{ {
struct dwc3_ep *dep; struct dwc3_ep *dep;
struct dwc3_gadget_ep_cmd_params params; struct dwc3_gadget_ep_cmd_params params;
...@@ -2060,7 +2060,8 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum) ...@@ -2060,7 +2060,8 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum)
*/ */
cmd = DWC3_DEPCMD_ENDTRANSFER; cmd = DWC3_DEPCMD_ENDTRANSFER;
cmd |= DWC3_DEPCMD_HIPRI_FORCERM | DWC3_DEPCMD_CMDIOC; cmd |= force ? DWC3_DEPCMD_HIPRI_FORCERM : 0;
cmd |= DWC3_DEPCMD_CMDIOC;
cmd |= DWC3_DEPCMD_PARAM(dep->resource_index); cmd |= DWC3_DEPCMD_PARAM(dep->resource_index);
memset(&params, 0, sizeof(params)); memset(&params, 0, sizeof(params));
ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, &params); ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, &params);
......
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