USB: ci13xxx_udc: Apply posted writes workaround to control IN endpoint
The controller always does posted writes to transfer descriptors.
A transfer completion interrupt may be generated before dTD is
updated in system memory. A software workaround is already in
place to give 10usec delay after receiving the completion interrupt
if the first dTD in the queue is still active. But this delay
is given only for OUT endpoints. In theory this problem is applicable
to both IN and OUT endpoints. But none of the function drivers indicate
any problem with IN endpoints. Hence delay is not given for IN
endpoints.
The status phase of a control transfer may get stuck if the above
issue is hit for EP0 IN endpoint. Hence apply the software workaround
for EP0 IN endpoint.
CRs-fixed: 409573
Change-Id: Ic07a4421c0066645459d2cc566f0df6691084a43
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 0b0ebe7..766c0f8 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -2311,7 +2311,8 @@
* bits. This is a temporary workaround till
* HW designers come back on this.
*/
- if (retval == -EBUSY && req_dequeue && mEp->dir == 0) {
+ if (retval == -EBUSY && req_dequeue &&
+ (mEp->dir == 0 || mEp->num == 0)) {
req_dequeue = 0;
udc->dTD_update_fail_count++;
mEp->dTD_update_fail_count++;