[PATCH 2/5] usb: dwc3: gadget: start using Update Transfer more often

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We can infer Update Transfer by the fact that
req_queue is empty and DWC3_EP_BUSY isn't set.

This let's us a) rely on Update Transfer more often
(should be good for deeper queue lengths) and b) remove
the extra start_new parameter (done on a follow-up
patch)

Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---
 drivers/usb/dwc3/gadget.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 14cb982235b7..a0d3a4e762c5 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -950,24 +950,20 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param,
 	}
 	dep->flags &= ~DWC3_EP_PENDING_REQUEST;
 
+	cmd = DWC3_DEPCMD_UPDATETRANSFER |
+		DWC3_DEPCMD_PARAM(cmd_param);
+
 	/*
 	 * If we are getting here after a short-out-packet we don't enqueue any
 	 * new requests as we try to set the IOC bit only on the last request.
 	 */
-	if (start_new) {
-		if (list_empty(&dep->req_queued))
-			dwc3_prepare_trbs(dep, start_new);
-
-		/* req points to the first request which will be sent */
-		req = next_request(&dep->req_queued);
-	} else {
+	if (list_empty(&dep->req_queued) &&
+			!(dep->flags & DWC3_EP_BUSY)) {
 		dwc3_prepare_trbs(dep, start_new);
-
-		/*
-		 * req points to the first request where HWO changed from 0 to 1
-		 */
-		req = next_request(&dep->req_queued);
+		cmd = DWC3_DEPCMD_STARTTRANSFER;
 	}
+
+	req = next_request(&dep->req_queued);
 	if (!req) {
 		dep->flags |= DWC3_EP_PENDING_REQUEST;
 		return 0;
@@ -975,15 +971,11 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param,
 
 	memset(&params, 0, sizeof(params));
 
-	if (start_new) {
+	if (cmd == DWC3_DEPCMD_STARTTRANSFER) {
 		params.param0 = upper_32_bits(req->trb_dma);
 		params.param1 = lower_32_bits(req->trb_dma);
-		cmd = DWC3_DEPCMD_STARTTRANSFER;
-	} else {
-		cmd = DWC3_DEPCMD_UPDATETRANSFER;
 	}
 
-	cmd |= DWC3_DEPCMD_PARAM(cmd_param);
 	ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, &params);
 	if (ret < 0) {
 		dev_dbg(dwc->dev, "failed to send STARTTRANSFER command\n");
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux