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.

DM365 OTG host configuration

Hi,

I am developing a USB otg device using the Montavista 2.6.18 kernel
provided by TI.

I find I cannot access host devices when in the driver mode is
configured for OTG. I can however work as a device.


What jumpers should I configure for OTG mode?

When I configure driver mode to host only it works fine.

When I try to configure it as a host using the sys file system I get the
following error:

echo host > /sys/devices/platform/musb_hdrc/mode
musb_platform_set_mode 400: FIXME: musb_platform_set_mode not
implemented


I tried compiling in the usb_procfs and changing the driver mode to host
by echo "H" > echo "H" > /proc/driver/musb_hdrc but this didn't work.

I have tried to using the opensource kernel but as far as I can see it
doesn't support USB OTG mode.


I have read on the forum that other people have got OTG to work on the
DM365. What am I missing?

I append a copy of the relevant parts of my kernel .config.

regards,

-shlomo

-----------------------

#
# USB support
#
CONFIG_USB_ARCH_HAS_HCD=y
# CONFIG_USB_ARCH_HAS_OHCI is not set
# CONFIG_USB_ARCH_HAS_EHCI is not set
CONFIG_USB=y
CONFIG_USB_DEBUG=y

#
# Miscellaneous USB options
#
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_BANDWIDTH is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
CONFIG_USB_SUSPEND=y
CONFIG_USB_OTG=y
# CONFIG_USB_OTG_WHITELIST is not set
# CONFIG_USB_OTG_BLACKLIST_HUB is not set

#
# USB Host Controller Drivers
#
# CONFIG_USB_ISP116X_HCD is not set
# CONFIG_USB_SL811_HCD is not set
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_SOC=y

#
# DaVinci 644x USB support
#
# CONFIG_USB_MUSB_HOST is not set
# CONFIG_USB_MUSB_PERIPHERAL is not set
CONFIG_USB_MUSB_OTG=y
CONFIG_USB_GADGET_MUSB_HDRC=y
CONFIG_USB_MUSB_HDRC_HCD=y
# CONFIG_MUSB_PIO_ONLY is not set
# CONFIG_MUSB_RESERVE_BULK_EP is not set
# CONFIG_MUSB_RESERVE_ISO_EP is not set
# CONFIG_MUSB_SCHEDULE_INTR_EP is not set
# CONFIG_USB_INVENTRA_DMA is not set
CONFIG_USB_TI_CPPI_DMA=y
# CONFIG_USB_TI_CPPI41_DMA is not set
CONFIG_USB_MUSB_LOGLEVEL=1


