aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYongqin Liu2020-07-06 10:16:48 -0500
committerPraneeth Bajjuri2020-07-06 22:30:39 -0500
commitc7b1c81e58cf3c86ea177a0e0925cee38c384044 (patch)
treed114ff0cf46cc9bdb4b73caf68dc4a5225a17390
parentbf0e795cb2edaf522a335f167af712b3ee93284f (diff)
downloadkernel-c7b1c81e58cf3c86ea177a0e0925cee38c384044.tar.gz
kernel-c7b1c81e58cf3c86ea177a0e0925cee38c384044.tar.xz
kernel-c7b1c81e58cf3c86ea177a0e0925cee38c384044.zip
Revert "usb: dwc3: gadget: remove DWC3_EP_END_TRANSFER_PENDING"
This reverts commit 43b311fa4d53e380a847b6683f94223d57158f42. To work with the following change in v4.19.131: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/usb/dwc3/gadget.c?h=linux-4.19.y&id=8aafbcb3eadd218fe19af00d3a828771bc189e1f And it seems the adb works event without the commit of 43b311fa4d53e380a847b6683f94223d57158f42, so let's remove it to keep the same base as upstream Change-Id: Id99d13289fa487df40daa57cbf06fb442dc7ec5d Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--drivers/usb/dwc3/core.h1
-rw-r--r--drivers/usb/dwc3/gadget.c15
-rw-r--r--drivers/usb/dwc3/trace.h3
3 files changed, 13 insertions, 6 deletions
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 6fe54f56a442..d6968b90ee6b 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -682,6 +682,7 @@ struct dwc3_ep {
682#define DWC3_EP_WEDGE BIT(2) 682#define DWC3_EP_WEDGE BIT(2)
683#define DWC3_EP_TRANSFER_STARTED BIT(3) 683#define DWC3_EP_TRANSFER_STARTED BIT(3)
684#define DWC3_EP_PENDING_REQUEST BIT(5) 684#define DWC3_EP_PENDING_REQUEST BIT(5)
685#define DWC3_EP_END_TRANSFER_PENDING BIT(7)
685 686
686 /* This last one is specific to EP0 */ 687 /* This last one is specific to EP0 */
687#define DWC3_EP0_DIR_IN BIT(31) 688#define DWC3_EP0_DIR_IN BIT(31)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index a4195600e488..9c6925df6c43 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -632,6 +632,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
632 632
633 dep->type = usb_endpoint_type(desc); 633 dep->type = usb_endpoint_type(desc);
634 dep->flags |= DWC3_EP_ENABLED; 634 dep->flags |= DWC3_EP_ENABLED;
635 dep->flags &= ~DWC3_EP_END_TRANSFER_PENDING;
635 636
636 reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); 637 reg = dwc3_readl(dwc->regs, DWC3_DALEPENA);
637 reg |= DWC3_DALEPENA_EP(dep->number); 638 reg |= DWC3_DALEPENA_EP(dep->number);
@@ -744,7 +745,7 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
744 745
745 dep->stream_capable = false; 746 dep->stream_capable = false;
746 dep->type = 0; 747 dep->type = 0;
747 dep->flags = 0; 748 dep->flags &= DWC3_EP_END_TRANSFER_PENDING;
748 749
749 /* Clear out the ep descriptors for non-ep0 */ 750 /* Clear out the ep descriptors for non-ep0 */
750 if (dep->number > 1) { 751 if (dep->number > 1) {
@@ -2434,7 +2435,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
2434 dep = dwc->eps[epnum]; 2435 dep = dwc->eps[epnum];
2435 2436
2436 if (!(dep->flags & DWC3_EP_ENABLED)) { 2437 if (!(dep->flags & DWC3_EP_ENABLED)) {
2437 if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) 2438 if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING))
2438 return; 2439 return;
2439 2440
2440 /* Handle only EPCMDCMPLT when EP disabled */ 2441 /* Handle only EPCMDCMPLT when EP disabled */
@@ -2458,7 +2459,8 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
2458 cmd = DEPEVT_PARAMETER_CMD(event->parameters); 2459 cmd = DEPEVT_PARAMETER_CMD(event->parameters);
2459 2460
2460 if (cmd == DWC3_DEPCMD_ENDTRANSFER) { 2461 if (cmd == DWC3_DEPCMD_ENDTRANSFER) {
2461 dep->flags &= ~DWC3_EP_TRANSFER_STARTED; 2462 dep->flags &= ~(DWC3_EP_END_TRANSFER_PENDING |
2463 DWC3_EP_TRANSFER_STARTED);
2462 dwc3_gadget_ep_cleanup_cancelled_requests(dep); 2464 dwc3_gadget_ep_cleanup_cancelled_requests(dep);
2463 } 2465 }
2464 break; 2466 break;
@@ -2516,7 +2518,8 @@ static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force,
2516 u32 cmd; 2518 u32 cmd;
2517 int ret; 2519 int ret;
2518 2520
2519 if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) 2521 if ((dep->flags & DWC3_EP_END_TRANSFER_PENDING)
2522 || !(dep->flags & DWC3_EP_TRANSFER_STARTED))
2520 return; 2523 return;
2521 2524
2522 /* 2525 /*
@@ -2559,8 +2562,10 @@ static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force,
2559 WARN_ON_ONCE(ret); 2562 WARN_ON_ONCE(ret);
2560 dep->resource_index = 0; 2563 dep->resource_index = 0;
2561 2564
2562 if (dwc3_is_usb31(dwc) || dwc->revision < DWC3_REVISION_310A) 2565 if (dwc3_is_usb31(dwc) || dwc->revision < DWC3_REVISION_310A) {
2566 dep->flags |= DWC3_EP_END_TRANSFER_PENDING;
2563 udelay(100); 2567 udelay(100);
2568 }
2564} 2569}
2565 2570
2566static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) 2571static void dwc3_clear_stall_all_ep(struct dwc3 *dwc)
diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
index 9edff17111f7..8d725fee9e4f 100644
--- a/drivers/usb/dwc3/trace.h
+++ b/drivers/usb/dwc3/trace.h
@@ -306,7 +306,7 @@ DECLARE_EVENT_CLASS(dwc3_log_ep,
306 __entry->trb_enqueue = dep->trb_enqueue; 306 __entry->trb_enqueue = dep->trb_enqueue;
307 __entry->trb_dequeue = dep->trb_dequeue; 307 __entry->trb_dequeue = dep->trb_dequeue;
308 ), 308 ),
309 TP_printk("%s: mps %d/%d streams %d burst %d ring %d/%d flags %c:%c%c%c%c:%c", 309 TP_printk("%s: mps %d/%d streams %d burst %d ring %d/%d flags %c:%c%c%c%c:%c:%c",
310 __get_str(name), __entry->maxpacket, 310 __get_str(name), __entry->maxpacket,
311 __entry->maxpacket_limit, __entry->max_streams, 311 __entry->maxpacket_limit, __entry->max_streams,
312 __entry->maxburst, __entry->trb_enqueue, 312 __entry->maxburst, __entry->trb_enqueue,
@@ -316,6 +316,7 @@ DECLARE_EVENT_CLASS(dwc3_log_ep,
316 __entry->flags & DWC3_EP_WEDGE ? 'W' : 'w', 316 __entry->flags & DWC3_EP_WEDGE ? 'W' : 'w',
317 __entry->flags & DWC3_EP_TRANSFER_STARTED ? 'B' : 'b', 317 __entry->flags & DWC3_EP_TRANSFER_STARTED ? 'B' : 'b',
318 __entry->flags & DWC3_EP_PENDING_REQUEST ? 'P' : 'p', 318 __entry->flags & DWC3_EP_PENDING_REQUEST ? 'P' : 'p',
319 __entry->flags & DWC3_EP_END_TRANSFER_PENDING ? 'E' : 'e',
319 __entry->direction ? '<' : '>' 320 __entry->direction ? '<' : '>'
320 ) 321 )
321); 322);