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.

Is usb device/host supported with dm8148 ?

Guru 20755 points

Hello,

We need to use as device or host , is it possible with dm8148 ?

In the .config it seems I can only choost between host or device, \

does it mean we can't dynamic change (in runtime) between these 2 options ?

Regards,

Ran

  • Hi Ran,

    No, you can not dynamic change (in runtime) between device/host mode on usb0 (or usb1).

    processors.wiki.ti.com/.../DM81xx_AM38XX_USB_User_Guide
    DM814x Silicon errata, advisory 3.0.9

    BR
    Pavel
  • Hi Pavel !

    Yes, but

    if in HW terms each one can work seperately, it means it is totally software limitation, so we try to understand the best approach.

    One approach is to create 2 completely different images, one for device , and other for host and then on runtime to boot and change kernel.

    This approach is very expensive in time.

    We thought about other approach, but are not sure if it is possible:

    Is it possible in terms of unload host module and then load device module (and vice versa) ?

    Thanks,

    Ran

  • Ran Shalit said:
    if in HW terms each one can work seperately, it means it is totally software limitation

    Per my understanding this is HW limitation:

    Hardware Limitation (Not supported feature) DM814X

    • OTG Support : This limitation is due to the external USB-ID pin from the USB connector is not used for detection of host/device mode. The USB-ID pin (or iddig pin) is made software configurable to configure the controller as host mode (iddig = 0) or device mode (iddig = 1). Hence dynamic iddig pin sensing based on external USB cable connector is not possible.

    Ran Shalit said:
    Is it possible in terms of unload host module and then load device module (and vice versa) ?

    Nothing new from the time of the below e2e thread:

    BR
    Pavel

  • Hi Pavel,

    Can you please explain if possible why it is a hw limitation ?
    Each mode works on same HW:
    1. boot with usb device
    2. boot with usb host
    As we understand it means that the HW knows how to work with usb device and usb host.

    Considering the above, It seems as if the only gap is that the software will configure the hw correctly when changing between usb host and usb device.

    Hardware Limitation (Not supported feature) DM814X

    • OTG Support : This limitation is due to the external USB-ID pin from the USB connector is not used for detection of host/device mode. The USB-ID pin (or iddig pin) is made software configurable to configure the controller as host mode (iddig = 0) or device mode (iddig = 1). Hence dynamic iddig pin sensing based on external USB cable connector is not possible.

    >"This limitation is due to the external USB-ID pin from the USB connector is not used for detection of host/device mode."

    If we could configure the driver without this PIN, but by software, if it is device or host, wouldn't is overcome the above limitation ?

    We are struggling to enable the dynamic change between these modes, becuase it is  a MUST.


    Thank you for the assistance,
    Ran

  • Ran,

    DM814x USB was designed to operate for both options (HW and SW control of the ID pin). However, there is a bug in the design that inhibits this capability. The bug is documented in the Silicon errata, advisory 3.0.9.

    The USB0-ID/USB1_ID input to DM814X decides the role of usb mode to be either host or device for USB0/USB1 mentor usb controllers. USBx_ID should be floating (open) for device mode and grounded for host mode operations The configuration of USBx_ID pin can be done by

       software control (only supported on DM814X PG1.x revision)

       usb plug type inserted to usb connector (micro/mini-A plug for host mode, micro/mini-B plug for device mode).

       by on board USBx_ID jumper setting to either short/open the ID pin for force host/device mode respectively.

    The USBx_ID is always software controlled for DM814X PG1.x silicon. In PG2.0 onwards USBx_ID is configured through either external usb plug type or onboard jumper setting.

    SW could manage the role switch between host and device only for PG1.x device

    Since SW controlled iddig (USBXMODE) is not working for PG2.x. The only option is to either connect the usb cable type before loading the linux image or force the USBx_ID pin to ground/open by using jumper (as implemented in TI-EVM).

    Regards,
    Pavel

  • HI Pavel,

    Thank you very much for the assistance,

    > " The only option is to either connect the usb cable type before loading the linux image or force the USBx_ID pin to ground/open by using jumper (as implemented in TI-EVM)."
    Does both of these option should be done >before< loading the linux image ? Isn't there some driver which read this information and configure the usb stack , so that we can patch only that driver and ask it to restart itself on the fly ?

    Thanks
    Ran
  • Hi Pavel,

    The problem is that the musb driver has a lot of config flags (for perpheral, device, otg and other variants)
    In order to truelly support load/unload we must now convert all this config into variables so that load/unload can be done.....

    Regards,
    Ran

  • Hi Pavel,

    Do you think it should work if we use the dynamic variable instead of all the CONFIG_XXX flags in the Inventra's MUSB driver ? (so that we can eventually do the load/unload)

    Regards,
    Ran
  • Ran,

    I have found some internal info that might be in help:

    USB-ID pin dynamic detection works correctly on TI814x. By this it is implied that the device can detect the correct role based on the ID pin when the SESSION bit is set in the DEVCTL register of the USB module.

    What doesn’t work correctly is the s/w override of the ID pin using the register in Control module.

    If the user has tied off the ID pin to GND, it is still possible to perform role switch using true HNP method. I have performed spot testing of the HNP and it worked  

    the TI814x Si supports HNP and this can be used to reverse roles even if ID is tied to GND.

    You have to have HNP s/w in place to perform the role switch. Otherwise you can also try with GPIO method. In case where the user is already ready with a board with ID=0 it seemed logical to me that one should use the HNP method. No GPIO pin is needed when using HNP. We use the role switch capability of the Mentor USB h/w. But you have to have the this capability in s/w.

    GPIO option for role switch by controlling ID pin could be possible technically, we have never verified such configuration. Only thing the controller must be stopped (SESSION bit set 0) before switch from host to device and vice versa.  So that when the session bit set again, the mentor sesnse the ID pin (changed by GPIOs) to enter into appropriate mode based on ID pin.

     

     

     

  • Hi,

    We eventually did some patch in usb in order to support dynamic usb-device switch (and vice versa).

    to change to host:
    ====================
    modprobe -r g_ether
    modprobe -r usb-storage
    modprobe -r ti81xx
    modprobe ti81xx - validate printing musb-hdrc musb-hdrc.1: USB Host mode"
    modprobe usb-storage - insert disk - does it recognize the disk in /dev/sdX ?


    to change to device:
    =====================
    modprobe -r g_ether
    modprobe -r usb-storage
    modprobe -r ti81xx
    modprobe ti81xx - validate printing "musb-hdrc musb-hdrc.1: USB Peripheral mode"
    modprobe g_ether - check with ifconfig that usb0 is configured

    2705.src.zip

    Regards,

    Ran