1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
From e5fad55642b91e45ed640c546dd10bd454b6e4df Mon Sep 17 00:00:00 2001
From: Ajay Kumar Gupta <ajay.gupta@ti.com>
Date: Thu, 24 May 2012 15:42:53 +0530
Subject: [PATCH 11/18] usb: musb: host: Flush txfifo only if TxPktRdy bit set
This is needed as per mentor core documents.
Signed-off-by: Ravi B <ravibabu@ti.com>
---
drivers/usb/musb/musb_host.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index c3629bd..7545a65 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -133,25 +133,26 @@ static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
struct musb *musb = ep->musb;
void __iomem *epio = ep->regs;
u16 csr;
- u16 lastcsr = 0;
int retries = 1000;
csr = musb_readw(epio, MUSB_TXCSR);
- while (csr & MUSB_TXCSR_FIFONOTEMPTY) {
- if (csr != lastcsr)
- dev_dbg(musb->controller, "Host TX FIFONOTEMPTY csr: %02x\n", csr);
- lastcsr = csr;
- csr = MUSB_TXCSR_FLUSHFIFO;
+ while (csr & MUSB_TXCSR_TXPKTRDY) {
+ if (!(csr & MUSB_TXCSR_FIFONOTEMPTY))
+ return;
+ else
+ dev_dbg(musb->controller,
+ "Host TX FIFONOTEMPTY csr: %02x\n", csr);
+
+ csr |= MUSB_TXCSR_FLUSHFIFO;
musb_writew(epio, MUSB_TXCSR, csr);
csr = musb_readw(epio, MUSB_TXCSR);
- if (!(csr & MUSB_TXCSR_FIFONOTEMPTY))
- break;
+
if (retries-- < 1) {
- dev_dbg(musb->controller, "Could not flush host TX%d fifo: csr: %04x\n",
- ep->epnum, csr);
+ dev_dbg(musb->controller,
+ "Could not flush host TX%d fifo: csr: %04x\n",
+ ep->epnum, csr);
return;
}
- mdelay(1);
}
}
--
1.7.7.6
|