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.

Linux/AM3352: Dynamic reconfiguration of USB Gadget

Part Number: AM3352

Tool/software: Linux

Sorry, I am cross posting, original unanswered post here:

Hello,

A customer I am helping is using the AM3352 with processor SDK 02.00.01.07.

This product is in production and being used by end customers.

A new feature request has resulted in the need for a special value to be loaded by the factory.

Currently, the USB subsystem is configured as a peripheral with a mass storage gadget configuration. This has been working just fine.

To allow the factory to interact with the device in a more automated fashion, we are trying to dynamically reconfigure the gadget from a mass storage device to a serial ACM gadget device. We do NOT want both configured at the same time. We simply want to configure the USB serial port gadget in the factory only.

This does not work.

To dynamically reconfigure, I have attempted to have two possible gadgets defined, such as:

/sys/kernel/config/usb_gadget/massStorageGadget

and

/sys/kernel/config/usb_gadget/serialGadget

Then, simply disable the mass storage gadget with:

echo '' > /sys/kernel/config/usb_gadget/massStorageGadget/UDC

and enable the serial port gadget with:

echo "musb-hdrc.0.auto" > /sys/kernel/config/usb_gadget/serialGadget/UDC

This appears to work, until we connect the USB cable to the device, then we see the following error messages in dmesg:

[ 839.828577] Mass Storage Function, version: 2009/09/11
[ 839.834234] LUN: removable file: (no medium)
[ 839.920019] Number of LUNs=1
[ 839.924408] udc musb-hdrc.0.auto: registering UDC driver [massStorageGadget]
[ 839.924503] configfs-gadget gadget: adding 'Mass Storage Function'/cf558d00 to config 'c1'/cf4c9c98
[ 839.927476] configfs-gadget gadget: I/O thread pid: 310
[ 839.927544] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
[ 839.928461] mass_storage.ms0/lun.0: open backing file: /dev/mmcblk0p6
[ 888.788641] configfs-gadget musb-hdrc.0.auto: unregistering UDC driver [massStorageGadget]
[ 888.791621] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_stop
[ 888.791706] configfs-gadget gadget: unbind function 'Mass Storage Function'/cf558d00
[ 888.813452] configfs-gadget gadget: unbind
[ 896.092545] userial_init: registered 4 ttyGS* devices
[ 896.286606] udc musb-hdrc.0.auto: registering UDC driver [serialGadget]
[ 896.286763] configfs-gadget gadget: adding 'acm'/cf242e40 to config 'c1'/cc21ea98
[ 896.286837] configfs-gadget gadget: acm ttyGS0: dual speed IN/ep1in OUT/ep1out NOTIFY/ep2in
[ 896.286873] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
[ 903.351816] musb_h_ep0_irq 1164: no URB for end 0
[ 903.356656] musb_h_ep0_irq 1164: no URB for end 0
[ 904.593829] musb_h_ep0_irq 1164: no URB for end 0

<<repeats the "no URB for end 0" msg multiple times>>

Looking at the driver code, the "no URB for end 0" appears to be a fatal issue or "should not happen" error.

The host PC does not see the device at this point.

Any ideas? The only way I have found to enable the serial port is to reboot and enable only the serial gadget. I can also enable the serial and the mass storage together in a single composite gadget, which works, but that is not desired as it now requires our end-customers to configure Windows. (works great with Linux, as expected.).

Also, just disabling the mass storage gadget and reenabling the mass storage gadget results in the same "no URB for end 0" issue, and again the host PC does not see the device. I must reboot the device to enable the gadget again.

So, the questions are:

* how to dynamically reconfigure a peripheral USB setup? Is this possible?

* is there a way to "hard reset" the usb subsystem in linux without rebooting the device/linux?

* or, how can we dynamically add the serial port to the composite gadget, already configured for mass storage?

Thank you very much,

