aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/gadget.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 317fc7d0469..984580a18a3 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -544,7 +544,7 @@ static void dwc3_gadget_ep_free_request(struct usb_ep *ep,
544 * @dep: endpoint for which this request is prepared 544 * @dep: endpoint for which this request is prepared
545 * @req: dwc3_request pointer 545 * @req: dwc3_request pointer
546 */ 546 */
547static int dwc3_prepare_one_trb(struct dwc3_ep *dep, 547static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
548 struct dwc3_request *req, unsigned last) 548 struct dwc3_request *req, unsigned last)
549{ 549{
550 struct dwc3_trb_hw *trb_hw; 550 struct dwc3_trb_hw *trb_hw;
@@ -559,7 +559,7 @@ static int dwc3_prepare_one_trb(struct dwc3_ep *dep,
559 /* Skip the LINK-TRB on ISOC */ 559 /* Skip the LINK-TRB on ISOC */
560 if (((cur_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && 560 if (((cur_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) &&
561 usb_endpoint_xfer_isoc(dep->desc)) 561 usb_endpoint_xfer_isoc(dep->desc))
562 return 0; 562 return;
563 563
564 dwc3_gadget_move_request_queued(req); 564 dwc3_gadget_move_request_queued(req);
565 memset(&trb, 0, sizeof(trb)); 565 memset(&trb, 0, sizeof(trb));
@@ -607,8 +607,6 @@ static int dwc3_prepare_one_trb(struct dwc3_ep *dep,
607 607
608 dwc3_trb_to_hw(&trb, trb_hw); 608 dwc3_trb_to_hw(&trb, trb_hw);
609 req->trb_dma = dwc3_trb_dma_offset(dep, trb_hw); 609 req->trb_dma = dwc3_trb_dma_offset(dep, trb_hw);
610
611 return 0;
612} 610}
613 611
614/* 612/*
@@ -620,10 +618,9 @@ static int dwc3_prepare_one_trb(struct dwc3_ep *dep,
620 * transfers. The functions returns once there are not more TRBs available or 618 * transfers. The functions returns once there are not more TRBs available or
621 * it run out of requests. 619 * it run out of requests.
622 */ 620 */
623static struct dwc3_request *dwc3_prepare_trbs(struct dwc3_ep *dep, 621static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
624 bool starting)
625{ 622{
626 struct dwc3_request *req, *n, *ret = NULL; 623 struct dwc3_request *req, *n;
627 u32 trbs_left; 624 u32 trbs_left;
628 unsigned int last_one = 0; 625 unsigned int last_one = 0;
629 626
@@ -639,7 +636,7 @@ static struct dwc3_request *dwc3_prepare_trbs(struct dwc3_ep *dep,
639 */ 636 */
640 if (!trbs_left) { 637 if (!trbs_left) {
641 if (!starting) 638 if (!starting)
642 return NULL; 639 return;
643 trbs_left = DWC3_TRB_NUM; 640 trbs_left = DWC3_TRB_NUM;
644 /* 641 /*
645 * In case we start from scratch, we queue the ISOC requests 642 * In case we start from scratch, we queue the ISOC requests
@@ -663,7 +660,7 @@ static struct dwc3_request *dwc3_prepare_trbs(struct dwc3_ep *dep,
663 660
664 /* The last TRB is a link TRB, not used for xfer */ 661 /* The last TRB is a link TRB, not used for xfer */
665 if ((trbs_left <= 1) && usb_endpoint_xfer_isoc(dep->desc)) 662 if ((trbs_left <= 1) && usb_endpoint_xfer_isoc(dep->desc))
666 return NULL; 663 return;
667 664
668 list_for_each_entry_safe(req, n, &dep->request_list, list) { 665 list_for_each_entry_safe(req, n, &dep->request_list, list) {
669 trbs_left--; 666 trbs_left--;
@@ -684,11 +681,8 @@ static struct dwc3_request *dwc3_prepare_trbs(struct dwc3_ep *dep,
684 * multiple TRBs handling, use only one TRB at a time. 681 * multiple TRBs handling, use only one TRB at a time.
685 */ 682 */
686 dwc3_prepare_one_trb(dep, req, true); 683 dwc3_prepare_one_trb(dep, req, true);
687 ret = req;
688 break; 684 break;
689 } 685 }
690
691 return ret;
692} 686}
693 687
694static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param, 688static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param,
@@ -717,11 +711,13 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param,
717 /* req points to the first request which will be sent */ 711 /* req points to the first request which will be sent */
718 req = next_request(&dep->req_queued); 712 req = next_request(&dep->req_queued);
719 } else { 713 } else {
714 dwc3_prepare_trbs(dep, start_new);
715
720 /* 716 /*
721 * req points to the first request where HWO changed 717 * req points to the first request where HWO changed
722 * from 0 to 1 718 * from 0 to 1
723 */ 719 */
724 req = dwc3_prepare_trbs(dep, start_new); 720 req = next_request(&dep->req_queued);
725 } 721 }
726 if (!req) { 722 if (!req) {
727 dep->flags |= DWC3_EP_PENDING_REQUEST; 723 dep->flags |= DWC3_EP_PENDING_REQUEST;