This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335X: musb-hdrc could not flush host TX2 fifo

Other Parts Discussed in Thread: AM3359

I have a problem with USB on a beaglebone black board.

I built the rootfs with yocto and I am using ver 4.4.21 of the Linux kernel. I am using meta-ti commit 1f4d266c4d293c326155d7a2051a9affa8722400 and linux-ti-staging_4.4.bb that fetches the kernel from git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git, branch ti-lsk-linux-4.4.y, srcrev=4fb4591a4ab1b3ef317fa87af3cd3c06f1a7284b.

I modified the original device-tree ( am335x-boneblack.dts) and removed the hdmi parts, that is I removed the “sound” section and the “tda19988” section and disabled the lcdc.

I connected a USB sound card.

When I play a wav-file, the kernel crashes after a few seconds with the message: musb-hdrc musb-hdrc.1.auto: Could not flush host TX2 fifo:

An interesting fact is that if I put back the “sound” section and the “tda19988” section in am335x-boneblack.dts( reverting to the original dts ) everything works fine, the board does not crash.

I tested with two different sound cards and the results are the same.

I have googled "Could not flush host TX2 fifo" and a lot of people seem to have similar problems but with older kernel versions. So, I would like to know if there are still issues in the sitara usb-driver?

Do anyone have any ideas on how to troubleshoot this problem?

root@beaglebone:~# aplay  -l

**** List of PLAYBACK Hardware Devices ****

card 0: Device [USB Audio Device], device 0: USB Audio [USB Audio]

 Subdevices: 1/1

 Subdevice #0: subdevice #0

