usb: gadget: r8a66597-udc: fix flush fifo handling
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Mon, 31 Oct 2011 07:01:33 +0000 (16:01 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Nov 2011 19:51:20 +0000 (11:51 -0800)
The "BCLR" in CFIFOCTR/DnFIFOCTR can flush the fifo of "CPU side" only.
To flush the fifo of "SIE side", we have to use the "ACLRM" in PIPEnCTR.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/r8a66597-udc.c

index 38f99887b93562496a1a443955c1f83531f9c5f3..24f84b210ce116cfd78e5bae3a1bee383d198ca0 100644 (file)
@@ -1718,6 +1718,8 @@ static void r8a66597_fifo_flush(struct usb_ep *_ep)
        if (list_empty(&ep->queue) && !ep->busy) {
                pipe_stop(ep->r8a66597, ep->pipenum);
                r8a66597_bclr(ep->r8a66597, BCLR, ep->fifoctr);
+               r8a66597_write(ep->r8a66597, ACLRM, ep->pipectr);
+               r8a66597_write(ep->r8a66597, 0, ep->pipectr);
        }
        spin_unlock_irqrestore(&ep->r8a66597->lock, flags);
 }