Matthew

  • The software team have been notified. They will respond here.
  • Matthew,

    Sorry for my late response.

    Matthew Eshleman said:
    how to dynamically reconfigure a peripheral USB setup? Is this possible?

    Depending how "dynamically", what triggers the reconfiguration, it is possible.

    Matthew Eshleman said:
    is there a way to "hard reset" the usb subsystem in linux without rebooting the device/linux?

    Yes, you can unbind/bind the usb controller driver, it will reset the controller.

    Matthew Eshleman said:
    how can we dynamically add the serial port to the composite gadget, already configured for mass storage?

    Attached below is a bash script I wrote a long time ago, it shows how to create a composite gadget driver with multiple functions. The script is also able to tear down the composite (with -d option), and you can run it multiple times to repeatedly create/destroy the composite. Hope this script will give you some hint how to solve your issue.

    usbconfigfs.sh.txt
    #!/bin/bash
    # $1: -d - tear down
    
    FUNCS=("acm.usb0" "ncm.usb0" "acm.usb1")
    
    CFS=/sys/kernel/config/usb_gadget
    VID="0x1d6d"
    PID="0x0104"
    LANG="0x409"
    
    init()
    {
    	zcat /proc/config.gz | grep 'CONFIGFS_FS=' > /dev/null || exit 1
    	lsmod | grep libcomposite > /dev/null || modprobe libcomposite || exit 2
    	mount | grep configfs > /devnull || 
    		mount -t configfs none $(dirname $CFS) || exit 3
    }
    
    create_gadget()
    {
    	[ ! -d ${CFS}/g1 ] || exit 5
    	mkdir ${CFS}/g1 && cd ${CFS}/g1 || exit 6
    	echo "$VID" > idVendor
    	echo "$PID" > idProduct
    
    	mkdir strings/$LANG
    	echo "0123456789" > strings/$LANG/serialnumber
    	echo "Foo Inc" > strings/$LANG/manufacturer
    	echo "Bar gadget" > strings/$LANG/product
    }
    
    # configuraton naming: configs/<name>.<number>
    create_config()
    {
    	[ -d ${CFS}/g1 ] && cd ${CFS}/g1 || exit 5
    	mkdir configs/c.1
    	mkdir configs/c.1/strings/$LANG
    	echo "conf1" > configs/c.1/strings/$LANG/configuration
    }
    
    # $1 - function name
    # function naming: functions/<name>.<instance_name>
    create_func_single()
    {
    	local _func=$1
    
    	mkdir functions/${_func} || return
    	ln -s functions/${_func} configs/c.1
    }
    
    activate()
    {
    	local _udc
    
    	_udc=$(ls /sys/class/udc/)
    	# TODO check $_udc
    	echo "$_udc" > UDC
    }
    
    teardown()
    {
    	local _ent
    
    	[ -d ${CFS}/g1 ] && cd ${CFS}/g1 || exit 5
    	echo "" > UDC
    	for _ent in $(ls configs/c.1/); do
    		[[ "$_ent" != "MaxPower" ]] || continue
    		[[ "$_ent" != "bmAttributes" ]] || continue
    		[[ "$_ent" != "strings" ]] || continue
    		rm -f configs/c.1/$_ent
    		rmdir functions/$_ent
    	done
    	rmdir configs/c.1/strings/$LANG
    	rmdir configs/c.1
    	rmdir strings/$LANG
    	cd .. && rmdir g1
    	echo "toredown"
    }
    
    ### MAIN ###
    
    [ "$1" != "-d" ] || { teardown; exit 0; }
    
    init
    create_gadget
    create_config
    for func in ${FUNCS[*]}; do
    	create_func_single $func
    done
    activate
    echo created
    
    
     

  • Hello Bin Liu,

    Thank you very much for the script. It works with the usb functions as provided in the script.

    However, as soon as I add mass storage function, then this script seems to have the same issue as my current attempts... it does not work after disable and then re-enable, and I start to see the same error message:

    "musb_h_ep0_irq 1164: no URB for end 0"

    If you have time, could you create a script that works with mass storage? Your script was basically the same as my previous approach, but we need mass storage. I'm guessing this is a driver issue still, but maybe TI knows a work around.

    So, the problem I am reporting seems to be specific to the mass storage function.

    Let me know if any additional information is needed.

    Best regards,

    Matthew

    https://covemountainsoftware.com/consulting/

  • Mattew,

    I haven't got a chance to try it yet. but does it fail only when there are other gadget functions in the composite gadget or even if there is only mass_storage.usb0 itself?

    To see the failure, do you have to connect the am335x usb port to a usb host to have the enumeration done? Or no need to connect to a usb host?

  • Yes, it happens with only the mass storage gadget.

    I perform the reconfiguration when the USB is disconnected. Then, yes, must connect to a host after the reconfiguration. This is when the error happens and nothing works. See my original post for the log and error message...

    Thank you!
  • Matthew,

    I modified my script (attached below) to create a mass_storage function, but still was unable to see the issue, I kept repeating running command "usbconfigfs.sh" and "usbconfigfs.sh -d". Can you please let me know what step I missed to trigger the failure?

    8154.usbconfigfs.sh.txt
    #!/bin/bash
    # $1: -d - tear down
    
    #FUNCS=("acm.usb0" "ncm.usb0" "acm.usb1")
    FUNCS=("mass_storage.usb0")
    
    CFS=/sys/kernel/config/usb_gadget
    VID="0x1d6d"
    PID="0x0104"
    LANG="0x409"
    
    init()
    {
    	zcat /proc/config.gz | grep 'CONFIGFS_FS=' > /dev/null || exit 1
    	lsmod | grep libcomposite > /dev/null || modprobe libcomposite || exit 2
    	mount | grep configfs > /devnull || 
    		mount -t configfs none $(dirname $CFS) || exit 3
    }
    
    create_gadget()
    {
    	[ ! -d ${CFS}/g1 ] || exit 5
    	mkdir ${CFS}/g1 && cd ${CFS}/g1 || exit 6
    	echo "$VID" > idVendor
    	echo "$PID" > idProduct
    
    	mkdir strings/$LANG
    	echo "0123456789" > strings/$LANG/serialnumber
    	echo "Foo Inc" > strings/$LANG/manufacturer
    	echo "Bar gadget" > strings/$LANG/product
    }
    
    # configuraton naming: configs/<name>.<number>
    create_config()
    {
    	[ -d ${CFS}/g1 ] && cd ${CFS}/g1 || exit 5
    	mkdir configs/c.1
    	mkdir configs/c.1/strings/$LANG
    	echo "conf1" > configs/c.1/strings/$LANG/configuration
    }
    
    # $1 - function name
    # function naming: functions/<name>.<instance_name>
    create_func_single()
    {
    	local _func=$1
    
    	mkdir functions/${_func} || return
    	[ "${_func%.*}" != "mass_storage" ] || {
    		dd if=/dev/zero of=/dev/shm/gmsc.file bs=1M count=32
    		echo /dev/shm/gmsc.file > functions/${_func}/lun.0/file
    	}
    	ln -s functions/${_func} configs/c.1
    }
    
    activate()
    {
    	local _udc
    
    	_udc=$(ls /sys/class/udc/)
    	# TODO check $_udc
    	echo "$_udc" > UDC
    }
    
    teardown()
    {
    	local _ent
    
    	[ -d ${CFS}/g1 ] && cd ${CFS}/g1 || exit 5
    	echo "" > UDC
    	for _ent in $(ls configs/c.1/); do
    		[[ "$_ent" != "MaxPower" ]] || continue
    		[[ "$_ent" != "bmAttributes" ]] || continue
    		[[ "$_ent" != "strings" ]] || continue
    		rm -f configs/c.1/$_ent
    		rmdir functions/$_ent
    	done
    	rmdir configs/c.1/strings/$LANG
    	rmdir configs/c.1
    	rmdir strings/$LANG
    	cd .. && rmdir g1
    	echo "toredown"
    }
    
    ### MAIN ###
    
    [ "$1" != "-d" ] || { teardown; exit 0; }
    
    init
    create_gadget
    create_config
    for func in ${FUNCS[*]}; do
    	create_func_single $func
    done
    activate
    echo created
    
    

  • Very strange. I was certainly able to reproduce with the previous script the other day, but now I am unable to reproduce with either the previous script or the new script.

    I will continue to investigate the differences. I greatly appreciate your responses and help.

    One thing that might help as I move forward, what exactly does this error message mean or imply? Maybe if I understood the message, it might help...

    [ 903.351816] musb_h_ep0_irq 1164: no URB for end 0


    Thank you again for the help!

    Matthew

  • Never mind. Trying again and suddenly this error happened again. There must be a subtle timing issue involved? Not sure.

    Attached is the log where this issue happened again, using the new script. Steps to reproduce:

    1) Use SDK 02.00.01.07.

    2) run script

    3) connect to PC. Confirm valid connection.

    4) run script -d (teardown)

    5) disconnect (not sure if it matter when you disconnect)

    6) run script

    7) reconnect to PC

    8) confirm connection, check dmesg on device too.

    9) repeat.

    In the past this issue happened immediately at step 7. But today I had to repeat all steps maybe 10 times before it happened.

    Also, as you will see in the captured dmesg output, I also swapped between serial port and mass storage configurations. Maybe that is key point.

    Thank you again,

    Matthew

    dmesgLogUsbIssue.txt
    [  926.422951] configfs-gadget musb-hdrc.0.auto: unregistering UDC driver [g1]
    [  926.429649] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_stop
    [  926.429769] configfs-gadget gadget: unbind function 'Mass Storage Function'/cc3b2c00
    [  926.444384] configfs-gadget gadget: unbind
    [  934.625871] userial_init: registered 4 ttyGS* devices
    [  934.675352] udc musb-hdrc.0.auto: registering UDC driver [g1]
    [  934.675462] configfs-gadget gadget: adding 'acm'/cc28c000 to config 'c'/cf4eee98
    [  934.675506] configfs-gadget gadget: acm ttyGS0: dual speed IN/ep1in OUT/ep1out NOTIFY/ep2in
    [  934.675526] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
    [  946.465532] configfs-gadget gadget: high-speed config #1: c
    [  946.469389] configfs-gadget gadget: activate acm ttyGS0
    [  946.469432] configfs-gadget gadget: acm ttyGS0 serial state 0000
    [  946.862054] configfs-gadget gadget: acm ttyGS0 req21.22 v0000 i0000 l0
    [  946.862417] configfs-gadget gadget: acm ttyGS0 req21.20 v0000 i0000 l7
    [  946.867686] configfs-gadget gadget: acm ttyGS0 req21.22 v0003 i0000 l0
    [  946.868870] configfs-gadget gadget: acm ttyGS0 req21.20 v0000 i0000 l7
    [  946.869224] configfs-gadget gadget: acm ttyGS0 req21.22 v0002 i0000 l0
    [  946.971136] configfs-gadget gadget: acm ttyGS0 req21.22 v0003 i0000 l0
    [  957.651320] configfs-gadget gadget: acm ttyGS0 req21.22 v0000 i0000 l0
    [  957.655952] configfs-gadget gadget: acm ttyGS0 req21.22 v0003 i0000 l0
    [  957.657014] configfs-gadget gadget: acm ttyGS0 req21.22 v0002 i0000 l0
    [  957.758337] configfs-gadget gadget: acm ttyGS0 req21.22 v0003 i0000 l0
    [  967.627392] configfs-gadget gadget: acm ttyGS0 req21.22 v0000 i0000 l0
    [  967.631030] configfs-gadget gadget: acm ttyGS0 req21.22 v0003 i0000 l0
    [  967.631715] configfs-gadget gadget: acm ttyGS0 req21.20 v0000 i0000 l7
    [  973.627592] configfs-gadget gadget: acm ttyGS0 req21.22 v0000 i0000 l0
    [  996.129287] gs_open: start ttyGS0
    [  996.129504] configfs-gadget gadget: acm ttyGS0 serial state 0003
    [  996.129545] gs_open: ttyGS0 (cf474000,cf470600)
    [  996.430535] hrtimer: interrupt took 204662 ns
    [  998.945042] configfs-gadget gadget: acm ttyGS0 req21.22 v0003 i0000 l0
    [  998.946131] configfs-gadget gadget: acm ttyGS0 req21.22 v0000 i0000 l0
    [  999.832950] configfs-gadget gadget: acm ttyGS0 req21.22 v0003 i0000 l0
    [  999.834052] configfs-gadget gadget: acm ttyGS0 req21.22 v0000 i0000 l0
    [ 1004.092540] gs_close: ttyGS0 (cf474000,cf470600) ...
    [ 1004.092579] gs_close: ttyGS0 (cf474000,cf470600) done!
    [ 1011.463181] configfs-gadget musb-hdrc.0.auto: unregistering UDC driver [g1]
    [ 1011.475571] configfs-gadget gadget: reset config
    [ 1011.475612] configfs-gadget gadget: acm ttyGS0 deactivated
    [ 1011.475844] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_stop
    [ 1011.475895] configfs-gadget gadget: unbind function 'acm'/cc28c000
    [ 1019.334661] Mass Storage Function, version: 2009/09/11
    [ 1019.336857] LUN: removable file: (no medium)
    [ 1019.603047] mass_storage.usb0/lun.0: open backing file: /dev/shm/gmsc.file
    [ 1019.611137] Number of LUNs=1
    [ 1019.626145] udc musb-hdrc.0.auto: registering UDC driver [g1]
    [ 1019.626462] configfs-gadget gadget: adding 'Mass Storage Function'/cc069b80 to config 'c'/cf556c98
    [ 1019.628912] configfs-gadget gadget: I/O thread pid: 472
    [ 1019.628978] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
    [ 1029.545177] configfs-gadget gadget: high-speed config #1: c
    [ 1029.548995] configfs-gadget gadget: set_config: interface 0 (Mass Storage Function) requested delayed status
    [ 1029.549022] configfs-gadget gadget: delayed_status count 1
    [ 1029.549220] configfs-gadget gadget: usb_composite_setup_continue
    [ 1029.549250] configfs-gadget gadget: usb_composite_setup_continue: Completing delayed status
    [ 1030.559768] configfs-gadget gadget: sending command-failure status
    [ 1063.571107] configfs-gadget musb-hdrc.0.auto: unregistering UDC driver [g1]
    [ 1063.574173] configfs-gadget gadget: reset config
    [ 1063.574300] configfs-gadget gadget: bulk_out_complete --> -104, 0/31
    [ 1063.574346] configfs-gadget gadget: reset interface
    [ 1063.574477] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_stop
    [ 1063.574569] configfs-gadget gadget: unbind function 'Mass Storage Function'/cc069b80
    [ 1063.595657] configfs-gadget gadget: unbind
    [ 1063.651439] lun.0: close backing file
    [ 1947.069564] Mass Storage Function, version: 2009/09/11
    [ 1947.071380] LUN: removable file: (no medium)
    [ 1947.314559] mass_storage.usb0/lun.0: open backing file: /dev/shm/gmsc.file
    [ 1947.322404] Number of LUNs=1
    [ 1947.337428] udc musb-hdrc.0.auto: registering UDC driver [g1]
    [ 1947.337524] configfs-gadget gadget: adding 'Mass Storage Function'/cc328200 to config 'c'/cf556c98
    [ 1947.337726] configfs-gadget gadget: I/O thread pid: 501
    [ 1947.337768] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
    [ 1956.672730] configfs-gadget musb-hdrc.0.auto: unregistering UDC driver [g1]
    [ 1956.675799] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_stop
    [ 1956.675922] configfs-gadget gadget: unbind function 'Mass Storage Function'/cc328200
    [ 1956.696320] configfs-gadget gadget: unbind
    [ 1956.751060] lun.0: close backing file
    [ 1962.822227] Mass Storage Function, version: 2009/09/11
    [ 1962.824213] LUN: removable file: (no medium)
    [ 1963.100547] mass_storage.usb0/lun.0: open backing file: /dev/shm/gmsc.file
    [ 1963.108413] Number of LUNs=1
    [ 1963.123511] udc musb-hdrc.0.auto: registering UDC driver [g1]
    [ 1963.123608] configfs-gadget gadget: adding 'Mass Storage Function'/cc069280 to config 'c'/cf556c98
    [ 1963.123808] configfs-gadget gadget: I/O thread pid: 528
    [ 1963.123849] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
    [ 1963.123926] musb_stage0_irq 856: unhandled DISCONNECT transition (a_idle)
    [ 1965.424847] musb_h_ep0_irq 1164: no URB for end 0
    [ 1965.428641] musb_h_ep0_irq 1164: no URB for end 0
    [ 1966.666040] musb_h_ep0_irq 1164: no URB for end 0
    [ 1966.669907] musb_h_ep0_irq 1164: no URB for end 0
    [ 1968.040252] musb_h_ep0_irq 1164: no URB for end 0
    [ 1968.044095] musb_h_ep0_irq 1164: no URB for end 0
    [ 1969.681620] musb_h_ep0_irq 1164: no URB for end 0
    [ 1969.685515] musb_h_ep0_irq 1164: no URB for end 0
    [ 1971.801009] musb_h_ep0_irq 1164: no URB for end 0
    [ 1971.804882] musb_h_ep0_irq 1164: no URB for end 0
    [ 1974.875495] musb_h_ep0_irq 1164: no URB for end 0
    [ 1974.879426] musb_h_ep0_irq 1164: no URB for end 0
    [ 1979.915860] musb_h_ep0_irq 1164: no URB for end 0
    [ 1979.919808] musb_h_ep0_irq 1164: no URB for end 0
    [ 1988.841643] musb_h_ep0_irq 1164: no URB for end 0
    [ 1988.845688] musb_h_ep0_irq 1164: no URB for end 0
    [ 2003.684258] musb_stage0_irq 856: unhandled DISCONNECT transition (a_idle)
    [ 2009.045041] musb_h_ep0_irq 1164: no URB for end 0
    [ 2009.048989] musb_h_ep0_irq 1164: no URB for end 0
    [ 2010.285925] musb_h_ep0_irq 1164: no URB for end 0
    [ 2010.289891] musb_h_ep0_irq 1164: no URB for end 0
    [ 2011.659618] musb_h_ep0_irq 1164: no URB for end 0
    [ 2011.663611] musb_h_ep0_irq 1164: no URB for end 0
    [ 2013.302133] musb_h_ep0_irq 1164: no URB for end 0
    [ 2013.306058] musb_h_ep0_irq 1164: no URB for end 0
    [ 2015.423503] musb_h_ep0_irq 1164: no URB for end 0
    [ 2015.427443] musb_h_ep0_irq 1164: no URB for end 0
    [ 2018.497416] musb_h_ep0_irq 1164: no URB for end 0
    [ 2018.501430] musb_h_ep0_irq 1164: no URB for end 0
    

  • Matthew Eshleman said:
    [ 903.351816] musb_h_ep0_irq 1164: no URB for end 0

    Ahh, I should have paid more attention to this log message. I know "no URB for end 0" means endpoint0 got an interrupt but the ISR doesn't find a URB in the queue to process, it is an error condition which shouldn't happen. But only until now I just realized the log message has "musb_h_ep0_irq", which is a host mode function. This function shouldn't be called because the usb controller is supposed to be in peripheral mode in this use case.

    There is a driver bug in the older kernels but fixed in the newer kernels, which didn't check the controller mode correctly in a corner case. I guess that might be the reason the driver went into a wrong route - host mode. Is it possible for you to switch to the latest AM335x kernel to test if the issue still happens?

  • Since this device is already in the market, we are worried about changing the kernel at this time. I *can* change it as an experiment. But, curious, is there an exact patch that might help?

    Anyhow, which SDK kernel closest to our SDK 02.00.01.07 has this fix?
  • Matthew,

    I just checked the kernel in SDK 2.0.1.7 which should already have the fix. Can you please attach your drivers/usb/musb/musb_core.c? I'd like to double check.

    What is the usb dr_mode setting in your dts file?
  • Our DTS file has:

    &usb0 {

    status = "okay";

    dr_mode = "peripheral";

    };

    and attached is the musb_core.c file.

    thank you!

    musb_core.c

  • Mattew,

    I found a place in the driver which is suspicious. Can you please apply the following debug patch in the SDK 2.0.1.7 kernel and see if the dev_err message shows in the log when the issue happens?

    diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
    index 4c481cd66c77..a05f6f39dbf8 100644
    --- a/drivers/usb/musb/musb_gadget.c
    +++ b/drivers/usb/musb/musb_gadget.c
    @@ -2005,7 +2005,7 @@ void musb_g_disconnect(struct musb *musb)
     
            switch (musb->xceiv->otg->state) {
            default:
    -               dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n",
    +               dev_err(musb->controller, "Unhandled disconnect %s, setting a_idle\n",
                            usb_otg_state_string(musb->xceiv->otg->state));
                    musb->xceiv->otg->state = OTG_STATE_A_IDLE;
                    MUSB_HST_MODE(musb);
    
  • Thanks Mattew, your dts and musb_core.c look correct.
  • Hi,

    Ok, I rebuilt kernel and modules and installed with your requested change.

    I then did the following:

    * confirmed our normal application is working correctly (quick check)

    * reboot

    * ssh

    * run your new script creating mass storage device

    * connect to PC

    * do nothing (I recall than in previous actions I formatted the resulting drive to FAT, this time I did nothing)

    * remove cable (I did NOT eject or perform any action on the host PC)

    * run script with -d (tear down)

    * run script for serial port only configuration

    * connect cable.

    * error, nothing works. (this time happened first attempt)

    Attached is dmesg output.

    dmesgLogUsbIssueWithChange.txt
    [   48.827062] Mass Storage Function, version: 2009/09/11
    [   48.827201] LUN: removable file: (no medium)
    [   49.072251] mass_storage.usb0/lun.0: open backing file: /dev/shm/gmsc.file
    [   49.083009] Number of LUNs=1
    [   49.097678] udc musb-hdrc.0.auto: registering UDC driver [g1]
    [   49.097777] configfs-gadget gadget: adding 'Mass Storage Function'/cc311080 to config 'c'/cf477a98
    [   49.097977] configfs-gadget gadget: I/O thread pid: 311
    [   49.098021] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
    [   58.008061] configfs-gadget gadget: high-speed config #1: c
    [   58.008311] configfs-gadget gadget: set_config: interface 0 (Mass Storage Function) requested delayed status
    [   58.008336] configfs-gadget gadget: delayed_status count 1
    [   58.008528] configfs-gadget gadget: usb_composite_setup_continue
    [   58.008556] configfs-gadget gadget: usb_composite_setup_continue: Completing delayed status
    [   58.019100] configfs-gadget gadget: sending command-failure status
    [   70.258483] configfs-gadget gadget: suspend
    [   70.423887] configfs-gadget gadget: reset config
    [   70.424033] configfs-gadget gadget: bulk_out_complete --> -104, 0/31
    [   70.424076] configfs-gadget gadget: reset interface
    [   75.945658] configfs-gadget musb-hdrc.0.auto: unregistering UDC driver [g1]
    [   75.953791] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_stop
    [   75.953911] configfs-gadget gadget: unbind function 'Mass Storage Function'/cc311080
    [   75.954170] configfs-gadget gadget: unbind
    [   76.023773] lun.0: close backing file
    [   86.706164] userial_init: registered 4 ttyGS* devices
    [   86.747710] udc musb-hdrc.0.auto: registering UDC driver [g1]
    [   86.747806] configfs-gadget gadget: adding 'acm'/cf352e40 to config 'c'/cc23d098
    [   86.747844] configfs-gadget gadget: acm ttyGS0: dual speed IN/ep1in OUT/ep1out NOTIFY/ep2in
    [   86.747862] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
    [   91.068823] musb_h_ep0_irq 1164: no URB for end 0
    [   91.069066] musb_h_ep0_irq 1164: no URB for end 0
    [   92.308612] musb_h_ep0_irq 1164: no URB for end 0
    [   92.308851] musb_h_ep0_irq 1164: no URB for end 0
    [   93.679367] musb_h_ep0_irq 1164: no URB for end 0
    [   93.679585] musb_h_ep0_irq 1164: no URB for end 0
    [   95.319003] musb_h_ep0_irq 1164: no URB for end 0
    [   95.319214] musb_h_ep0_irq 1164: no URB for end 0
    [   97.435975] musb_h_ep0_irq 1164: no URB for end 0
    [   97.439913] musb_h_ep0_irq 1164: no URB for end 0
    [  100.515156] musb_h_ep0_irq 1164: no URB for end 0
    [  100.519133] musb_h_ep0_irq 1164: no URB for end 0
    [  105.566360] musb_h_ep0_irq 1164: no URB for end 0
    [  105.570399] musb_h_ep0_irq 1164: no URB for end 0
    [  108.473074] musb_stage0_irq 856: unhandled DISCONNECT transition (a_idle)
    root@AlbrightDev:~# 
    

  • mattew,

    I am still not able to reproduce the issue on my side yet.

    The last line of the dmesg log "unhandled DISCONNECT transition (a_idle)" happened in before, before applied the debug patch, right?

    Somehow the driver ran into host mode, and the usb controller generated disconnect event. I am not sure how, never saw this issue before.

    Can you please revert the last debug patch and apply the following one? Hope it will give some glue on what was happening.

    usbgadgetfs-debug.diff.txt
    diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
    index 08a69f4f4d5a..ec06a34058c6 100644
    --- a/drivers/usb/musb/musb_core.c
    +++ b/drivers/usb/musb/musb_core.c
    @@ -741,6 +741,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
     					+ msecs_to_jiffies(musb->a_wait_bcon));
     			break;
     		case OTG_STATE_A_HOST:
    +			dev_err(musb_controller, "got SUSPEND intr with A_HOST state\n");
     			musb->xceiv->otg->state = OTG_STATE_A_SUSPEND;
     			musb->is_active = musb->hcd->self.b_hnp_enable;
     			break;
    @@ -1586,9 +1587,9 @@ irqreturn_t musb_interrupt(struct musb *musb)
     
     	devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
     
    -	dev_dbg(musb->controller, "** IRQ %s usb%04x tx%04x rx%04x\n",
    +	dev_err(musb->controller, "** IRQ %s usb%04x\n",
     		is_host_active(musb) ? "host" : "peripheral",
    -		musb->int_usb, musb->int_tx, musb->int_rx);
    +		musb->int_usb);
     
     	/**
     	 * According to Mentor Graphics' documentation, flowchart on page 98,
    diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
    index 4c481cd66c77..f570a5c24a1b 100644
    --- a/drivers/usb/musb/musb_gadget.c
    +++ b/drivers/usb/musb/musb_gadget.c
    @@ -2011,6 +2011,7 @@ void musb_g_disconnect(struct musb *musb)
     		MUSB_HST_MODE(musb);
     		break;
     	case OTG_STATE_A_PERIPHERAL:
    +		dev_err(musb->controller, "g_disconnect with A_PERI state\n");
     		musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
     		MUSB_HST_MODE(musb);
     		break;
    @@ -2087,6 +2088,7 @@ __acquires(musb->lock)
     		musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL;
     		musb->g.is_a_peripheral = 0;
     	} else {
    +		dev_err(musb->controller, "g_reset, devctl 0x%02x\n", devctl);
     		musb->xceiv->otg->state = OTG_STATE_A_PERIPHERAL;
     		musb->g.is_a_peripheral = 1;
     	}
    diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
    index 4731baca377f..6501cb6fa275 100644
    --- a/drivers/usb/musb/musb_virthub.c
    +++ b/drivers/usb/musb/musb_virthub.c
    @@ -227,6 +227,7 @@ void musb_root_disconnect(struct musb *musb)
     	switch (musb->xceiv->otg->state) {
     	case OTG_STATE_A_SUSPEND:
     		if (otg->host->b_hnp_enable) {
    +			dev_err(musb->controller, "root_disconnect with A_SUSPEND state\n");
     			musb->xceiv->otg->state = OTG_STATE_A_PERIPHERAL;
     			musb->g.is_a_peripheral = 1;
     			break;
    

  • Sorry there is a typo in the patch in the previous post. Line 9 is
    dev_err(musb_controller, ...)
    which should be
    dev_err(musb->controller, ...)
  • Please use the following debug patch instead.

    1374.usbgadgetfs-debug.diff.txt
    diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
    index 08a69f4f4d5a..a86d238a8072 100644
    --- a/drivers/usb/musb/musb_core.c
    +++ b/drivers/usb/musb/musb_core.c
    @@ -741,6 +741,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
     					+ msecs_to_jiffies(musb->a_wait_bcon));
     			break;
     		case OTG_STATE_A_HOST:
    +			dev_err(musb->controller, "got SUSPEND intr with A_HOST state\n");
     			musb->xceiv->otg->state = OTG_STATE_A_SUSPEND;
     			musb->is_active = musb->hcd->self.b_hnp_enable;
     			break;
    @@ -1586,9 +1587,10 @@ irqreturn_t musb_interrupt(struct musb *musb)
     
     	devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
     
    -	dev_dbg(musb->controller, "** IRQ %s usb%04x tx%04x rx%04x\n",
    -		is_host_active(musb) ? "host" : "peripheral",
    -		musb->int_usb, musb->int_tx, musb->int_rx);
    +	if (musb->int_usb)
    +		dev_err(musb->controller, "** IRQ %s usb%04x\n",
    +			is_host_active(musb) ? "host" : "peripheral",
    +			musb->int_usb);
     
     	/**
     	 * According to Mentor Graphics' documentation, flowchart on page 98,
    diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
    index 4c481cd66c77..f570a5c24a1b 100644
    --- a/drivers/usb/musb/musb_gadget.c
    +++ b/drivers/usb/musb/musb_gadget.c
    @@ -2011,6 +2011,7 @@ void musb_g_disconnect(struct musb *musb)
     		MUSB_HST_MODE(musb);
     		break;
     	case OTG_STATE_A_PERIPHERAL:
    +		dev_err(musb->controller, "g_disconnect with A_PERI state\n");
     		musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
     		MUSB_HST_MODE(musb);
     		break;
    @@ -2087,6 +2088,7 @@ __acquires(musb->lock)
     		musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL;
     		musb->g.is_a_peripheral = 0;
     	} else {
    +		dev_err(musb->controller, "g_reset, devctl 0x%02x\n", devctl);
     		musb->xceiv->otg->state = OTG_STATE_A_PERIPHERAL;
     		musb->g.is_a_peripheral = 1;
     	}
    diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
    index 4731baca377f..6501cb6fa275 100644
    --- a/drivers/usb/musb/musb_virthub.c
    +++ b/drivers/usb/musb/musb_virthub.c
    @@ -227,6 +227,7 @@ void musb_root_disconnect(struct musb *musb)
     	switch (musb->xceiv->otg->state) {
     	case OTG_STATE_A_SUSPEND:
     		if (otg->host->b_hnp_enable) {
    +			dev_err(musb->controller, "root_disconnect with A_SUSPEND state\n");
     			musb->xceiv->otg->state = OTG_STATE_A_PERIPHERAL;
     			musb->g.is_a_peripheral = 1;
     			break;
    

  • Thank you. Again, it reproduced immediately. Steps were:

    * reboot

    * ssh

    * run your new script creating mass storage device

    * connect to PC (Mac OS, BTW, in this case)

    * do nothing (I recall that in previous actions I formatted the resulting drive to FAT, this time I did nothing)

    * disconnect cable (I did NOT eject or perform any action on the host PC)

    * run script with -d (tear down)

    * run script for serial port only configuration (or mass storage only configuration)

    * connect cable.

    * errors, USB does not work. (this time happened first attempt again) (NOTE: must reboot to recover)

       *NOTE: errors only start when I connect the USB cable to the PC.

    Also, I was able to reproduce with only mass storage script. i.e, create mass storage, connect to PC, disconnect, teardown, create mass storage, connect to PC, errors...  attached log for this too.

    Attached are the two dmesg logs.

    dmesgLogUsbIssueWithMoreDebugChanges.txt
    [   23.096292] random: nonblocking pool is initialized
    [   63.781901] Mass Storage Function, version: 2009/09/11
    [   63.782060] LUN: removable file: (no medium)
    [   64.039431] mass_storage.usb0/lun.0: open backing file: /dev/shm/gmsc.file
    [   64.050927] Number of LUNs=1
    [   64.065065] udc musb-hdrc.0.auto: registering UDC driver [g1]
    [   64.065165] configfs-gadget gadget: adding 'Mass Storage Function'/cc296a80 to config 'c'/cf588898
    [   64.065374] configfs-gadget gadget: I/O thread pid: 317
    [   64.065415] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
    [   76.626630] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0004
    [   84.172974] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0004
    [   84.242966] configfs-gadget gadget: high-speed config #1: c
    [   84.243255] configfs-gadget gadget: set_config: interface 0 (Mass Storage Function) requested delayed status
    [   84.243279] configfs-gadget gadget: delayed_status count 1
    [   84.243491] configfs-gadget gadget: usb_composite_setup_continue
    [   84.243521] configfs-gadget gadget: usb_composite_setup_continue: Completing delayed status
    [   84.253195] configfs-gadget gadget: sending command-failure status
    [  113.243990] configfs-gadget musb-hdrc.0.auto: unregistering UDC driver [g1]
    [  113.246998] configfs-gadget gadget: reset config
    [  113.247386] configfs-gadget gadget: bulk_out_complete --> -104, 0/31
    [  113.247440] configfs-gadget gadget: reset interface
    [  113.247549] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0040
    [  113.256005] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_stop
    [  113.256183] configfs-gadget gadget: unbind function 'Mass Storage Function'/cc296a80
    [  113.256447] configfs-gadget gadget: unbind
    [  113.325151] lun.0: close backing file
    [  126.733935] userial_init: registered 4 ttyGS* devices
    [  126.780647] udc musb-hdrc.0.auto: registering UDC driver [g1]
    [  126.780757] configfs-gadget gadget: adding 'acm'/cc224000 to config 'c'/cc24b898
    [  126.780802] configfs-gadget gadget: acm ttyGS0: dual speed IN/ep1in OUT/ep1out NOTIFY/ep2in
    [  126.780823] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
    [  126.780912] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0040
    [  132.389595] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  132.454529] musb_h_ep0_irq 1164: no URB for end 0
    [  132.454800] musb_h_ep0_irq 1164: no URB for end 0
    [  132.461478] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [  133.560966] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  133.619456] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  133.691685] musb_h_ep0_irq 1164: no URB for end 0
    [  133.695556] musb_h_ep0_irq 1164: no URB for end 0
    [  133.704201] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [  134.803443] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  134.862675] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  134.918426] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  134.973793] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  135.066857] musb_h_ep0_irq 1164: no URB for end 0
    [  135.070854] musb_h_ep0_irq 1164: no URB for end 0
    [  135.084287] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [  136.184883] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  136.244020] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  136.300140] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  136.356385] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  136.412508] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  136.468379] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  136.524634] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  136.580881] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  136.712131] musb_h_ep0_irq 1164: no URB for end 0
    [  136.716045] musb_h_ep0_irq 1164: no URB for end 0
    [  136.736650] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [  137.836079] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  137.894479] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  137.950353] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.006101] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.061361] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.117594] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.173347] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.229597] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.285708] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.341842] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.397841] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.453958] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.510101] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.565965] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.621596] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  138.834171] musb_h_ep0_irq 1164: no URB for end 0
    [  138.838081] musb_h_ep0_irq 1164: no URB for end 0
    [  138.875696] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [  139.976356] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.035554] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.091308] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.146549] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.202028] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.257272] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.312533] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.368283] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.423519] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.479518] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.535675] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.591784] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.647412] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.702787] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.758915] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.814402] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.870786] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.925818] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  140.981771] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.037896] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.094028] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.150273] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.206393] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.262025] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.318148] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.373079] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.429638] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.485643] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.541884] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  141.913902] musb_h_ep0_irq 1164: no URB for end 0
    [  141.917811] musb_h_ep0_irq 1164: no URB for end 0
    [  141.986498] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [  143.087183] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.146484] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.202606] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.258875] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.314852] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.371101] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.426126] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.482594] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.538093] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.594348] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.650097] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.706331] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.762592] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.817517] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.872759] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.929334] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  143.985462] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.040708] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.096445] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.152700] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.208822] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.263759] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.319450] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.375203] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.430687] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.486061] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.542193] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.597234] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.653686] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.708946] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.764565] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.819805] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.875679] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.932060] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  144.988177] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.044300] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.099683] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.155800] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.212167] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.268177] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.324427] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.380417] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.435351] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.490917] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.546920] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.602537] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.657921] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.714170] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.769192] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.825780] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.881038] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.937162] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  145.993028] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  146.047970] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  146.103406] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  146.158657] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  146.214770] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  146.271031] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  146.962540] musb_h_ep0_irq 1164: no URB for end 0
    [  146.966421] musb_h_ep0_irq 1164: no URB for end 0
    [  147.099875] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [  148.200562] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.259748] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.316101] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.372361] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.427290] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.483730] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.539099] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.594038] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.650349] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.706341] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.762476] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.818342] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.874596] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.929968] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  148.985464] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.041090] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.096025] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.151455] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.207452] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.263585] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.319450] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.375700] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.431205] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.487447] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.542696] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.598580] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.654452] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.710077] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.765565] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.821441] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.877073] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.932688] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  149.988693] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.043727] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.100183] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.156056] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.212312] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.267682] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.323557] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.379681] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.435057] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.491297] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.547676] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.603187] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.658795] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.714169] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.770426] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.825799] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.881540] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.937287] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  150.992548] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.048174] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.104161] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.159418] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.214913] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.270409] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.325655] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.381159] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.436909] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.492903] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.548905] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.604785] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.660526] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.716270] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.772153] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.827652] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.884021] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.939774] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  151.995272] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  152.051640] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  152.107517] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  152.162895] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  152.209604] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [  152.416994] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0020
    [  152.420834] musb_stage0_irq 857: unhandled DISCONNECT transition (a_idle)
    
    

    dmesgLogUsbIssueWithMoreDebugChangesMassStorageOnly.txt
    [   24.029983] random: nonblocking pool is initialized
    [   40.334001] Mass Storage Function, version: 2009/09/11
    [   40.334138] LUN: removable file: (no medium)
    [   40.581140] mass_storage.usb0/lun.0: open backing file: /dev/shm/gmsc.file
    [   40.592893] Number of LUNs=1
    [   40.613161] udc musb-hdrc.0.auto: registering UDC driver [g1]
    [   40.613259] configfs-gadget gadget: adding 'Mass Storage Function'/cf663680 to config 'c'/cc3c6498
    [   40.613529] configfs-gadget gadget: I/O thread pid: 314
    [   40.613572] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
    [   49.009396] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0004
    [   51.176990] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0004
    [   51.247713] configfs-gadget gadget: high-speed config #1: c
    [   51.247995] configfs-gadget gadget: set_config: interface 0 (Mass Storage Function) requested delayed status
    [   51.248019] configfs-gadget gadget: delayed_status count 1
    [   51.248222] configfs-gadget gadget: usb_composite_setup_continue
    [   51.248251] configfs-gadget gadget: usb_composite_setup_continue: Completing delayed status
    [   51.258778] configfs-gadget gadget: sending command-failure status
    [   60.602129] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0001
    [   60.602351] configfs-gadget gadget: suspend
    [   60.802473] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0020
    [   60.802703] configfs-gadget gadget: reset config
    [   60.802844] configfs-gadget gadget: bulk_out_complete --> -104, 0/31
    [   60.802889] configfs-gadget gadget: reset interface
    [   64.742457] configfs-gadget musb-hdrc.0.auto: unregistering UDC driver [g1]
    [   64.745537] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_stop
    [   64.745655] configfs-gadget gadget: unbind function 'Mass Storage Function'/cf663680
    [   64.745918] configfs-gadget gadget: unbind
    [   64.816595] lun.0: close backing file
    [   78.869368] Mass Storage Function, version: 2009/09/11
    [   78.869628] LUN: removable file: (no medium)
    [   79.160184] mass_storage.usb0/lun.0: open backing file: /dev/shm/gmsc.file
    [   79.167962] Number of LUNs=1
    [   79.182343] udc musb-hdrc.0.auto: registering UDC driver [g1]
    [   79.182445] configfs-gadget gadget: adding 'Mass Storage Function'/cc275200 to config 'c'/cc3c6498
    [   79.182644] configfs-gadget gadget: I/O thread pid: 339
    [   79.182683] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
    [   79.182763] musb-hdrc musb-hdrc.0.auto: ** IRQ peripheral usb0040
    [   82.499146] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   82.564531] musb_h_ep0_irq 1164: no URB for end 0
    [   82.568348] musb_h_ep0_irq 1164: no URB for end 0
    [   82.575080] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [   83.675784] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   83.734949] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   83.806784] musb_h_ep0_irq 1164: no URB for end 0
    [   83.810674] musb_h_ep0_irq 1164: no URB for end 0
    [   83.819699] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [   84.920503] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   84.979663] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   85.035782] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   85.092037] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   85.183158] musb_h_ep0_irq 1164: no URB for end 0
    [   85.187064] musb_h_ep0_irq 1164: no URB for end 0
    [   85.200162] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [   86.300120] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   86.358888] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   86.415006] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   86.470620] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   86.526751] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   86.582876] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   86.639125] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   86.695117] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   86.827465] musb_h_ep0_irq 1164: no URB for end 0
    [   86.831359] musb_h_ep0_irq 1164: no URB for end 0
    [   86.852749] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [   87.952600] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.011216] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.067464] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.122839] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.178835] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.234211] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.290460] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.346200] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.401143] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.456827] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.512825] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.568453] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.623703] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.679570] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.734943] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   88.947606] musb_h_ep0_irq 1164: no URB for end 0
    [   88.951495] musb_h_ep0_irq 1164: no URB for end 0
    [   88.988951] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [   90.089898] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.149166] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.205285] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.260535] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.316162] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.372286] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.428411] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.484159] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.540403] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.596270] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.652543] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.708528] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.764663] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.820654] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.876898] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.932146] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   90.988144] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.044520] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.100516] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.156768] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.212013] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.267261] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.323383] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.378635] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.434637] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.490263] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.545513] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.600537] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   91.656883] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   92.029564] musb_h_ep0_irq 1164: no URB for end 0
    [   92.033476] musb_h_ep0_irq 1164: no URB for end 0
    [   92.101881] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [   93.201103] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.260590] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.316715] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.373087] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.429086] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.485204] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.541460] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.596709] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.651950] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.708079] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.764334] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.820202] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.876320] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.932331] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   93.987702] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.043703] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.098949] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.155068] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.210319] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.265934] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.322064] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.377319] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.433554] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.489186] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.545182] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.601437] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.656808] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.712559] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.768815] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.824925] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.880176] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.936297] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   94.992667] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.048671] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.105045] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.159982] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.216534] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.272412] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.328667] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.384782] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.440033] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.496412] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.551652] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.607412] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.663041] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.719040] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.774773] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.831151] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.886088] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.942528] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   95.998171] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   96.053525] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   96.109292] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   96.165515] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   96.221644] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   96.277019] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   96.333026] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   96.389143] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   97.081146] musb_h_ep0_irq 1164: no URB for end 0
    [   97.085142] musb_h_ep0_irq 1164: no URB for end 0
    [   97.217373] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0001
    [   98.317681] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.376088] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.431342] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.487220] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.542702] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.598079] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.654468] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.709397] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.764830] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.821081] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.876965] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.932444] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   98.988449] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.043694] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.098948] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.154198] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.209819] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.266068] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.321682] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.376939] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.433314] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.489064] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.545302] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.601432] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.657582] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.712490] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.768807] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.824424] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.879466] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.935417] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [   99.991298] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.047546] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.103412] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.159421] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.215668] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.271418] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.327539] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.382575] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.438787] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.494904] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.550652] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.606533] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.662787] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.718034] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.773788] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.829530] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.885019] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.940661] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  100.995899] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  101.051651] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  101.107644] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  101.162592] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  101.218521] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  101.273784] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  101.329650] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  101.385115] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  101.440991] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    [  101.496988] musb-hdrc musb-hdrc.0.auto: ** IRQ host usb0004
    

  • Matthew,

    Great, the both logs show that SESSREQ interrupt is generated, which leads the driver transitioned to host mode route. SESSREQ interrupt is part of the USB OTG protocol, which we never needed. I guess your board hardware design has a problem which related to the SESSREQ interrupt.

    Now I think you have two options:

    1. Send your board schematics for review. But since it is already in production, I guess we cannot modify the board anyway, so

    2. You can apply the following workaround patch, which ignore the SESSREQ interrupt. This should solve the issue for you.

    diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
    index 08a69f4f4d5a..793080d27a2b 100644
    --- a/drivers/usb/musb/musb_core.c
    +++ b/drivers/usb/musb/musb_core.c
    @@ -603,6 +603,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
            if (int_usb & MUSB_INTR_SESSREQ) {
                    void __iomem *mbase = musb->mregs;
     
    +               return IRQ_HANDLED;
    +
                    if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS
                                    && (devctl & MUSB_DEVCTL_BDEVICE)) {
                            dev_dbg(musb->controller, "SessReq while on B state\n");
    
  • Thank you so much! This patch appears to resolve the issues. I have now created/connected/destroyed/disconnected/created/connected, many times, and so far no failures.

    I've informed the hardware team too of your comments.
    Thank you!
  • Glad the issue is solved. Thanks for the update.