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.

crash due to USB issue

Other Parts Discussed in Thread: AM3352

Hi,

The HW is configured to have 1 USB host and 1 USB device

commands to set USB:

modprobe g_serial
modprobe usbserial vendor=0x0525 product=0xa4a7

These two USB I/F are connected together for simple EMI test purpose.

Once I try to send text payload from ttyGS0 to ttyUSB0. like:

echo ddddd > /dev/ttyGS0
/flash # echo ddddd > /dev/ttyGS0
/flash # echo ddddd > /dev/ttyGS0
/flash # tail /dev/ttyUSB0

I will get crash message like:

[   58.150830] WARNING: CPU: 0 PID: 895 at /opt/pack/linux-3.14.26-g2489c02/drivers/usb/musb/musb_host.c:128 musb_h_tx_flush_fifo+0x60/0x98()
[   58.163885] Could not flush host TX2 fifo: csr: 2103
[   58.169100] Modules linked in: usbserial usb_f_acm u_serial g_serial libcomposite c_can_platform c_can can_dev
[   58.179718] CPU: 0 PID: 895 Comm: tail Not tainted 3.14.26 #1
[   58.185754] Backtrace:
[   58.188386] [<c0010d8c>] (dump_backtrace) from [<c0010f28>] (show_stack+0x18/0x1c)
[   58.196336]  r6:c06666b2 r5:00000009 r4:c7215bd0 r3:b4eb9ef5
[   58.202357] [<c0010f10>] (show_stack) from [<c04ca368>] (dump_stack+0x20/0x28)
[   58.209978] [<c04ca348>] (dump_stack) from [<c00350e8>] (warn_slowpath_common+0x6c/0x8c)
[   58.218498] [<c003507c>] (warn_slowpath_common) from [<c00351ac>] (warn_slowpath_fmt+0x38/0x40)
[   58.227630]  r8:c06fd408 r7:c745847c r6:00000000 r5:00002103 r4:c8874c12
[   58.234751] [<c0035178>] (warn_slowpath_fmt) from [<c03605b0>] (musb_h_tx_flush_fifo+0x60/0x98)
[   58.243883]  r3:00000002 r2:c06666f0
[   58.247683] [<c0360550>] (musb_h_tx_flush_fifo) from [<c0361998>] (musb_cleanup_urb+0x58/0xa0)
[   58.256723]  r8:00000001 r7:c71ade00 r6:00000000 r5:c745847c r4:c8874c10
[   58.263839] [<c0361940>] (musb_cleanup_urb) from [<c0361adc>] (musb_urb_dequeue+0xfc/0x144)
[   58.272607]  r7:c0008200 r6:a0000013 r5:c71ade00 r4:c715b980
[   58.278620] [<c03619e0>] (musb_urb_dequeue) from [<c033ba10>] (unlink1+0xe8/0xf4)
[   58.286476]  r10:c75026c8 r9:00000000 r8:fffffffe r7:fffffffe r6:60000013 r5:c71ade00
[   58.294761]  r4:c7430400 r3:c03619e0
[   58.298558] [<c033b928>] (unlink1) from [<c033cf54>] (usb_hcd_unlink_urb+0x94/0xb0)
[   58.306596]  r8:00000010 r7:fffffffe r6:60000013 r5:c71ade00 r4:00000000 r3:c732e000
[   58.314812] [<c033cec0>] (usb_hcd_unlink_urb) from [<c033e0c8>] (usb_kill_urb+0x54/0xcc)
[   58.323307]  r7:c75026c0 r6:c7278000 r5:c71ade0c r4:c71ade00
[   58.329381] [<c033e074>] (usb_kill_urb) from [<bf039530>] (usb_serial_generic_close+0x24/0x98 [usbserial])
[   58.339517]  r6:c7278000 r5:c750cc84 r4:c750cc00
[   58.344466] [<bf03950c>] (usb_serial_generic_close [usbserial]) from [<bf03702c>] (serial_port_shutdown+0x2c/0x30 [usbserial])
[   58.356422]  r5:c750cc84 r4:c750cc04
[   58.360243] [<bf037000>] (serial_port_shutdown [usbserial]) from [<c02c9d90>] (tty_port_shutdown+0x80/0x8c)
[   58.370491] [<c02c9d10>] (tty_port_shutdown) from [<c02caa70>] (tty_port_close+0x2c/0x60)
[   58.379076]  r6:00000000 r5:c750cc04 r4:c7278000 r3:00000000
[   58.385106] [<c02caa44>] (tty_port_close) from [<bf0376b0>] (serial_close+0x24/0x28 [usbserial])
[   58.394328]  r5:00000000 r4:c7278000
[   58.398159] [<bf03768c>] (serial_close [usbserial]) from [<c02c2290>] (tty_release+0x130/0x528)
[   58.407332] [<c02c2160>] (tty_release) from [<c00d05f8>] (__fput+0xe0/0x220)
[   58.414734]  r10:c75026c8 r9:00000000 r8:00000010 r7:c7129ad0 r6:c701f150 r5:c69db210
[   58.423019]  r4:c75026c0
[   58.425717] [<c00d0518>] (__fput) from [<c00d078c>] (____fput+0x10/0x14)
[   58.432754]  r10:00000008 r9:c7215ed0 r8:c74bc7f4 r7:00000001 r6:c07170d8 r5:00000000
[   58.441038]  r4:c709f000
[   58.443749] [<c00d077c>] (____fput) from [<c004d328>] (task_work_run+0x94/0xa8)
[   58.451453] [<c004d294>] (task_work_run) from [<c0036b40>] (do_exit+0x320/0x864)
[   58.459219]  r6:00000000 r5:c74bc7c0 r4:c709f000 r3:00000000
[   58.465233] [<c0036820>] (do_exit) from [<c0037218>] (do_group_exit+0xb0/0xec)
[   58.472816]  r7:c74fe624
[   58.475529] [<c0037168>] (do_group_exit) from [<c0042bc4>] (get_signal_to_deliver+0x4d8/0x548)
[   58.484570]  r6:c7215ee4 r5:00000009 r4:c7214000 r3:00418004
[   58.490583] [<c00426ec>] (get_signal_to_deliver) from [<c04c7468>] (do_signal+0xb0/0x3d0)
[   58.499169]  r10:b6f041c8 r9:c7214000 r8:b6f041cc r7:fffffe00 r6:c7214000 r5:00000001
[   58.507453]  r4:c7215fb0
[   58.510147] [<c04c73b8>] (do_signal) from [<c0010984>] (do_work_pending+0x5c/0xac)
[   58.518095]  r10:00000000 r8:c000e4a4 r7:00000003 r6:c000e4a4 r5:c7215fb0 r4:c7214000
[   58.526405] [<c0010928>] (do_work_pending) from [<c000e360>] (work_pending+0xc/0x20)
[   58.534535]  r6:01cfe02d r5:00000003 r4:0007ad90 r3:01cfe02d
[   58.540528] ---[ end trace 6d8a347ab86f198c ]---

