aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/dwc2/gadget.c')
-rw-r--r--drivers/usb/dwc2/gadget.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 8e98b4df9b10..1e46005929e4 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -380,7 +380,7 @@ static void dwc2_hsotg_unmap_dma(struct dwc2_hsotg *hsotg,
380{ 380{
381 struct usb_request *req = &hs_req->req; 381 struct usb_request *req = &hs_req->req;
382 382
383 usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->dir_in); 383 usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->map_dir);
384} 384}
385 385
386/* 386/*
@@ -1163,6 +1163,7 @@ static int dwc2_hsotg_map_dma(struct dwc2_hsotg *hsotg,
1163{ 1163{
1164 int ret; 1164 int ret;
1165 1165
1166 hs_ep->map_dir = hs_ep->dir_in;
1166 ret = usb_gadget_map_request(&hsotg->gadget, req, hs_ep->dir_in); 1167 ret = usb_gadget_map_request(&hsotg->gadget, req, hs_ep->dir_in);
1167 if (ret) 1168 if (ret)
1168 goto dma_error; 1169 goto dma_error;
@@ -1453,7 +1454,6 @@ static void dwc2_hsotg_complete_oursetup(struct usb_ep *ep,
1453static struct dwc2_hsotg_ep *ep_from_windex(struct dwc2_hsotg *hsotg, 1454static struct dwc2_hsotg_ep *ep_from_windex(struct dwc2_hsotg *hsotg,
1454 u32 windex) 1455 u32 windex)
1455{ 1456{
1456 struct dwc2_hsotg_ep *ep;
1457 int dir = (windex & USB_DIR_IN) ? 1 : 0; 1457 int dir = (windex & USB_DIR_IN) ? 1 : 0;
1458 int idx = windex & 0x7F; 1458 int idx = windex & 0x7F;
1459 1459
@@ -1463,12 +1463,7 @@ static struct dwc2_hsotg_ep *ep_from_windex(struct dwc2_hsotg *hsotg,
1463 if (idx > hsotg->num_of_eps) 1463 if (idx > hsotg->num_of_eps)
1464 return NULL; 1464 return NULL;
1465 1465
1466 ep = index_to_ep(hsotg, idx, dir); 1466 return index_to_ep(hsotg, idx, dir);
1467
1468 if (idx && ep->dir_in != dir)
1469 return NULL;
1470
1471 return ep;
1472} 1467}
1473 1468
1474/** 1469/**
@@ -2650,12 +2645,14 @@ static void dwc2_hsotg_complete_in(struct dwc2_hsotg *hsotg,
2650 return; 2645 return;
2651 } 2646 }
2652 2647
2653 /* Zlp for all endpoints, for ep0 only in DATA IN stage */ 2648 /* Zlp for all endpoints in non DDMA, for ep0 only in DATA IN stage */
2654 if (hs_ep->send_zlp) { 2649 if (hs_ep->send_zlp) {
2655 dwc2_hsotg_program_zlp(hsotg, hs_ep);
2656 hs_ep->send_zlp = 0; 2650 hs_ep->send_zlp = 0;
2657 /* transfer will be completed on next complete interrupt */ 2651 if (!using_desc_dma(hsotg)) {
2658 return; 2652 dwc2_hsotg_program_zlp(hsotg, hs_ep);
2653 /* transfer will be completed on next complete interrupt */
2654 return;
2655 }
2659 } 2656 }
2660 2657
2661 if (hs_ep->index == 0 && hsotg->ep0_state == DWC2_EP0_DATA_IN) { 2658 if (hs_ep->index == 0 && hsotg->ep0_state == DWC2_EP0_DATA_IN) {
@@ -2922,9 +2919,7 @@ static void dwc2_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx,
2922 2919
2923 /* In DDMA handle isochronous requests separately */ 2920 /* In DDMA handle isochronous requests separately */
2924 if (using_desc_dma(hsotg) && hs_ep->isochronous) { 2921 if (using_desc_dma(hsotg) && hs_ep->isochronous) {
2925 /* XferCompl set along with BNA */ 2922 dwc2_gadget_complete_isoc_request_ddma(hs_ep);
2926 if (!(ints & DXEPINT_BNAINTR))
2927 dwc2_gadget_complete_isoc_request_ddma(hs_ep);
2928 } else if (dir_in) { 2923 } else if (dir_in) {
2929 /* 2924 /*
2930 * We get OutDone from the FIFO, so we only 2925 * We get OutDone from the FIFO, so we only
@@ -4823,7 +4818,7 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg)
4823 hsotg->gadget.speed = USB_SPEED_UNKNOWN; 4818 hsotg->gadget.speed = USB_SPEED_UNKNOWN;
4824 spin_unlock_irqrestore(&hsotg->lock, flags); 4819 spin_unlock_irqrestore(&hsotg->lock, flags);
4825 4820
4826 for (ep = 0; ep < hsotg->num_of_eps; ep++) { 4821 for (ep = 1; ep < hsotg->num_of_eps; ep++) {
4827 if (hsotg->eps_in[ep]) 4822 if (hsotg->eps_in[ep])
4828 dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep); 4823 dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep);
4829 if (hsotg->eps_out[ep]) 4824 if (hsotg->eps_out[ep])