musb: repeatable CPPI DMA hang bug on peripheral RX 64 byte packet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On DM355 with CPPI DMA enabled, operating as gadget serial, the
USB driver RX side locks up when sent a 64-byte line of text.
Up to and above 64 bytes are OK, exactly 64 bytes wedges it.
I see the 64-byte line come out of "cat /dev/ttyGS0", but then
nothing after. The TX side still works OK, but if the other end
tries to send any more, it times out.

If it helps at all, a few times when testing this I have seen
extra 1-byte transfers appear at the g_serial layer rather than
wedging when a 64-byte packet was sent. I haven't been able
to reproduce this reliably. But that is to say I was seeing:

Send 64 bytes, g_serial layer gets 64-byte transfer followed by
a 1-byte transfer containing garbage: always the first character
of some previous line received.
Send any other line size e.g. 63 bytes, g_serial layer gets a
single 63-byte transfer.

Disabling DMA fixes the problem, but I'd like to have DMA if
possible, and help fix this.

I observed this problem in a 2.6.34 based kernel, I am now running
the master of
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
with local board support etc. patches applied, and tried applying
the 12 musb fix patches at the top of
http://gitorious.org/usb/usb/commits/musb
which did not help.

loading musb_hdrc with debug=7 shows up some suspicious differences
when receiving a 64-byte line, some console logs below. I note that
bits 0x3 of csr are set in the problem case.

63-byte RX (ok):

cppi_interrupt 1172: CPPI IRQ Tx0 Rx1
cppi_dump_rx 377: RX DMA0/K: 0 left, csr 2000, 00000000 H00000000 S873388c0 C873388c0, B86ec6c3f L003f01c1 0000003f .. 873388c0
cppi_rx_scan 1045: C/RXBD 873388c0: nxt 00000000 buf 86ec6c00 off.len 0000003f opt.len d000003f (0)
cppi_dump_rx 377: RX DMA0/completed: 0 left, csr 2000, 00000000 H00000000 S873388c0 C873388c0, B86ec6c3f L003f01c1 0000003f .. 873388c0
musb_g_rx 757: <== ep1out, rxcsr 2000 (dma) c6e92dc0
musb_g_rx 800: RXCSR1 0000, dma off, 0000, len 63, req c6e92dc0
musb_g_giveback 143: ep1out done request c6e92dc0,  63/512
gs_read_complete: req c6e92dc0
cppi_next_rx_segment 831: RX DMA0 seg, maxp 512 onepacket bds 1 (cnt 0) dma 0x86854000 len 512 0/512
RXBD/S 873388a0: nxt 00000000 buf 86854000 off.blen 00000200 opt.plen e0000200
cppi_dump_rx 377: RX DMA0/S: 3 left, csr 0000, 00000000 H873388a0 S873388c0 C873388c0, B86ec6c3f L003f01c1 0000003f .. 873388c0
davinci_interrupt 292: IRQ 00000000
ttyGS 63 bytes to tty (s S . ... 0x39 0x0a)
musb_gadget_queue 1120: <== to ep1out request=c6e92dc0
musb_gadget_queue 1120: <== to ep1in request=c6e927c0
musb_ep_restart 1088: <== TX/IN request c6e927c0 len 1 on hw_ep1
txstate 298: hw_ep1, maxpacket 512, fifo count 1, txcsr 2404
cppi_next_tx_segment 604: TX DMA0, pktSz 512 transparent bds 1 dma 0x86854a00 len 1
cppi_next_tx_segment 658: TXBD ff32a800: nxt 00000000 buf 86854a00 len 0001 opt e0000001
cppi_dump_tx 405: TX DMA0/S: csr 3403, H00000000 S86e71800 C86e71800 86854a01, F00020000 L00000001 .. 86e71800
txstate 410: ep1in TX/IN dma len 0/1, txcsr 3404, fifo 1/512
cppi_interrupt 1172: CPPI IRQ Tx1 Rx0
cppi_dump_tx 405: TX DMA0/E: csr 3404, H00000000 S86e71800 C86e71800 86854a01, F00020000 L00000001 .. 86e71800
cppi_interrupt 1217: C/TXBD ff32a800 n 0 b 86854a00 off 1 opt d0000000
musb_g_tx 430: <== ep1in, txcsr 3404
musb_g_tx 475: TXCSR1 2400, DMA off, len 1, req c6e927c0
musb_g_giveback 143: ep1in done request c6e927c0,  1/1
musb_g_tx 522: ep1in idle now

