USB: gadget: s3c-hsotg: add flush TX FIFO when kill all requests
authorRobert Baldyga <r.baldyga@samsung.com>
Thu, 5 Dec 2013 14:04:19 +0000 (15:04 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 15 May 2014 05:25:59 +0000 (07:25 +0200)
This patch adds flushing TX FIFO in kill_all_requests() function in
dedicated-fifo mode. It's because when requests are killed (when endpoint is
disabled or in case of device reset/disconnection) in FIFO can stay some
unsent data. In the worst case FIFO can stay full, and then if endpoint will
be back enabled, sending new data will be impossible.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Change-Id: Ibdb3d3f14f665d096ad944fb3ad79d25ff11625a

drivers/usb/gadget/s3c-hsotg.c

index 3bab054..6e4aefe 100644 (file)
@@ -2124,6 +2124,9 @@ static void kill_all_requests(struct s3c_hsotg *hsotg,
                s3c_hsotg_complete_request(hsotg, ep, req,
                                           result);
        }
+       if (hsotg->dedicated_fifos)
+               if ((readl(hsotg->regs + DTXFSTS(ep->index)) & 0xffff) * 4 < 3072)
+                       s3c_hsotg_txfifo_flush(hsotg, ep->index);
 }
 
 #define call_gadget(_hs, _entry) \