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.

DM8148: Reset USB subsystem

Other Parts Discussed in Thread: SYSCONFIG

Hi, All,

Does anyone know how to reset the USB subsystem in DM8148 platform, usb1 or usb2?

By following the ways provided in the link below, I can successfully reset any of USB host controllers in my Ubuntu PC system.

www.linux.org/.../

However, when I do it in DM8148 platform for both usb1 and usb2 using following two commands, the error messages "usb 2-1: device descriptor read/64, error -19" always occurred after "bind" command.

Here are commands:

    echo -n "usb2" | tee /sys/bus/usb/drivers/usb/unbind

    echo -n "usb2" | tee /sys/bus/usb/drivers/usb/bind

Followed are the dmesg message after each command:

 echo -n "usb2" | tee /sys/bus/usb/drivers/usb/unbind
----------------------------------------------------------------------------
PM: Removing info for No Bus:usbdev2.1
PM: Removing info for No Bus:ep_81
PM: Removing info for usb:2-0:1.0
usb 2-1: USB disconnect, address 2
PM: Removing info for No Bus:ep_81
PM: Removing info for usb:2-1:1.0
musb-hdrc musb-hdrc.1: Data toggle same as previous (=1) on ep10
PM: Removing info for No Bus:ep_00
PM: Removing info for usb:2-1
PM: Removing info for No Bus:usbdev2.2


 echo -n "usb2" | tee /sys/bus/usb/drivers/usb/bind
--------------------------------------------------------------------------
PM: Adding info for usb:2-0:1.0
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
PM: Adding info for No Bus:ep_81
PM: Adding info for No Bus:usbdev2.1
usb 2-1: new high speed USB device using musb-hdrc and address 4
usb 2-1: device descriptor read/64, error -19
usb 2-1: device descriptor read/64, error -19
usb 2-1: new high speed USB device using musb-hdrc and address 5
usb 2-1: device descriptor read/64, error -19
usb 2-1: device descriptor read/64, error -19
usb 2-1: new high speed USB device using musb-hdrc and address 6
usb 2-1: device not accepting address 6, error -19
usb 2-1: new high speed USB device using musb-hdrc and address 7
usb 2-1: device not accepting address 7, error -19
hub 2-0:1.0: unable to enumerate USB device on port 1

BTW, we have one camera connected to usb1 and one 2-port hub to usb2. After power-up, all these devices work fine.

Any idea what is wrong? Also, advise on how to reset USB controller usb0 or usb1 in DM8148.


Thanks,

Shunnian

  • Hi, All,

    For your reference, here is normal console messages on this port during power-up:
    usb 2-1: new high speed USB device using musb-hdrc and address 2
    usb 2-1: New USB device found, idVendor=0424, idProduct=2422
    usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    hub 2-1:1.0: USB hub found
    hub 2-1:1.0: 2 ports detected

    Regards,
    Shunnian
  • Hi Shunnian,

    You can try to reset USBSS with the below registers/bits:

    RM_DEFAULT_RSTCTRL[5] USB1_LRST
    [6] USB2_LRST

    USBSS SYSCONFIG[0] Softreset

    USB0CTRL[0] softreset
    USB1CTRL[0] softreset

    Refer to the DM814x TRM for more details (sections 25.5.1.5, 25.5.7, 25.5.8 etc).

    The below e2e thread might be also interesting for you:

    https://e2e.ti.com/support/arm/sitara_arm/f/791/t/270060

    Regards,
    Pavel

  • Hi, Pavel,

    Thanks for your information.

    I have tried to reset  usb0/1 by writing soft reset bit in USB0CTRL or USB0CTRL register using the following commands before. 

    devmem2 0x47401014 w 1

    devmem2 0x47401814 w 1

    However, after this command, "lsusb" command still can show the all usb devices but the devices actually doesn't work any more.

    Today, I tried to reset by writing RM_DEFAULT_RSTCTRLregister ( [5] USB1_LRST [6] USB2_LRST) using the following command:

    devmem2 0x48180b10
    /dev/mem opened.
    Memory mapped at address 0x402b3000.
    Read at address  0x48180B10 (0x402b3b10): 0x00000087
    devmem2 0x48180b10 w 0xE7

    Note: 0xE7 to change bit 5/6 to 1 from reading value 0x87.

    However, after this command, it seems that usb reset never happened and all devices works as normal.

    Actually, I want to reset usb controller so all devices connected also needs to be reset. It should be similar to disable or disconnect the usb controller or root hub then enable or connect again. By this way, usb driver will be unloaded and re-loaded and all usb devices will be re-enumerated.

    Please advise if it is doable in DM8148 platform.

    Thanks and regards,

    Shunnian

     

  • Shunnian,

    Regarding device/peripheral/gadget mode, you can try to unload/load USB gadget module (g_file_storage.ko, g_ether.ko, g_mass_storage.ko, g_zero.ko, etc). I think USB gadget will be reset on unload/load operation. Regarding host mode, this is not applicable, as the host USB driver is in-built and can not be made as separate modules easily, see the below e2e threads for details:
    e2e.ti.com/.../1582218
    e2e.ti.com/.../1765879

    You can also try with "soft connect enable/disable":

    root@dm814x-evm:~# echo "?" > /proc/driver/musb_hdrc.0
    musb_proc_write 766: ?: you are seeing it
    musb_proc_write 767: S: suspend the usb bus
    musb_proc_write 768: C/c: soft connect enable/disable
    musb_proc_write 769: I/i: hispeed enable/disable
    musb_proc_write 770: F: force session start
    musb_proc_write 771: H: host mode
    musb_proc_write 772: T: start sending TEST_PACKET
    musb_proc_write 773: D: set/read dbug level
    musb_proc_write 774: K/k: enable/disable babble workaround

    processors.wiki.ti.com/.../Usbgeneralpage

    e2e.ti.com/.../402217

    Regards,
    Pavel
  • The below e2e thread might be also in help:

    e2e.ti.com/.../446712

    Regards,
    Pavel
  • Shunnian Zhai said:

    I have tried to reset  usb0/1 by writing soft reset bit in USB0CTRL or USB0CTRL register using the following commands before. 

    devmem2 0x47401014 w 1

    devmem2 0x47401814 w 1

    However, after this command, "lsusb" command still can show the all usb devices but the devices actually doesn't work any more.

    I think it is normal that USB does not work any more after soft reset. After soft reset you will need to init/config the USB to be able to work again. USB0CTRL is named USB_CTRL_REG and USBSS SYSCONFIG is named USBSS_SYSCONFIG in the linux kernel code base. See the below file and code (which makes soft reset to USB):

    linux-kernel/drivers/usb/musb/ti81xx.c

    usbotg_ss_init(); - reset USBSS using USBSS SYSCONFIG/0x47400010

    ti81xx_musb_init() - reset USB0/USB1 using USB0CTRL/USB1CTRL

    See also the below e2e thread:

    Shunnian Zhai said:
    Today, I tried to reset by writing RM_DEFAULT_RSTCTRLregister ( [5] USB1_LRST [6] USB2_LRST)

    I agree, RM_DEFAULT_RSTCTRL USB1/2_LRST seems to be non-functional.

    Regards,
    Pavel