#
# USB Gadget Support
#
CONFIG_USB_GADGET=y
# CONFIG_USB_GADGET_DEBUG_FILES is not set
CONFIG_USB_GADGET_SELECTED=y
# CONFIG_USB_GADGET_FSL_USB2 is not set
# CONFIG_USB_GADGET_NET2280 is not set
# CONFIG_USB_GADGET_PXA2XX is not set
# CONFIG_USB_GADGET_GOKU is not set
# CONFIG_USB_GADGET_LH7A40X is not set
# CONFIG_USB_GADGET_OMAP is not set
# CONFIG_USB_GADGET_ARC is not set
# CONFIG_USB_GADGET_AT91 is not set
# CONFIG_USB_GADGET_MPC8272 is not set
# CONFIG_USB_GADGET_DWC_OTG is not set
# CONFIG_USB_GADGET_DUMMY_HCD is not set
# CONFIG_USB_GADGET_MPC885ADS is not set
# CONFIG_USB_GADGET_EP88XC is not set
CONFIG_USB_GADGET_DUALSPEED=y
# CONFIG_USB_ZERO is not set
# CONFIG_USB_ETH is not set
CONFIG_USB_GADGETFS=y
# CONFIG_USB_FILE_STORAGE is not set
# CONFIG_USB_G_SERIAL is not set

  • Shlomo,

    Have you used the Aarago DaVinci Staging Git kernel? OTG should be working on that kernel.

    Can you provide more detail on the use case that you feel needs OTG?  The information would be really helpful..

    regards

    swami

  • We use OTG as host to communicate with a cellullar modem as as device to enbale us to configure our product using a PC.

    We multiplex the OTG output to the USB jack and the internal modem based on the level of the ID pin.

    Where can I find the Aarago DaVinci Staging Git kernel?

    regards,

    Shlomo

     

     

     

  • Shlomo,

    I feel what you need is Dual role capabality and OTG provides other capabalities (such as HNP, SRP etc.) in addition to Dual Role capabality.

    Pl. do try with the Aarago DaVinci staging tree for the OTG feature.  It should work.

    regards

    swami

  • Hi Swami,

    I find that the git kernel only has two driver modes host and gadget. Shouldn't it also have a third OTG mode?

    When I compiled the with latest version of the git kernel in host mode the usb driver failed to startup and the kernel disabled the usb clock.

    When I compiled the system to work as host on the 2.6.35-rc5 of the git kernel it worked fine. When I configured it as a gadget it failed to compile the driver.

    Any ideas?

    Shlomo

     

     

     

  • Shlomo,

    Can you try enabling Power Management (CONFIG_PM) in the kernel.  You should be able to see OTG config after doing this.

    regards

    swami

  • Hi Swami,

    I can now see the OTG option. Thanks. I have now built the 2.6.32-rc5 kernel with this option and things are looking good.

    When I set ID high and connect to a hub and mount the gadget file system I see the following:

    usb_hdrc musb_hdrc: MUSB HDRC host driver
    FATAL: Module gadgetfs not found.
    musb_hdrc musb_hdrc: new USB bus registered, assigned bus number 3
    usb usb3: New USB device found, idVendor=1d6b, idProduct=0002
    usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    usb usb3: Product: MUSB HDRC host driver
    usb usb3: Manufacturer: Linux 2.6.32-rc5-svn4 musb-hcd
    usb usb3: SerialNumber: musb_hdrc
    usb usb3: configuration #1 chosen from 1 choice
    hub 3-0:1.0: USB hub found
    hub 3-0:1.0: 1 port detected
    drivers/usb/musb/davinci.c musb_platform_enable: dma not reactivated

    lsusb

    Bus 001 Device 001: ID 1d6b:0002 Only after I mount gadgetfs.

    I don't see the external hub.

    when I set ID low and connect to a PC I see the device enumerate on the PC as a hub.

     

    When I run my gadget application I see the following:

    gadgetfs: bound to musb_hdrc driver
    vendor:product 0musb_hdrc musb_hdrc: MUSB HDRC host driver
    525:a4a4
    vendor:product 0525:a4a4
    epin = ep2in, epout=ep1out
    musb_hdrc musb_hdrc: new USB bus registered, assigned bus number 2
    usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
    usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    usb usb2: Product: MUSB HDRC host driver
    usb usb2: Manufacturer: Linux 2.6.32-rc5-svn4 musb-hcd
    usb usb2: SerialNumber: musb_hdrc
    usb usb2: configuration #1 chosen from 1 choice
    hub 2-0:1.0: USB hub found
    hub 2-0:1.0: 1 port detected
    drivers/usb/musb/davinci.c musb_platform_enable: dma not reactivated
    /dev/gadget/musb_hdrc ep0 configured

    And I do not see the vendor product on my PC.

    This application worked fine under 2.6.18 monatvista when configured as a gadget.

    Any ideas?

    BTW echo host > /sys/devices/platform/musb_hdrc/mode still has not been implemented.

    Thank you for your prompt and helpful support.

    -Shlomo

  • Hi Swami,

    For our application we do not need the ability to dynamically switch between host and gadget. For normal operation we need the driver to be host and only if on startup we see that we have a device cable attached do we need to configure USB to be a device. We also need to use the 2.6.18 kernel for our application as the DVDSK doesn't yet support the open source kernel.

    We could keep two copies of the musb_hdrc driver one configured as host and one configured as a gadget both of which we know works. One startup we can check the ID pin using gpio and load the appropriate driver.

    Would this produce any unexpected problems?

    Shlomo

     

  • When you set the ID line high it puts the controller in Device mode and you would not be able to see the HUB.  Can you provide details on your usb schematics information?  Driving the ID line low would put the controller in Host mode and you would be able to talk to the Hub.

    regards

    swami 

  • Hi Shlomo

    can you please drop me a line at albertbu@gmail.com?

    You may help me with a different USB issue I am having now

    Thx

    Albert

  • Hi Shlomo / ALbert

    Even i am facing the same problem that  . I cannot access host devices when the driver mode is configured for OTG. I can however work as a device.

    If you have solved it, please let me know the exact configuration.

    I executed below command to change it to host mode. Please let me know whether this is the right method.

    modprobe g_file_storage

    echo F > /proc/driver/musb_hdrc

    I am getting these errors after i configure it to host and plug a device to dm368.

    musb_bus_suspend 2406: trying to suspend as a_host while active

    usb 2-1: new high speed USB device using musb_hdrc and address 10

    usb 2-1: device v0421 p0220 is not supported

    hub 2-0:1.0: unable to enumerate USB device on port 1

  • Hi,

    OTG support in Linux 2.6.37

    I have enabled OTG support from menuconfig.
    Driver Mode (Both host and peripheral: USB OTG (On The Go) Device) & USB Gadget Support .

    make modules :-
    <M> File-backed Storage Gadget
    [*] File-backed Storage Gadget testing version
    <M> Mass Storage Gadget

    Load insmod g_mass_storage.ko file=/dev/mmcblk0p1 stall=0 removable=1 then is detected as peripheral.
    but i connect pendrive as a host is not detected.

    Log from musb_hdrc :-

    ----------------------------

    root@dm365-evm:~# cat /proc/driver/musb_hdrc
    Status: MHDRC, Mode=Peripheral (Power=20, DevCtl=98)
    OTG state: b_idle; inactive
    Options: cppi-dma, otg (peripheral+host), debug=0 [eps=5]
    Peripheral address: 01
    Root port status: 00000000
    DaVinci: ctrl=00 stat=0 phy=21f0
    rndis=00000 auto=0000 intsrc=00000000 intmsk=00000000
    CPPI: txcr=1 txsrc=0 txena=f; rxcr=1 rxsrc=0 rxena=f
    Gadget driver: (none)
    ep0 (hw0): 1buf, csr 0000 maxp 0000
    (queue empty)


    Any missing from my side ?

    Regards,
    Tejas
  • Hi,
    OTG support in Linux 2.6.37

    I have enabled OTG support from menuconfig.
    Driver Mode (Both host and peripheral: USB OTG (On The Go) Device) & USB Gadget Support .

    make modules :-
    <M> File-backed Storage Gadget
    [*] File-backed Storage Gadget testing version
    <M> Mass Storage Gadget

    Load insmod g_mass_storage.ko file=/dev/mmcblk0p1 stall=0 removable=1 then is detected as peripheral.
    but i connect pendrive as a host is not detected.
    Log from musb_hdrc :-
    ----------------------------
    root@dm365-evm:~# cat /proc/driver/musb_hdrc
    Status: MHDRC, Mode=Peripheral (Power=20, DevCtl=98)
    OTG state: b_idle; inactive
    Options: cppi-dma, otg (peripheral+host), debug=0 [eps=5]
    Peripheral address: 01
    Root port status: 00000000
    DaVinci: ctrl=00 stat=0 phy=21f0
    rndis=00000 auto=0000 intsrc=00000000 intmsk=00000000
    CPPI: txcr=1 txsrc=0 txena=f; rxcr=1 rxsrc=0 rxena=f
    Gadget driver: (none)
    ep0 (hw0): 1buf, csr 0000 maxp 0000
    (queue empty)

    Any missing from my side ?

    Regards,
    Tejas