summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0009-usb-musb_host-fix-ep0-fifo-flushing.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0009-usb-musb_host-fix-ep0-fifo-flushing.patch')
-rw-r--r--meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0009-usb-musb_host-fix-ep0-fifo-flushing.patch93
1 files changed, 93 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0009-usb-musb_host-fix-ep0-fifo-flushing.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0009-usb-musb_host-fix-ep0-fifo-flushing.patch
new file mode 100644
index 0000000000..09fc0a17d0
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0009-usb-musb_host-fix-ep0-fifo-flushing.patch
@@ -0,0 +1,93 @@
1From 48ce47b15bfd420982ee275c595a9139eb6fabf7 Mon Sep 17 00:00:00 2001
2From: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
3Date: Thu, 26 Mar 2009 17:38:30 -0700
4Subject: [PATCH] usb: musb_host, fix ep0 fifo flushing
5
6The MUSB host side can't share generic TX FIFO flush logic
7with EP0; the EP0 TX status register bits are different
8from those for other entpoints.
9
10Resolve this issue by providing a new EP0-specific routine
11to flush and reset the FIFO, which pays careful attention to
12restrictions listed in the latest programmer's guide. This
13gets rid of an open issue whereby the usbtest control write
14test (#14) failed.
15
16Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
17---
18 drivers/usb/musb/musb_host.c | 38 +++++++++++++++++++++++++-------------
19 1 files changed, 25 insertions(+), 13 deletions(-)
20
21diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
22index ff09595..a5d75aa 100644
23--- a/drivers/usb/musb/musb_host.c
24+++ b/drivers/usb/musb/musb_host.c
25@@ -125,6 +125,29 @@ static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
26 }
27 }
28
29+static void musb_h_ep0_flush_fifo(struct musb_hw_ep *ep)
30+{
31+ void __iomem *epio = ep->regs;
32+ u16 csr;
33+ int retries = 5;
34+
35+ /* scrub any data left in the fifo */
36+ do {
37+ csr = musb_readw(epio, MUSB_TXCSR);
38+ if (!(csr & (MUSB_CSR0_TXPKTRDY | MUSB_CSR0_RXPKTRDY)))
39+ break;
40+ musb_writew(epio, MUSB_TXCSR, MUSB_CSR0_FLUSHFIFO);
41+ csr = musb_readw(epio, MUSB_TXCSR);
42+ udelay(10);
43+ } while (--retries);
44+
45+ WARN(!retries, "Could not flush host TX%d fifo: csr: %04x\n",
46+ ep->epnum, csr);
47+
48+ /* and reset for the next transfer */
49+ musb_writew(epio, MUSB_TXCSR, 0);
50+}
51+
52 /*
53 * Start transmit. Caller is responsible for locking shared resources.
54 * musb must be locked.
55@@ -693,11 +716,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
56 musb_writew(epio, MUSB_TXCSR, csr);
57 csr = musb_readw(epio, MUSB_TXCSR);
58 } else {
59- /* endpoint 0: just flush */
60- musb_writew(epio, MUSB_CSR0,
61- csr | MUSB_CSR0_FLUSHFIFO);
62- musb_writew(epio, MUSB_CSR0,
63- csr | MUSB_CSR0_FLUSHFIFO);
64+ musb_h_ep0_flush_fifo(hw_ep);
65 }
66
67 /* target addr and (for multipoint) hub addr/port */
68@@ -1063,11 +1082,7 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb)
69 csr &= ~MUSB_CSR0_H_NAKTIMEOUT;
70 musb_writew(epio, MUSB_CSR0, csr);
71 } else {
72- csr |= MUSB_CSR0_FLUSHFIFO;
73- musb_writew(epio, MUSB_CSR0, csr);
74- musb_writew(epio, MUSB_CSR0, csr);
75- csr &= ~MUSB_CSR0_H_NAKTIMEOUT;
76- musb_writew(epio, MUSB_CSR0, csr);
77+ musb_h_ep0_flush_fifo(hw_ep);
78 }
79
80 musb_writeb(epio, MUSB_NAKLIMIT0, 0);
81@@ -1081,9 +1096,6 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb)
82 * SHOULD NEVER HAPPEN! */
83 ERR("no URB for end 0\n");
84
85- musb_writew(epio, MUSB_CSR0, MUSB_CSR0_FLUSHFIFO);
86- musb_writew(epio, MUSB_CSR0, MUSB_CSR0_FLUSHFIFO);
87- musb_writew(epio, MUSB_CSR0, 0);
88
89 goto done;
90 }
91--
921.6.0.4
93