From 7e8d9f80081e5459d3e50f6786880fa9c5ee49f5 Mon Sep 17 00:00:00 2001 From: Anurag Kumar Vulisha Date: Thu, 26 Apr 2018 12:49:17 +0530 Subject: [PATCH] usb: dwc3: gadget: ISOC transfers should be stopped before starting a transfer For ISOC transfers the requests are not queued until the HOST requests for data and XferNotReady event is generated .But XferNotReady event is not getting generated for ISOC transfers for the second time after Endpoint configuration. Since ISOC packets depend on the XferNotReady events, they will not be queued to controller. Because of this issue timeout happens on the application layer. This patch fixes this issue by issuing END TRANSFER command before starting any ISOC transfers. Doing so will make the controller clear the previous allocated endpoint resources and reallocate resources when the transfer is requested. Because of this change XferNotReady events will be generated when host requests for the ISOC transfer. Signed-off-by: Anurag Kumar Vulisha Signed-off-by: Michal Simek --- drivers/usb/dwc3/gadget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index a0f8c0251f46..3a031821e697 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1392,7 +1392,8 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) */ if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { if ((dep->flags & DWC3_EP_PENDING_REQUEST)) { - if (dep->flags & DWC3_EP_TRANSFER_STARTED) { + if ((dep->flags & DWC3_EP_TRANSFER_STARTED) || + !(dep->flags & DWC3_EP_BUSY)) { dwc3_stop_active_transfer(dwc, dep->number, true); dep->flags = DWC3_EP_ENABLED; } else { -- 2.39.2