Commit 7fdca766 authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: gadget: simplify __dwc3_gadget_kick_transfer() prototype

Now that all the information we need sits in struct dwc3_ep, we can
start taking only a pointer to struct dwc3_ep as an argument. This
allows us to clean the code up a bit.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 502a37b9
...@@ -1191,7 +1191,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep) ...@@ -1191,7 +1191,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep)
} }
} }
static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param) static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
{ {
struct dwc3_gadget_ep_cmd_params params; struct dwc3_gadget_ep_cmd_params params;
struct dwc3_request *req; struct dwc3_request *req;
...@@ -1216,8 +1216,10 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param) ...@@ -1216,8 +1216,10 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param)
if (starting) { if (starting) {
params.param0 = upper_32_bits(req->trb_dma); params.param0 = upper_32_bits(req->trb_dma);
params.param1 = lower_32_bits(req->trb_dma); params.param1 = lower_32_bits(req->trb_dma);
cmd = DWC3_DEPCMD_STARTTRANSFER | cmd = DWC3_DEPCMD_STARTTRANSFER;
DWC3_DEPCMD_PARAM(cmd_param);
if (usb_endpoint_xfer_isoc(dep->endpoint.desc))
cmd |= DWC3_DEPCMD_PARAM(dep->frame_number);
} else { } else {
cmd = DWC3_DEPCMD_UPDATETRANSFER | cmd = DWC3_DEPCMD_UPDATETRANSFER |
DWC3_DEPCMD_PARAM(dep->resource_index); DWC3_DEPCMD_PARAM(dep->resource_index);
...@@ -1270,7 +1272,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3 *dwc, ...@@ -1270,7 +1272,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3 *dwc,
* least 4 microframes. * least 4 microframes.
*/ */
dep->frame_number = cur_uf + max_t(u32, 4, dep->interval); dep->frame_number = cur_uf + max_t(u32, 4, dep->interval);
__dwc3_gadget_kick_transfer(dep, dep->frame_number); __dwc3_gadget_kick_transfer(dep);
} }
static void dwc3_gadget_start_isoc(struct dwc3 *dwc, static void dwc3_gadget_start_isoc(struct dwc3 *dwc,
...@@ -1340,7 +1342,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) ...@@ -1340,7 +1342,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
} }
out: out:
return __dwc3_gadget_kick_transfer(dep, 0); return __dwc3_gadget_kick_transfer(dep);
} }
static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request, static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
...@@ -2333,7 +2335,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, ...@@ -2333,7 +2335,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
req->request.actual = length - req->remaining; req->request.actual = length - req->remaining;
if ((req->request.actual < length) && req->num_pending_sgs) if ((req->request.actual < length) && req->num_pending_sgs)
return __dwc3_gadget_kick_transfer(dep, 0); return __dwc3_gadget_kick_transfer(dep);
dwc3_gadget_giveback(dep, req, status); dwc3_gadget_giveback(dep, req, status);
...@@ -2426,13 +2428,8 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc, ...@@ -2426,13 +2428,8 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc,
if (!dep->endpoint.desc) if (!dep->endpoint.desc)
return; return;
if (!usb_endpoint_xfer_isoc(dep->endpoint.desc)) { if (!usb_endpoint_xfer_isoc(dep->endpoint.desc))
int ret; __dwc3_gadget_kick_transfer(dep);
ret = __dwc3_gadget_kick_transfer(dep, 0);
if (!ret || ret == -EBUSY)
return;
}
} }
static void dwc3_endpoint_interrupt(struct dwc3 *dwc, static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
...@@ -2473,15 +2470,10 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, ...@@ -2473,15 +2470,10 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
dwc3_endpoint_transfer_complete(dwc, dep, event); dwc3_endpoint_transfer_complete(dwc, dep, event);
break; break;
case DWC3_DEPEVT_XFERNOTREADY: case DWC3_DEPEVT_XFERNOTREADY:
if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { if (usb_endpoint_xfer_isoc(dep->endpoint.desc))
dwc3_gadget_start_isoc(dwc, dep, event); dwc3_gadget_start_isoc(dwc, dep, event);
} else { else
int ret; __dwc3_gadget_kick_transfer(dep);
ret = __dwc3_gadget_kick_transfer(dep, 0);
if (!ret || ret == -EBUSY)
return;
}
break; break;
case DWC3_DEPEVT_STREAMEVT: case DWC3_DEPEVT_STREAMEVT:
......
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