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>
This commit is contained in:
parent
71783e0def
commit
bb1c9ef1b4
|
@ -1212,7 +1212,7 @@ static int __init ep_config_from_table(struct musb *musb)
|
||||||
if (epn >= musb->config->num_eps) {
|
if (epn >= musb->config->num_eps) {
|
||||||
pr_debug("%s: invalid ep %d\n",
|
pr_debug("%s: invalid ep %d\n",
|
||||||
musb_driver_name, epn);
|
musb_driver_name, epn);
|
||||||
continue;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
offset = fifo_setup(musb, hw_ep + epn, cfg++, offset);
|
offset = fifo_setup(musb, hw_ep + epn, cfg++, offset);
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
|
@ -1813,7 +1813,6 @@ allocate_instance(struct device *dev,
|
||||||
for (epnum = 0, ep = musb->endpoints;
|
for (epnum = 0, ep = musb->endpoints;
|
||||||
epnum < musb->config->num_eps;
|
epnum < musb->config->num_eps;
|
||||||
epnum++, ep++) {
|
epnum++, ep++) {
|
||||||
|
|
||||||
ep->musb = musb;
|
ep->musb = musb;
|
||||||
ep->epnum = epnum;
|
ep->epnum = epnum;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,18 +112,21 @@ static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
|
||||||
{
|
{
|
||||||
void __iomem *epio = ep->regs;
|
void __iomem *epio = ep->regs;
|
||||||
u16 csr;
|
u16 csr;
|
||||||
|
u16 lastcsr = 0;
|
||||||
int retries = 1000;
|
int retries = 1000;
|
||||||
|
|
||||||
csr = musb_readw(epio, MUSB_TXCSR);
|
csr = musb_readw(epio, MUSB_TXCSR);
|
||||||
while (csr & MUSB_TXCSR_FIFONOTEMPTY) {
|
while (csr & MUSB_TXCSR_FIFONOTEMPTY) {
|
||||||
DBG(5, "Host TX FIFONOTEMPTY csr: %02x\n", csr);
|
if (csr != lastcsr)
|
||||||
|
DBG(3, "Host TX FIFONOTEMPTY csr: %02x\n", csr);
|
||||||
|
lastcsr = csr;
|
||||||
csr |= MUSB_TXCSR_FLUSHFIFO;
|
csr |= MUSB_TXCSR_FLUSHFIFO;
|
||||||
musb_writew(epio, MUSB_TXCSR, csr);
|
musb_writew(epio, MUSB_TXCSR, csr);
|
||||||
csr = musb_readw(epio, MUSB_TXCSR);
|
csr = musb_readw(epio, MUSB_TXCSR);
|
||||||
if (retries-- < 1) {
|
if (WARN(retries-- < 1,
|
||||||
ERR("Could not flush host TX fifo: csr: %04x\n", csr);
|
"Could not flush host TX%d fifo: csr: %04x\n",
|
||||||
|
ep->epnum, csr))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
mdelay(1);
|
mdelay(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,7 +271,7 @@ __musb_giveback(struct musb *musb, struct urb *urb, int status)
|
||||||
__releases(musb->lock)
|
__releases(musb->lock)
|
||||||
__acquires(musb->lock)
|
__acquires(musb->lock)
|
||||||
{
|
{
|
||||||
DBG(({ int level; switch (urb->status) {
|
DBG(({ int level; switch (status) {
|
||||||
case 0:
|
case 0:
|
||||||
level = 4;
|
level = 4;
|
||||||
break;
|
break;
|
||||||
|
@ -283,8 +286,8 @@ __acquires(musb->lock)
|
||||||
level = 2;
|
level = 2;
|
||||||
break;
|
break;
|
||||||
}; level; }),
|
}; level; }),
|
||||||
"complete %p (%d), dev%d ep%d%s, %d/%d\n",
|
"complete %p %pF (%d), dev%d ep%d%s, %d/%d\n",
|
||||||
urb, urb->status,
|
urb, urb->complete, status,
|
||||||
usb_pipedevice(urb->pipe),
|
usb_pipedevice(urb->pipe),
|
||||||
usb_pipeendpoint(urb->pipe),
|
usb_pipeendpoint(urb->pipe),
|
||||||
usb_pipein(urb->pipe) ? "in" : "out",
|
usb_pipein(urb->pipe) ? "in" : "out",
|
||||||
|
@ -988,8 +991,10 @@ static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb)
|
||||||
if (fifo_count) {
|
if (fifo_count) {
|
||||||
fifo_dest = (u8 *) (urb->transfer_buffer
|
fifo_dest = (u8 *) (urb->transfer_buffer
|
||||||
+ urb->actual_length);
|
+ urb->actual_length);
|
||||||
DBG(3, "Sending %d bytes to %p\n",
|
DBG(3, "Sending %d byte%s to ep0 fifo %p\n",
|
||||||
fifo_count, fifo_dest);
|
fifo_count,
|
||||||
|
(fifo_count == 1) ? "" : "s",
|
||||||
|
fifo_dest);
|
||||||
musb_write_fifo(hw_ep, fifo_count, fifo_dest);
|
musb_write_fifo(hw_ep, fifo_count, fifo_dest);
|
||||||
|
|
||||||
urb->actual_length += fifo_count;
|
urb->actual_length += fifo_count;
|
||||||
|
|
Loading…
Reference in a new issue