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.

musb: Babble Interrupt Occurred when I removed the USB cable from USB0

Hi all,

    I am facing Babble Interrupt problem in usb0 and the USB0 is used as device mode and host mode, when I removed the usb cable from USB0 after its showing following error, 

root@lifeline:~# [   75.237783] CAUTION: musb: Babble Interrupt Occurred
[   75.243118] musb_stage0_irq 787: unhandled DISCONNECT transition (a_wait_bcon)
[   75.252259] usb 1-1: USB disconnect, device number 2
[   75.331090] musb-hdrc musb-hdrc.0.auto: Restarting MUSB to recover from Babble  

After that usb enumeration not happening, I am using sdk 8. could please help on this .

Thanks & Regards

N Shankar.

  • Hi,

    Please check this wiki and see if your case is covered: http://processors.wiki.ti.com/index.php/Sitara_Linux_MUSB_Issues If not, please provide more information on how is your USB configured and what device are you connecting to.

  • - Please provide the usb portion of the schematics if this issue happens on your custom board.

    - Please run the attached chkusb.sh script on your board and provide the output.

    - Please provide the register dump before remove the cable using the command below.

    # grep -i 'power\|devctl' /sys/kernel/debug/musb-hdrc.0.auto/regdump

    - Please also provide the register dump after removed the cable using the same command above.

    #!/bin/sh
    # dump some usb registers
    # usbreg.sh <bus-number>
    # env: PLATFORM
    
    check_platform() {
    	local _hw
    
    	_hw=`grep '^Hardware' /proc/cpuinfo`
    
    	[ "${_hw#*AM33XX}" = "$_hw" ] || { PLATFORM="am335x"; return 0; }
    	[ "${_hw#*AM43}" = "$_hw" ] || { PLATFORM="am437x"; return 0; }
    	[ "${_hw#*DRA74X}" = "$_hw" ] || { PLATFORM="am57x"; return 0; }
    	PLATFORM="unkown"
    	return 1
    }
    
    [ "$1" = "" ] && {
    	echo '    bus #0:'
    	$0 0
    	echo '    bus #1:'
    	$0 1
    	exit 0
    }
    
    bus=$1
    
    [ "$bus" = "0" ] || [ "$bus" = "1" ] ||
    	{ echo "Error: unknown bus number"; exit 1; }
    
    [ "$PLATFORM" != "" ] || check_platform
    
    case $PLATFORM in
    	am335x) bus_ent=musb-hdrc.${bus}.auto ;;
    	am437x) bus_ent=`printf "%x" $((0x48390000+${bus}*0x40000))`.usb ;;
    	am57x) bus_ent=`printf "%x" $((0x48890000+${bus}*0x40000))`.usb ;;
    	*)
    		echo "Error: unknown platform"
    		exit 2 ;;
    esac
    
    entry=/sys/kernel/debug/${bus_ent}/regdump
    
    [ -f $entry ] || { echo "$entry not found"; exit 3; }
    
    case $PLATFORM in
    	am335x)
    		grep 'Power\|DevCtl' $entry ;;
    	*)
    		grep GCTL $entry
    		grep DCTL $entry
    		grep 'OCFG\|OCTL\|OSTS' $entry
    		;;
    esac
    

  • Hi Bin,

      Please find attached file for usb reg dump, usbreg script and usb switch schematic.

    Thanks & Regards

    N Shankarusb.zipusb_reglog.tar.gz

  • The log does not show when the cable is removed and the babble log. But please try the following patch and let me know if it fixes the issue.

    patch: usb: musb: ensure in peripheral mode when checking session
    http://marc.info/?l=git-commits-head&m=144331613106445&w=2

  • Hi Bin,

        After adding patch,then cross compiled and its showing error i.e error: ‘struct usb_otg’ has no member named ‘state’

    If I remove state member then no error after check with usb device I am getting same Babble Interrupt Occurred problem please find the below log file and observation

    shankar@tata-HP-Elite-7100-Microtower-PC:~/cadb_cust/linux-3.14.26-g2489c02$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/tools/rootfs_dir/shankar/Rootfs_0810 modules

     CHK     include/config/kernel.release

     CHK     include/generated/uapi/linux/version.h

     CHK     include/generated/utsrelease.h

    make[1]: `include/generated/mach-types.h' is up to date.

     CALL    scripts/checksyscalls.sh

     CC [M]  drivers/usb/musb/musb_core.o

    drivers/usb/musb/musb_core.c: In function ‘musb_start’:

    drivers/usb/musb/musb_core.c:965:64: error: ‘struct usb_otg’ has no member named ‘state’

    make[3]: *** [drivers/usb/musb/musb_core.o] Error 1

    make[2]: *** [drivers/usb/musb] Error 2

    make[1]: *** [drivers/usb] Error 2

    make: *** [drivers] Error 2

    ************************************************ Observations *************************************************************************************************

    before inserting pen drive:


    root@lifeline:~# ./usb.sh
        bus #0:
    Power       : e0
    DevCtl      : 88
        bus #1:
    /sys/kernel/debug/musb-hdrc.1.auto/regdump not found


    umpt@lifeline:~# grep -i 'power\|devctl' /sys/kernel/debug/musb-hdrc.0.auto/regd
    Power       : f0
    DevCtl      : 89
    root@lifeline:~#
    root@lifeline:~#

    After insert pen drive:

    root@lifeline:~# [  257.658287] usb 1-1: new high-speed USB device number 2 using musb-hdrc
    [  257.798988] usb 1-1: New USB device found, idVendor=0781, idProduct=5567
    [  257.806055] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [  257.813601] usb 1-1: Product: Cruzer Blade
    [  257.817909] usb 1-1: Manufacturer: SanDisk
    [  257.822240] usb 1-1: SerialNumber: 4C530011700411103191
    [  257.833848] usb-storage 1-1:1.0: USB Mass Storage device detected
    [  257.851408] scsi0 : usb-storage 1-1:1.0
    [  258.860334] scsi 0:0:0:0: Direct-Access     SanDisk  Cruzer Blade     1.27 PQ: 0 ANSI: 6
    [  258.888446] sd 0:0:0:0: [sda] 30529536 512-byte logical blocks: (15.6 GB/14.5 GiB)
    [  258.906510] sd 0:0:0:0: [sda] Write Protect is off
    [  258.920118] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
    [  258.976441]  sda: sda1
    [  259.002050] sd 0:0:0:0: [sda] Attached SCSI removable disk
    [  259.727414] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

    root@lifeline:~# ./usb.sh
        bus #0:
    Power       : f0
    DevCtl      : 5d
        bus #1:
    /sys/kernel/debug/musb-hdrc.1.auto/regdump not found
    root@lifeline:~#

    umpt@lifeline:~# grep -i 'power\|devctl' /sys/kernel/debug/musb-hdrc.0.auto/regdu
    Power       : f0
    DevCtl      : 5d
    root@lifeline:~#

    Removing pen drive from board

    root@lifeline:~#
    root@lifeline:~# [  316.054817] CAUTION: musb: Babble Interrupt Occurred **********
    [  316.061154] musb_stage0_irq 788: unhandled DISCONNECT transition (a_wait_bcon)
    [  316.069011] usb 1-1: USB disconnect, device number 2
    [  316.148270] musb-hdrc musb-hdrc.0.auto: Restarting MUSB to recover from Babble

    root@lifeline:~#
    root@lifeline:~#
    root@lifeline:~#
    root@lifeline:~#
    umpt@lifeline:~# grep -i 'power\|devctl' /sys/kernel/debug/musb-hdrc.0.auto/regdu
    Power       : e0
    DevCtl      : 80
    root@lifeline:~#
    root@lifeline:~# ./usb.sh
        bus #0:
    Power       : e0
    DevCtl      : 80
        bus #1:
    /sys/kernel/debug/musb-hdrc.1.auto/regdump not found
    root@lifeline:~#

    After bable interrupt occured
    root@lifeline:~# ./usb.sh
        bus #0:
    Power       : e0
    DevCtl      : 80
        bus #1:
    /sys/kernel/debug/musb-hdrc.1.auto/regdump not found


    Thanks in advance

    Thanks&Regards

    N Shankar

  • Shankar,

    shankar naragoni said:
        After adding patch,then cross compiled and its showing error i.e error: ‘struct usb_otg’ has no member named ‘state’

    I am sorry, this patch was for kernel v4.1, but the SDK8.0 kernel has different 'struct usb_phy'. Please change the patch as follows.

    +			musb->xceiv->otg->state != OTG_STATE_A_WAIT_BCON &&

    to

    +			musb->xceiv->state != OTG_STATE_A_WAIT_BCON &&

    The problem is for some reason the controller does not transition to host mode anymore after babble recovery. The transition happens in function otg_timer() in musb_dsps.c.

    270         case OTG_STATE_B_IDLE:
    271                 if (devctl & MUSB_DEVCTL_BDEVICE) {
    272                         musb->xceiv->state = OTG_STATE_B_IDLE;
    273                         MUSB_DEV_MODE(musb);
    274                 } else {
    275                         musb->xceiv->state = OTG_STATE_A_IDLE;
    276                         MUSB_HST_MODE(musb);
    277                 }
    278                 if (!(devctl & MUSB_DEVCTL_SESSION) && !skip_session)
    279                         dsps_writeb(mregs, MUSB_DEVCTL, MUSB_DEVCTL_SESSION);
    280                 mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ);
    281                 break;
    

    In Line 279 above, bit0 is set to devctl register to trigger the host mode transition. If the patch change I mentioned above does not fix the issue, please debug the piece of code to see if Line 279 got executed after babble happened.