[lkml]   [2014]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 3/6] usb: gadget: mv_udc: clear corresponding interrupt when flush fifo
The interruts are useless when this endpoint is going to be flushed.
Especially in the enumeration phase, let's take get device description
for example.
1. Device doesn't ACK the status package from host in time due to irq is
disabled by some module.
2. Host find no ACK in time, and send another request.
3. Device gets the chance to handle the interrupt, the sequence is as
a. Flush pending requests in ep0.
b. Queue a request in ep0 according to host's request and change
the ep0 state to DATA_STATE_XMIT.
c. Handle the pending interrupt for the last status package. But
actually it will check the new added request instead of the status
package and because of wront ep0 state, device will request an
unexpected status package from host.
d. The ep0 state is going mad.

The solution is that we need clear the pending corresponding interrupt
as well as flush

Signed-off-by: Neil Zhang <>
drivers/usb/gadget/mv_udc_core.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index 657ac5c..d5a9bdf 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -692,6 +692,8 @@ static void mv_ep_fifo_flush(struct usb_ep *_ep)
} while (readl(&udc->op_regs->epstatus) & bit_pos);
+ writel(bit_pos, &udc->op_regs->epcomplete);

/* queues (submits) an I/O request to an endpoint */

 \ /
  Last update: 2014-02-25 18:01    [W:0.110 / U:7.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site