what's the problem?

  • Hi,

    Please post what processor and Linux version you are using.
  • Hi,

    AM3352
    Linux (none) 3.14.26 #1 PREEMPT Thu Jun 25 09:27:59 CST 2015 armv7l GNU/Linux
    CDK V01.00.00
  • AFu Lai said:
    [ 58.163885] Could not flush host TX2 fifo: csr: 2103

    We have received a couple of reports which are caused by this fifo flush issue. I will take a look at this soon and update in here.

  • Please try the patch below.

    diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
    index 883a9ad..0116f2b 100644
    --- a/drivers/usb/musb/musb_host.c
    +++ b/drivers/usb/musb/musb_host.c
    @@ -123,11 +123,11 @@ static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
                    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))
    +               if (retries-- < 1) {
    +                       dev_dbg(musb->controller, "Could not flush host TX%d fifo: csr: %04x\n",
    +                               ep->epnum, csr);
                            return;
    -               mdelay(1);
    +               }
            }
     }
    
    
  • thanks ^^

    I'll try it

  • Hi,

    I'm not sure if this is a side-effect caused by this modification.
    The program can't read anything from ttyGS0 if the cable is re-plugged.
    Also, nothing can be sent to host terminal. (nothing shown in host terminal)

    board - microcom
    host - PuTTY

    1. open ttyGS0 and then plug cable -- failed
    2. plug cable first and then open ttyGS0 -- OK

    BR,
    AFu
  • Afu,

    AFu Lai said:
    I'm not sure if this is a side-effect caused by this modification.
    The program can't read anything from ttyGS0 if the cable is re-plugged.

    Is this problem only happened after applied the patch but not before?

    By the way, I have corrected the patch in my previous post. Please revert you change and re-apply the new patch again.

  • Hi,

    I think the symptom should not be caused by the modification.

    It's another g_serial issue.

    I have re-patched the code and found something very strange.

    First, I used microcom to open ttyGS0 and ttyUSB0.

    1. type something and ENTER  to ttyGS0 (must press ENTER to send out.... )

    2. terminal@ttyUSB0 shows right response

    3. type something @ttyUSB0 .... terminal@ttyGS0 shows characters at the same time

    4. ENTER key has no function to produce a new line to ttyGS0 and ttyUSB0 (at beginning, it's okay @ttyGS0)

    5. can't terminate microcom by Ctrl+C or ^Z.

    Another test... I use my own program to catch payload read from ttyGS0.

    Then I try to send out some strings by using 'echo  xxxxxxx > /dev/ttyUSB0'

    More characters will be received.... 10 bytes sent ... but maybe 57 bytes received.