card 0: Device [USB Audio Device], device 1: USB Audio [USB Audio #1]

 Subdevices: 1/1

 Subdevice #0: subdevice #0



root@beaglebone:~# aplay out3.wav

Playing WAVE 'out3.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

[   69.688809] hrtimer: interrupt took 201500 ns

[   86.460579] ------------[ cut here ]------------

[   86.465359] WARNING: CPU: 0 PID: 336 at /home/andreas/src/Langedrag-Yocto/build/tmp/work-shared/beaglebone/kernel-source/drivers/usb/musb/musb_host.c:139 musb_h_tx_flush_fifo+0xdc/0xe8 [musb_hdrc]()

[   86.483085] musb-hdrc musb-hdrc.1.auto: Could not flush host TX2 fifo: csr: 2403

[   86.490513] Modules linked in: 8021q snd_usb_audio snd_hwdep snd_usbmidi_lib snd_rawmidi usbhid musb_dsps musb_hdrc udc_core usbcore pru_rproc pruss_intc pm33xx ecb sha256_generic hmac md5 sha1_generic sha1_arm_neon sha1_arm ti_emif_sram wkup_m3_ipc wkup_m3_rproc pruss remoteproc omap_aes_driver omap_sham virtio virtio_ring omap_rng rng_core musb_am335x rtc_omap omap_wdt

[   86.523774] CPU: 0 PID: 336 Comm: aplay Not tainted 4.4.21-g4fb4591a4a #1

[   86.530592] Hardware name: Generic AM33XX (Flattened Device Tree)

[   86.536711] Backtrace:

[   86.539206] [<c00133a8>] (dump_backtrace) from [<c00135a4>] (show_stack+0x18/0x1c)

[   86.546808]  r7:bf122450 r6:0000008b r5:00000009 r4:00000000

[   86.552533] [<c001358c>] (show_stack) from [<c02a7010>] (dump_stack+0x24/0x28)

[   86.559802] [<c02a6fec>] (dump_stack) from [<c0031a60>] (warn_slowpath_common+0x88/0xb4)

[   86.567935] [<c00319d8>] (warn_slowpath_common) from [<c0031ac4>] (warn_slowpath_fmt+0x38/0x40)

[   86.576669]  r8:dd9d447c r7:bf12c58c r6:e0bc2c10 r5:bf12c3a0 r4:bf12b800

[   86.583476] [<c0031a90>] (warn_slowpath_fmt) from [<bf122450>] (musb_h_tx_flush_fifo+0xdc/0xe8 [musb_hdrc])

[   86.593258]  r3:bf12ada4 r2:bf12b800

[   86.596860]  r4:00002403

[   86.599464] [<bf122374>] (musb_h_tx_flush_fifo [musb_hdrc]) from [<bf123558>] (musb_cleanup_urb+0xd0/0x14c [musb_hdrc])

[   86.610292]  r10:00000001 r9:bf12c58c r8:e0bc2c10 r7:00000000 r6:dde56100 r5:00000000

[   86.618194]  r4:dd9d447c

[   86.620798] [<bf123488>] (musb_cleanup_urb [musb_hdrc]) from [<bf123cbc>] (musb_urb_dequeue+0x150/0x158 [musb_hdrc])

[   86.631364]  r10:00000001 r9:ddd43d00 r8:00000000 r7:00020200 r6:dd9d4010 r5:a00e0093

[   86.639266]  r4:dde56100

[   86.642144] [<bf123b6c>] (musb_urb_dequeue [musb_hdrc]) from [<bf099858>] (unlink1+0x38/0x158 [usbcore])

[   86.651666]  r10:ddf0dcc8 r9:00000008 r8:a00e0093 r7:ffffff98 r6:ddf7d600 r5:dde56100

[   86.659568]  r4:dde56100 r3:bf123b6c

[   86.663407] [<bf099820>] (unlink1 [usbcore]) from [<bf09bb28>] (usb_hcd_unlink_urb+0xa0/0xc0 [usbcore])

[   86.672841]  r8:a00e0093 r7:ffffff98 r6:dc988800 r5:dde56100 r4:00000000

[   86.679823] [<bf09ba88>] (usb_hcd_unlink_urb [usbcore]) from [<bf09c6d0>] (usb_unlink_urb+0x34/0x50 [usbcore])

[   86.689866]  r9:00000008 r8:ddf93000 r7:ddf920e0 r6:ddf933f0 r5:ddf933ec r4:00000001

[   86.697969] [<bf09c69c>] (usb_unlink_urb [usbcore]) from [<bf1689ec>] (deactivate_urbs.part.0+0x90/0xa4 [snd_usb_audio])

[   86.708998] [<bf16895c>] (deactivate_urbs.part.0 [snd_usb_audio]) from [<bf168a60>] (deactivate_urbs+0x60/0x6c [snd_usb_audio])

[   86.720524]  r9:00000008 r8:ddcf7bb8 r7:00000001 r6:dde79a00 r5:ddf92000 r4:00000000

[   86.728445] [<bf168a00>] (deactivate_urbs [snd_usb_audio]) from [<bf169bcc>] (snd_usb_endpoint_stop+0x38/0x64 [snd_usb_audio])

[   86.739993] [<bf169b94>] (snd_usb_endpoint_stop [snd_usb_audio]) from [<bf172e3c>] (stop_endpoints+0x78/0x90 [snd_usb_audio])

[   86.751344]  r5:00000000 r4:dde79610

[   86.755057] [<bf172dc4>] (stop_endpoints [snd_usb_audio]) from [<bf172fb8>] (snd_usb_substream_playback_trigger+0xac/0xc8 [snd_usb_audio])

[   86.767543]  r5:c0939038 r4:dde79610

[   86.771221] [<bf172f0c>] (snd_usb_substream_playback_trigger [snd_usb_audio]) from [<c051a858>] (snd_pcm_do_stop+0x58/0x5c)

[   86.782399]  r5:c0939038 r4:dde79a00

[   86.786011] [<c051a800>] (snd_pcm_do_stop) from [<c051a71c>] (snd_pcm_action_single+0x40/0x88)

[   86.794672] [<c051a6dc>] (snd_pcm_action_single) from [<c051b954>] (snd_pcm_action+0xe8/0xec)

[   86.803231]  r7:00000001 r6:c0939038 r5:dde79abc r4:dde79a00

[   86.808949] [<c051b86c>] (snd_pcm_action) from [<c051bb84>] (snd_pcm_drop+0x70/0xcc)

[   86.816724]  r7:ddeaf000 r6:ddf0dcc0 r5:dca62000 r4:dde79a00

[   86.822442] [<c051bb14>] (snd_pcm_drop) from [<c051bc60>] (snd_pcm_release_substream.part.12+0x14/0xb4)

[   86.831874]  r5:ddcf7800 r4:dde79a00

[   86.835483] [<c051bc4c>] (snd_pcm_release_substream.part.12) from [<c051bdb8>] (snd_pcm_release+0x90/0x9c)

[   86.845177]  r5:ddcf7800 r4:dde79a00

[   86.848800] [<c051bd28>] (snd_pcm_release) from [<c010546c>] (__fput+0x88/0x204)

[   86.856226]  r9:00000008 r8:00000000 r7:ddf2d198 r6:ddcda9d0 r5:dd270110 r4:ddf0dcc0

[   86.864048] [<c01053e4>] (__fput) from [<c0105640>] (____fput+0x10/0x14)

[   86.870776]  r10:00000000 r9:ddec2000 r8:c000fac4 r7:00000000 r6:c0943b38 r5:ddccf700

[   86.878675]  r4:ddccfafc

[   86.881236] [<c0105630>] (____fput) from [<c004b7ac>] (task_work_run+0x78/0xa8)

[   86.888590] [<c004b734>] (task_work_run) from [<c001300c>] (do_work_pending+0xbc/0xc0)

[   86.896540]  r7:00000006 r6:ddec3fb0 r5:c000fac4 r4:ddec2010

[   86.902262] [<c0012f50>] (do_work_pending) from [<c000f954>] (slow_work_pending+0xc/0x20)

[   86.910474]  r7:00000006 r6:00000000 r5:0004e4dc r4:0004e3d0

[   86.916187] ---[ end trace 54c43fe5f4acd401 ]---

  • I just want to add one thing.

    I was able to get a crash even with the original am335x-boneblack.dts. It just took a little longer and it happened if I interrupted aplay with ctrl-c.
  • I will forward this to the USB experts, but please note that the TI git repositories are work in progress and not guaranteed to be free of errors. This forum supports only the official TI releases: www.ti.com/.../PROCESSOR-SDK-AM335X
  • Hi

    I get the same error with the official TI release version of the kernel, although I am building with yocto and not using the sdk directly.

    SRCREV = "3639bea54a4a1e1c572a1bde78facc4e37839c12"

    git://git.ti.com/processor-sdk/processor-sdk-linux.git;protocol=git;branch=processor-sdk-linux-03.00.00 

    root@beaglebone:~# aplay out3.wav
    [ 39.136860] random: nonblocking pool is initialized
    Playing WAVE 'out3.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
    [ 39.287407] hrtimer: interrupt took 198333 ns
    [ 55.951846] ------------[ cut here ]------------
    [ 55.956624] WARNING: CPU: 0 PID: 314 at /home/andreas/src/Langedrag-Yocto/build/tmp/work-shared/beaglebone/kernel-source/drivers/usb/musb/musb_host.c:139 musb_h_tx_flush_fifo+0xdc/0xe8 [musb_hdrc]()
    [ 55.974350] musb-hdrc musb-hdrc.1.auto: Could not flush host TX2 fifo: csr: 2403
    [ 55.981777] Modules linked in: snd_usb_audio snd_hwdep snd_usbmidi_lib snd_rawmidi pruss_intc musb_dsps musb_hdrc udc_core pm33xx pru_rproc wkup_m3_ipc ti_emif_sram wkup_m3_rproc pruss omap_aes_driver omap_sham remoteproc virtio virtio_ring omap_rng rng_core musb_am335x rtc_omap omap_wdt
    [ 56.007544] CPU: 0 PID: 314 Comm: aplay Not tainted 4.4.12-g3639bea54a #1
    [ 56.014363] Hardware name: Generic AM33XX (Flattened Device Tree)
    [ 56.020482] Backtrace:
    [ 56.022978] [<c00133a4>] (dump_backtrace) from [<c00135a0>] (show_stack+0x18/0x1c)
    [ 56.030580] r7:bf07e450 r6:0000008b r5:00000009 r4:00000000
    [ 56.036309] [<c0013588>] (show_stack) from [<c0299110>] (dump_stack+0x24/0x28)
    [ 56.043579] [<c02990ec>] (dump_stack) from [<c0032668>] (warn_slowpath_common+0x88/0xb4)
    [ 56.051714] [<c00325e0>] (warn_slowpath_common) from [<c00326cc>] (warn_slowpath_fmt+0x38/0x40)
    [ 56.060449] r8:dd9d447c r7:bf08854c r6:e09dac10 r5:bf088370 r4:bf0877d0
    [ 56.067254] [<c0032698>] (warn_slowpath_fmt) from [<bf07e450>] (musb_h_tx_flush_fifo+0xdc/0xe8 [musb_hdrc])
    [ 56.077036] r3:bf086d74 r2:bf0877d0
    [ 56.080637] r4:00002403
    [ 56.083239] [<bf07e374>] (musb_h_tx_flush_fifo [musb_hdrc]) from [<bf07f54c>] (musb_cleanup_urb+0xd0/0x14c [musb_hdrc])
    [ 56.094068] r10:00000001 r9:bf08854c r8:e09dac10 r7:00000000 r6:ddd32300 r5:00000000
    [ 56.101966] r4:dd9d447c
    [ 56.104570] [<bf07f47c>] (musb_cleanup_urb [musb_hdrc]) from [<bf07fc8c>] (musb_urb_dequeue+0x150/0x158 [musb_hdrc])
    [ 56.115136] r10:00000001 r9:dde31a80 r8:00000000 r7:00020200 r6:dd9d4010 r5:a00e0093
    [ 56.123033] r4:ddd32300
    [ 56.125619] [<bf07fb3c>] (musb_urb_dequeue [musb_hdrc]) from [<c0487bd4>] (unlink1+0x38/0x158)
    [ 56.134266] r10:dca776c8 r9:00000008 r8:a00e0093 r7:ffffff98 r6:dde61600 r5:ddd32300
    [ 56.142163] r4:ddd32300 r3:bf07fb3c
    [ 56.145774] [<c0487b9c>] (unlink1) from [<c0489ea4>] (usb_hcd_unlink_urb+0xa0/0xc0)
    [ 56.153462] r8:a00e0093 r7:ffffff98 r6:dde72400 r5:ddd32300 r4:00000000
    [ 56.160236] [<c0489e04>] (usb_hcd_unlink_urb) from [<c048aa4c>] (usb_unlink_urb+0x34/0x50)
    [ 56.168534] r9:00000008 r8:dde4b000 r7:dde4a2a0 r6:dde4b3f0 r5:dde4b3ec r4:00000003
    [ 56.176532] [<c048aa18>] (usb_unlink_urb) from [<bf0d79ec>] (deactivate_urbs.part.0+0x90/0xa4 [snd_usb_audio])
    [ 56.186688] [<bf0d795c>] (deactivate_urbs.part.0 [snd_usb_audio]) from [<bf0d7a60>] (deactivate_urbs+0x60/0x6c [snd_usb_audio])
    [ 56.198215] r9:00000008 r8:ddd6a3b8 r7:00000001 r6:dde38600 r5:dde4a000 r4:00000000
    [ 56.206137] [<bf0d7a00>] (deactivate_urbs [snd_usb_audio]) from [<bf0d8bcc>] (snd_usb_endpoint_stop+0x38/0x64 [snd_usb_audio])
    [ 56.217685] [<bf0d8b94>] (snd_usb_endpoint_stop [snd_usb_audio]) from [<bf0e1e3c>] (stop_endpoints+0x78/0x90 [snd_usb_audio])
    [ 56.229037] r5:00000000 r4:dc98a010
    [ 56.232750] [<bf0e1dc4>] (stop_endpoints [snd_usb_audio]) from [<bf0e1fb8>] (snd_usb_substream_playback_trigger+0xac/0xc8 [snd_usb_audio])
    [ 56.245236] r5:c09e9a98 r4:dc98a010
    [ 56.248912] [<bf0e1f0c>] (snd_usb_substream_playback_trigger [snd_usb_audio]) from [<c05ad658>] (snd_pcm_do_stop+0x58/0x5c)
    [ 56.260090] r5:c09e9a98 r4:dde38600
    [ 56.263704] [<c05ad600>] (snd_pcm_do_stop) from [<c05ad51c>] (snd_pcm_action_single+0x40/0x88)
    [ 56.272363] [<c05ad4dc>] (snd_pcm_action_single) from [<c05ae754>] (snd_pcm_action+0xe8/0xec)
    [ 56.280922] r7:00000001 r6:c09e9a98 r5:dde386bc r4:dde38600
    [ 56.286642] [<c05ae66c>] (snd_pcm_action) from [<c05ae984>] (snd_pcm_drop+0x70/0xcc)
    [ 56.294417] r7:dc82c000 r6:dca776c0 r5:dde72c00 r4:dde38600
    [ 56.300137] [<c05ae914>] (snd_pcm_drop) from [<c05aea60>] (snd_pcm_release_substream.part.12+0x14/0xb4)
    [ 56.309569] r5:ddd6a000 r4:dde38600
    [ 56.313182] [<c05aea4c>] (snd_pcm_release_substream.part.12) from [<c05aebb8>] (snd_pcm_release+0x90/0x9c)
    [ 56.322877] r5:ddd6a000 r4:dde38600
    [ 56.326498] [<c05aeb28>] (snd_pcm_release) from [<c00fdf7c>] (__fput+0x88/0x204)
    [ 56.333924] r9:00000008 r8:00000000 r7:dddc2c38 r6:ddcedf10 r5:dd0fde58 r4:dca776c0
    [ 56.341745] [<c00fdef4>] (__fput) from [<c00fe150>] (____fput+0x10/0x14)
    [ 56.348473] r10:00000000 r9:ddd98000 r8:c000fac4 r7:00000000 r6:c09f6234 r5:dca9b600
    [ 56.356371] r4:dca9b904
    [ 56.358933] [<c00fe140>] (____fput) from [<c004be50>] (task_work_run+0x78/0xa8)
    [ 56.366285] [<c004bdd8>] (task_work_run) from [<c0013008>] (do_work_pending+0xbc/0xc0)
    [ 56.374234] r7:00000006 r6:ddd99fb0 r5:c000fac4 r4:ddd98010
    [ 56.379954] [<c0012f4c>] (do_work_pending) from [<c000f954>] (slow_work_pending+0xc/0x20)
    [ 56.388165] r7:00000006 r6:00000000 r5:0004e514 r4:0004e408
    [ 56.393875] ---[ end trace 4c645b43946d27be ]---

  • Andreas,

    Can you please confirm if this only happens when finishing the audio playback and aplay is terminating? and when you repeat the same aplay command again usb-audio still works?

    There is a known issue that the tx flush fifo error could happen when tearing down usb audio channel, but it does not break any usb function.

  • Hello Bin Liu,

    The crash indeed happens when aplay is finnishing. When I repeat the same aplay, it doesn't work. I can not use USB audio again, not even if I disconnect/connect the USB soundcard. 

    I can also mention that if I use the debian that is pre-installed on the beaglebone, which uses kernel 3.8.13-bone70, I can not reproduce the error.

  • Hi Andreas,

    Can you check the following link processors.wiki.ti.com/.../Sitara_Linux_MUSB_Issues. Make sure 7.3 b) patch is in place.
  • Hello Dwarakesh

    I checked and the patch 7.3b is already applied. It was applied in commit 68fe05e2a45181ce02ab2698930b37f20487bd24 (git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git) .

  • Andreas,


    Please let me know if the following patch fix the issue for you.

    diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
    index b7646fd..b5dbb3b 100644
    --- a/drivers/usb/musb/musb_host.c
    +++ b/drivers/usb/musb/musb_host.c
    @@ -2410,8 +2410,11 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
                     * clearing that status is platform-specific...
                     */
            } else if (ep->epnum) {
    -               musb_h_tx_flush_fifo(ep);
                    csr = musb_readw(epio, MUSB_TXCSR);
    +               if (csr & MUSB_TXCSR_FIFONOTEMPTY) {
    +                       udelay(750);
    +                       musb_h_tx_flush_fifo(ep);
    +               }
                    csr &= ~(MUSB_TXCSR_AUTOSET
                            | MUSB_TXCSR_DMAENAB
                            | MUSB_TXCSR_H_RXSTALL
    
  • Hello,

    It seems that the problem still exist with the patch included. 

    I did some more tests with the device-tree.

    - If I start with a pre-built image from the office SDK everything works fine, no crash.

    - If I add the following line to the am335x-boneblack.dts 

    &tda19988 {
    status = "disabled";
    }; 

    I do get the crash. when playing a sound file with aplay. One thing I noted was that there is an indication on the USB sound card that indicates the sampling frequency and in the case where I get the crash, it actually indicates the wrong sampling frequency. The TDS19988 is a hdmi transmitter so I don't understand how that can affect the USB sound card? 

  • I disabled tda19988 in my am335x-boneblack.dts, but I am still unable to reproduce the issue: usb-audio stops works after the tx-flush-fifo error.

    I don't know much about tda19988, but hdmi handles audio as well.
  • Hi,

    I got a simliar problem on AM3359 with linux kernel 4.4.12.
    I use a ar9271 usb wireless module in my board. If the connection of AP was dropped and do reconnect when there was data transmit on the module, sometimes i got kernel message below, and the usb moudle can not work unless i reboot the system.
    Is there any new progress on this problem?
    -------------------------------------
    [ 1169.826592] musb-hdrc musb-hdrc.1.auto: Could not flush host TX10 fifo: csr: 2503
    [ 1169.826602] Modules linked in: dial_driver(O) gpio_driver(O)
    [ 1169.826636] CPU: 0 PID: 2859 Comm: kworker/u2:1 Tainted: G O 4.4.12+ #61
    [ 1169.826648] Hardware name: Generic AM33XX (Flattened Device Tree)
    [ 1169.826675] Workqueue: phy1 ieee80211_scan_work
    [ 1169.826685] Backtrace:
    [ 1169.826721] [<c0012b70>] (dump_backtrace) from [<c0012d0c>] (show_stack+0x18/0x1c)
    [ 1169.826731] r6:c07a2210 r5:0000008b r4:00000000 r3:dccf8000
    [ 1169.826773] [<c0012cf4>] (show_stack) from [<c0265b4c>] (dump_stack+0x20/0x28)
    [ 1169.826800] [<c0265b2c>] (dump_stack) from [<c0031044>] (warn_slowpath_common+0x7c/0xb4)
    [ 1169.826819] [<c0030fc8>] (warn_slowpath_common) from [<c0031120>] (warn_slowpath_fmt+0x38/0x40)
    [ 1169.826828] r8:c08a86fc r7:c08a8704 r6:e0916c10 r5:c086af45 r4:00002503
    [ 1169.826862] [<c00310ec>] (warn_slowpath_fmt) from [<c03b7af8>] (musb_h_tx_flush_fifo+0xd0/0xf0)
    [ 1169.826872] r3:c063376c r2:c07a2230
    [ 1169.826897] [<c03b7a28>] (musb_h_tx_flush_fifo) from [<c03b8ef0>] (musb_cleanup_urb+0xd4/0x144)
    [ 1169.826906] r10:e0916c10 r9:c08a8704 r8:00000000 r7:00000000 r6:00006f5a r5:dcd06280
    [ 1169.826930] r4:dd9bcb7c
    [ 1169.826951] [<c03b8e1c>] (musb_cleanup_urb) from [<c03b92dc>] (musb_urb_dequeue+0x14c/0x154)
    [ 1169.826960] r10:c0008500 r9:00000001 r8:dd9bc010 r7:a00f0013 r6:dce1d400 r5:dcd06280
    [ 1169.826983] r4:00000000
    [ 1169.827014] [<c03b9190>] (musb_urb_dequeue) from [<c0388554>] (unlink1+0x34/0x14c)
    [ 1169.827024] r10:000007d0 r9:00000001 r8:fffffffe r7:fffffffe r6:dddc3a00 r5:dcd06280
    [ 1169.827046] r4:00000000 r3:c03b9190
    [ 1169.827071] [<c0388520>] (unlink1) from [<c0389f68>] (usb_hcd_unlink_urb+0xa0/0xc0)
    [ 1169.827080] r8:fffffffe r7:dcdcc000 r6:600f0013 r5:dcd06280 r4:00000000 r3:dcdcc000
    [ 1169.827116] [<c0389ec8>] (usb_hcd_unlink_urb) from [<c038b1e8>] (usb_kill_urb+0x54/0xcc)
    [ 1169.827125] r8:dc9aa000 r7:00000000 r6:dcb7863c r5:dcd0628c r4:dcd06280 r3:00000001
    [ 1169.827159] [<c038b194>] (usb_kill_urb) from [<c036ce24>] (hif_usb_stop+0x114/0x140)
    [ 1169.827168] r6:dcb7863c r5:dcb78620 r4:dcb78600
    [ 1169.827191] [<c036cd10>] (hif_usb_stop) from [<c036bc4c>] (htc_stop+0x1c/0x20)
    [ 1169.827200] r7:00000000 r6:dc9a83a0 r5:dc9a8fbc r4:dc9a8c00
    [ 1169.827229] [<c036bc30>] (htc_stop) from [<c036f81c>] (ath9k_htc_tx_drain+0x50/0x230)
    [ 1169.827251] [<c036f7cc>] (ath9k_htc_tx_drain) from [<c03727b0>] (ath9k_htc_config+0x108/0x5c4)
    [ 1169.827260] r7:00000000 r6:dc9a83a0 r5:00000040 r4:dc9a8c00
    [ 1169.827301] [<c03726a8>] (ath9k_htc_config) from [<c0580c58>] (ieee80211_hw_config+0x58/0x294)
    [ 1169.827310] r10:dcdcd17c r9:dc969460 r8:00000000 r7:00000040 r6:00000040 r5:00000014
    [ 1169.827333] r4:dc9a83a0
    [ 1169.827354] [<c0580c00>] (ieee80211_hw_config) from [<c05895dc>] (ieee80211_scan_work+0x240/0x4b0)
    [ 1169.827363] r8:dc9a8940 r7:dc9a83a0 r6:dc9a83a8 r5:dc9a89e8 r4:dcca9540
    [ 1169.827396] [<c058939c>] (ieee80211_scan_work) from [<c0045ed8>] (process_one_work+0x128/0x360)
    [ 1169.827405] r10:00000000 r9:dce1d300 r8:00000000 r7:dcb72f00 r6:dd802800 r5:dc9a89e8
    [ 1169.827428] r4:dce1d300
    [ 1169.827445] [<c0045db0>] (process_one_work) from [<c0046308>] (worker_thread+0x1bc/0x594)
    [ 1169.827454] r10:dd802800 r9:dce1d300 r8:00000088 r7:dce1d318 r6:00000001 r5:dd802810
    [ 1169.827477] r4:dd802800
    [ 1169.827500] [<c004614c>] (worker_thread) from [<c004b8fc>] (kthread+0xd4/0xf0)
    [ 1169.827509] r10:00000000 r9:00000000 r8:00000000 r7:c004614c r6:dce1d300 r5:dce1e740
    [ 1169.827531] r4:00000000
    [ 1169.827552] [<c004b828>] (kthread) from [<c000fc38>] (ret_from_fork+0x14/0x3c)
    [ 1169.827560] r7:00000000 r6:00000000 r5:c004b828 r4:dce1e740
    [ 1169.827580] ---[ end trace 22ca9cb4d94ec9f8 ]---
    ~ #
  • Andreas,

    This kernel dump is a known issue which could happen sometimes while tearing down an USB TX endpoint which is actively transmitting USB packets, but we haven't found any functional impact.

    Andreas Hansson64 said:
    When I play a wav-file, the kernel crashes after a few seconds with the message: musb-hdrc musb-hdrc.1.auto: Could not flush host TX2 fifo:

    Does this happen in the middle of the audio playback or it is to the end of the wav file? The wav file is more than a few seconds long?

    After the kernel dump happens, can you hear the audio if replay the wav file?

  • user4846909 said:
    I use a ar9271 usb wireless module in my board. If the connection of AP was dropped and do reconnect when there was data transmit on the module, sometimes i got kernel message below, and the usb moudle can not work unless i reboot the system.

    Instead of reboot the system, can you reconnect the wifi after unplug and plug back the ar9271 module?

  • The ar9271 module is embedded in my device, it's inconvenient to do unplug and plug operation. But there is a reset pin on the module. When the warning message occured, i reset the module, and can observe unplug and plug information of ar9271 in dmesg output, but the module still can not work.

    I've found something new of this problem. When i use old kernel 3.8.13, the ar9271 worked normally. So i use code bellow in 4.4.12 and do the test. The device worked fine now,  it seems that the prolem was fixed. I think the mdelay(1) have take effect.

    ==========
    /*
    * Clear TX fifo. Needed to avoid BABBLE errors.
    */
    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 | MUSB_TXCSR_TXPKTRDY;
    musb_writew(epio, MUSB_TXCSR, csr);
    csr = musb_readw(epio, MUSB_TXCSR);
    if (WARN(retries-- < 1,
    "Could not flush host TX%d fifo: csr: %04x\n",
    ep->epnum, csr))
    return;
    mdelay(1);
    }
    }

  • Bin Liu said:

    Does this happen in the middle of the audio playback or it is to the end of the wav file? The wav file is more than a few seconds long?

    After the kernel dump happens, can you hear the audio if replay the wav file?

    Hi Bin Liu

    This happens at the end of the playback, the complete file is always played until finished. 

    If I replay the wav file, sometimes it works and sometimes it doesn't.

    If I replay the same file over and over again, eventuelly I will always end in a situation where I can no longer play a file.

    BR
    Andreas

  • Andreas,

    Is it possible to test with any relatively new kernel from kernel.org? for example v4.4, v4.9 or v4.11?

    I recently got an issue report that it seems the community v4.4 kernel doesn't have such issue, but TI Processor SDK v4.4 kernel does. I haven't got a chance to investigate this yet.

    I'd like to know if the issue you have is the same, if you could try a kernel from kernel.org.

  • user4846909,

    Yeah, it seems mdelay(1) plays some magic here in your use case. I will try to see if I can add it back without an impact.
    I might need your help to test patches once I cooked something.
  • user4846909,

    Can you please test the patches attached below? It basically the same - adding the 1ms delay back, but with another patch together to solve a separate issue.

    musb-fifo-flush-fixes.tar.gz

  • Hi,
    I have tested the patches, my device worked fine.
  • user4846909,

    Thanks for validating the patches. I have submitted them to the mainline community. They probably will get into mainline kernel in a few weeks, then I will pull them into TI Processor SDK kernel.

  • Andreas,

    Andreas Hansson64 said:

    This happens at the end of the playback, the complete file is always played until finished. 

    If I replay the wav file, sometimes it works and sometimes it doesn't.

    I am able to replicate the issue. Please let me know if the following patch solve the issue for you.

    diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
    index 5f9a64ae3ca7..cb78369ac397 100644
    --- a/drivers/usb/musb/musb_cppi41.c
    +++ b/drivers/usb/musb/musb_cppi41.c
    @@ -554,6 +554,7 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel)
     
            list_del_init(&cppi41_channel->tx_check);
            if (is_tx) {
    +               udelay(10);
                    csr = musb_readw(epio, MUSB_TXCSR);
                    csr &= ~MUSB_TXCSR_DMAENAB;
                    musb_writew(epio, MUSB_TXCSR, csr);