mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
UPSTREAM: usb: dwc3: gadget: Check END_TRANSFER completion
While the END_TRANSFER command is sent but not completed, any request dequeue during this time will cause the driver to issue the END_TRANSFER command. The driver needs to submit the command only once to stop the controller from processing further. The controller may take more time to process the same command multiple times unnecessarily. Let's add a flag DWC3_EP_END_TRANSFER_PENDING to check for this condition. Change-Id: Ibd378cfb4320dfa962b76fa50b5f002d7eac1d8b Fixes:3aec99154d("usb: dwc3: gadget: remove DWC3_EP_END_TRANSFER_PENDING") Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <balbi@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: William Wu <william.wu@rock-chips.com> (cherry picked from commitc58d8bfc77)
This commit is contained in:
@@ -690,6 +690,7 @@ struct dwc3_ep {
|
||||
#define DWC3_EP_STALL BIT(1)
|
||||
#define DWC3_EP_WEDGE BIT(2)
|
||||
#define DWC3_EP_TRANSFER_STARTED BIT(3)
|
||||
#define DWC3_EP_END_TRANSFER_PENDING BIT(4)
|
||||
#define DWC3_EP_PENDING_REQUEST BIT(5)
|
||||
|
||||
/* This last one is specific to EP0 */
|
||||
|
||||
@@ -1134,8 +1134,10 @@ void dwc3_ep0_interrupt(struct dwc3 *dwc,
|
||||
case DWC3_DEPEVT_EPCMDCMPLT:
|
||||
cmd = DEPEVT_PARAMETER_CMD(event->parameters);
|
||||
|
||||
if (cmd == DWC3_DEPCMD_ENDTRANSFER)
|
||||
if (cmd == DWC3_DEPCMD_ENDTRANSFER) {
|
||||
dep->flags &= ~DWC3_EP_END_TRANSFER_PENDING;
|
||||
dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2694,6 +2694,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
|
||||
cmd = DEPEVT_PARAMETER_CMD(event->parameters);
|
||||
|
||||
if (cmd == DWC3_DEPCMD_ENDTRANSFER) {
|
||||
dep->flags &= ~DWC3_EP_END_TRANSFER_PENDING;
|
||||
dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
|
||||
dwc3_gadget_ep_cleanup_cancelled_requests(dep);
|
||||
}
|
||||
@@ -2752,7 +2753,8 @@ static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force,
|
||||
u32 cmd;
|
||||
int ret;
|
||||
|
||||
if (!(dep->flags & DWC3_EP_TRANSFER_STARTED))
|
||||
if (!(dep->flags & DWC3_EP_TRANSFER_STARTED) ||
|
||||
(dep->flags & DWC3_EP_END_TRANSFER_PENDING))
|
||||
return;
|
||||
|
||||
/*
|
||||
@@ -2797,6 +2799,8 @@ static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force,
|
||||
|
||||
if (!interrupt)
|
||||
dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
|
||||
else
|
||||
dep->flags |= DWC3_EP_END_TRANSFER_PENDING;
|
||||
|
||||
if (dwc3_is_usb31(dwc) || dwc->revision < DWC3_REVISION_310A)
|
||||
udelay(100);
|
||||
|
||||
Reference in New Issue
Block a user