64-byte RX (wedges things, but gets to tty):

cppi_interrupt 1172: CPPI IRQ Tx0 Rx1
cppi_dump_rx 377: RX DMA0/K: 0 left, csr 2003, 00000000 H00000000 S873388a0 C873388a0, B86854040 L004001c0 00000040 .. 873388a0
cppi_rx_scan 1045: C/RXBD 873388a0: nxt 00000000 buf 86854000 off.len 00000040 opt.len d0000040 (0)
cppi_dump_rx 377: RX DMA0/completed: 0 left, csr 2003, 00000000 H00000000 S873388a0 C873388a0, B86854040 L004001c0 00000040 .. 873388a0
musb_g_rx 757: <== ep1out, rxcsr 2003 (dma) c6e92d00
musb_g_rx 800: RXCSR1 0003, dma off, 0003, len 64, req c6e92d00
musb_g_giveback 143: ep1out done request c6e92d00,  64/512
gs_read_complete: req c6e92d00
cppi_next_rx_segment 831: RX DMA0 seg, maxp 512 onepacket bds 1 (cnt 0) dma 0x86854200 len 512 0/512
RXBD/S 873388c0: nxt 00000000 buf 86854200 off.blen 00000200 opt.plen e0000200
cppi_dump_rx 377: RX DMA0/S: 3 left, csr 0003, 00000000 H873388c0 S873388a0 C873388a0, B86854040 L004001c0 00000040 .. 873388a0
davinci_interrupt 292: IRQ 00000000
ttyGS 64 bytes to tty (t T . ... 0x30 0x0a)
musb_gadget_queue 1120: <== to ep1out request=c6e92d00
musb_gadget_queue 1120: <== to ep1in request=c6e927c0
musb_ep_restart 1088: <== TX/IN request c6e927c0 len 1 on hw_ep1
txstate 298: hw_ep1, maxpacket 512, fifo count 1, txcsr 2404
cppi_next_tx_segment 604: TX DMA0, pktSz 512 transparent bds 1 dma 0x86854a00 len 1
cppi_next_tx_segment 658: TXBD ff32a800: nxt 00000000 buf 86854a00 len 0001 opt e0000001
cppi_dump_tx 405: TX DMA0/S: csr 3403, H00000000 S86e71800 C86e71800 86854a01, F00020000 L00000001 .. 86e71800
txstate 410: ep1in TX/IN dma len 0/1, txcsr 3404, fifo 1/512
cppi_interrupt 1172: CPPI IRQ Tx1 Rx0
cppi_dump_tx 405: TX DMA0/E: csr 3404, H00000000 S86e71800 C86e71800 86854a01, F00020000 L00000001 .. 86e71800
cppi_interrupt 1217: C/TXBD ff32a800 n 0 b 86854a00 off 1 opt d0000000
musb_g_tx 430: <== ep1in, txcsr 3404
musb_g_tx 475: TXCSR1 2400, DMA off, len 1, req c6e927c0
musb_g_giveback 143: ep1in done request c6e927c0,  1/1
musb_g_tx 522: ep1in idle now

Subsequent 63-byte RX (fails to arrive at tty)
Not quite sure what's going on here, something very different:

davinci_interrupt 292: IRQ 00000001
musb_interrupt 1583: ** IRQ peripheral usb0000 tx0001 rx0000
musb_g_ep0_irq 671: csr 0001, count 8, myaddr 3, ep0stage idle
musb_read_fifo 283: RX ep0 fifo fec64420 count 8 buf c0363e36
musb_read_setup 605: SETUP req21.22 v0000 i0000 l0
musb_g_ep0_irq 853: handled 0, csr 0001, ep0stage wait
g_serial gadget: acm ttyGS0 req21.22 v0000 i0000 l0
musb_g_ep0_queue 959: queue to ep0 (OUT/RX), length=0
musb_g_giveback 143: ep0 done request c6eca040,  0/0

--
Jon Povey
jon.povey@xxxxxxxxxxxxxxx

Racelogic is a limited company registered in England. Registered number 2743719 .
Registered Office Unit 10, Swan Business Centre, Osier Way, Buckingham, Bucks, MK18 1TB .

The information contained in this electronic mail transmission is intended by Racelogic Ltd for the use of the named individual or entity to which it is directed and may contain information that is confidential or privileged. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email so that the sender's address records can be corrected. The views expressed by the sender of this communication do not necessarily represent those of Racelogic Ltd. Please note that Racelogic reserves the right to monitor e-mail communications passing through its network


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux