diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2008-11-24 06:06:50 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-07 12:59:59 -0500 |
commit | bb1c9ef1b4cd64f22e15e8447deac6043eeb151c (patch) | |
tree | fff9e2971fb989562519928c4b13728bcd469027 | |
parent | 71783e0defa16ca5abca7750df98ff8e7767bd2e (diff) |
USB: musb: host side diagnostics tweaks
Random host-side MUSB updates, mostly relating to better diagnostics:
+ Improve diagnostics on host side:
- tx flush fifo:
* Avoid hundreds of duplicate TX FIFONOTEMPTY messages
* make "Can't flush TX fifo" a warning, and say which endpoint
- giveback:
* use correct status code
* show completion function name not just URB pointer
- Fix annoying "1 bytes" (should be "1 byte")
+ Be more consistent about failing init of unusable fifo_mode
It's not clear why that "can't flush TX fifo" message appears, though
it might relate to disconnection; I see it not infrequently
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/musb/musb_core.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/musb_host.c | 23 |
2 files changed, 15 insertions, 11 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index de7f8bec6bde..8b14437331c7 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1212,7 +1212,7 @@ static int __init ep_config_from_table(struct musb *musb) | |||
1212 | if (epn >= musb->config->num_eps) { | 1212 | if (epn >= musb->config->num_eps) { |
1213 | pr_debug("%s: invalid ep %d\n", | 1213 | pr_debug("%s: invalid ep %d\n", |
1214 | musb_driver_name, epn); | 1214 | musb_driver_name, epn); |
1215 | continue; | 1215 | return -EINVAL; |
1216 | } | 1216 | } |
1217 | offset = fifo_setup(musb, hw_ep + epn, cfg++, offset); | 1217 | offset = fifo_setup(musb, hw_ep + epn, cfg++, offset); |
1218 | if (offset < 0) { | 1218 | if (offset < 0) { |
@@ -1813,7 +1813,6 @@ allocate_instance(struct device *dev, | |||
1813 | for (epnum = 0, ep = musb->endpoints; | 1813 | for (epnum = 0, ep = musb->endpoints; |
1814 | epnum < musb->config->num_eps; | 1814 | epnum < musb->config->num_eps; |
1815 | epnum++, ep++) { | 1815 | epnum++, ep++) { |
1816 | |||
1817 | ep->musb = musb; | 1816 | ep->musb = musb; |
1818 | ep->epnum = epnum; | 1817 | ep->epnum = epnum; |
1819 | } | 1818 | } |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index cc64462d4c4e..bf25ef4cc151 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -112,18 +112,21 @@ static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep) | |||
112 | { | 112 | { |
113 | void __iomem *epio = ep->regs; | 113 | void __iomem *epio = ep->regs; |
114 | u16 csr; | 114 | u16 csr; |
115 | u16 lastcsr = 0; | ||
115 | int retries = 1000; | 116 | int retries = 1000; |
116 | 117 | ||
117 | csr = musb_readw(epio, MUSB_TXCSR); | 118 | csr = musb_readw(epio, MUSB_TXCSR); |
118 | while (csr & MUSB_TXCSR_FIFONOTEMPTY) { | 119 | while (csr & MUSB_TXCSR_FIFONOTEMPTY) { |
119 | DBG(5, "Host TX FIFONOTEMPTY csr: %02x\n", csr); | 120 | if (csr != lastcsr) |
121 | DBG(3, "Host TX FIFONOTEMPTY csr: %02x\n", csr); | ||
122 | lastcsr = csr; | ||
120 | csr |= MUSB_TXCSR_FLUSHFIFO; | 123 | csr |= MUSB_TXCSR_FLUSHFIFO; |
121 | musb_writew(epio, MUSB_TXCSR, csr); | 124 | musb_writew(epio, MUSB_TXCSR, csr); |
122 | csr = musb_readw(epio, MUSB_TXCSR); | 125 | csr = musb_readw(epio, MUSB_TXCSR); |
123 | if (retries-- < 1) { | 126 | if (WARN(retries-- < 1, |
124 | ERR("Could not flush host TX fifo: csr: %04x\n", csr); | 127 | "Could not flush host TX%d fifo: csr: %04x\n", |
128 | ep->epnum, csr)) | ||
125 | return; | 129 | return; |
126 | } | ||
127 | mdelay(1); | 130 | mdelay(1); |
128 | } | 131 | } |
129 | } | 132 | } |
@@ -268,7 +271,7 @@ __musb_giveback(struct musb *musb, struct urb *urb, int status) | |||
268 | __releases(musb->lock) | 271 | __releases(musb->lock) |
269 | __acquires(musb->lock) | 272 | __acquires(musb->lock) |
270 | { | 273 | { |
271 | DBG(({ int level; switch (urb->status) { | 274 | DBG(({ int level; switch (status) { |
272 | case 0: | 275 | case 0: |
273 | level = 4; | 276 | level = 4; |
274 | break; | 277 | break; |
@@ -283,8 +286,8 @@ __acquires(musb->lock) | |||
283 | level = 2; | 286 | level = 2; |
284 | break; | 287 | break; |
285 | }; level; }), | 288 | }; level; }), |
286 | "complete %p (%d), dev%d ep%d%s, %d/%d\n", | 289 | "complete %p %pF (%d), dev%d ep%d%s, %d/%d\n", |
287 | urb, urb->status, | 290 | urb, urb->complete, status, |
288 | usb_pipedevice(urb->pipe), | 291 | usb_pipedevice(urb->pipe), |
289 | usb_pipeendpoint(urb->pipe), | 292 | usb_pipeendpoint(urb->pipe), |
290 | usb_pipein(urb->pipe) ? "in" : "out", | 293 | usb_pipein(urb->pipe) ? "in" : "out", |
@@ -988,8 +991,10 @@ static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb) | |||
988 | if (fifo_count) { | 991 | if (fifo_count) { |
989 | fifo_dest = (u8 *) (urb->transfer_buffer | 992 | fifo_dest = (u8 *) (urb->transfer_buffer |
990 | + urb->actual_length); | 993 | + urb->actual_length); |
991 | DBG(3, "Sending %d bytes to %p\n", | 994 | DBG(3, "Sending %d byte%s to ep0 fifo %p\n", |
992 | fifo_count, fifo_dest); | 995 | fifo_count, |
996 | (fifo_count == 1) ? "" : "s", | ||
997 | fifo_dest); | ||
993 | musb_write_fifo(hw_ep, fifo_count, fifo_dest); | 998 | musb_write_fifo(hw_ep, fifo_count, fifo_dest); |
994 | 999 | ||
995 | urb->actual_length += fifo_count; | 1000 | urb->actual_length += fifo_count; |