I have configured dm368 for USB OTG mode .
fgrep USB .config | grep -v '^#'
CONFIG_USB_HID=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB=y
CONFIG_USB_DEBUG=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
CONFIG_USB_DEVICEFS=y
CONFIG_USB_DEVICE_CLASS=y
CONFIG_USB_SUSPEND=y
CONFIG_USB_OTG=y
CONFIG_USB_OTG_WHITELIST=y
CONFIG_USB_WUSB=y
CONFIG_USB_C67X00_HCD=y
CONFIG_USB_OXU210HP_HCD=y
CONFIG_USB_SL811_HCD=y
CONFIG_USB_R8A66597_HCD=y
CONFIG_USB_HWA_HCD=y
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_SOC=y
CONFIG_USB_MUSB_OTG=y
CONFIG_MUSB_SCHEDULE_INTR_EP=y
CONFIG_USB_GADGET_MUSB_HDRC=y
CONFIG_USB_MUSB_HDRC_HCD=y
CONFIG_USB_TI_CPPI_DMA=y
CONFIG_USB_MUSB_DEBUG=y
CONFIG_USB_ACM=y
CONFIG_USB_STORAGE=y
CONFIG_USB_STORAGE_DEBUG=y
CONFIG_USB_MDC800=y
CONFIG_USB_MICROTEK=y
CONFIG_USB_SERIAL=y
CONFIG_USB_TEST=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DEBUG=y
CONFIG_USB_GADGET_DEBUG_FILES=y
CONFIG_USB_GADGET_DEBUG_FS=y
CONFIG_USB_GADGET_VBUS_DRAW=20
CONFIG_USB_GADGET_SELECTED=y
CONFIG_USB_GADGET_DUALSPEED=y
CONFIG_USB_ZERO=m
CONFIG_USB_ETH=m
CONFIG_USB_GADGETFS=m
CONFIG_USB_FILE_STORAGE=m
CONFIG_USB_FILE_STORAGE_TEST=y
CONFIG_USB_G_SERIAL=m
CONFIG_USB_MIDI_GADGET=m
CONFIG_USB_G_PRINTER=m
CONFIG_USB_CDC_COMPOSITE=m
CONFIG_USB_OTG_UTILS=y
CONFIG_NOP_USB_XCEIV=y
After booting, It is initially in the peripheral mode.
cat /proc/driver/musb_hdrc
Status: MHDRC, Mode=Peripheral (Power=20, DevCtl=80)
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=21d0
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)
I did modprobe g_file_storage and echo F > /proc/driver/musb_hdrc, to change it to Host mode.
cat /proc/driver/musb_hdrc
Status: MHDRC, Mode=Host (Power=f0, DevCtl=5d)
OTG state: a_host; active
Options: cppi-dma, otg (peripheral+host), debug=0 [eps=5]
Peripheral address: 01
Root port status: 00000501
DaVinci: ctrl=00 stat=1 phy=21f0
rndis=00000 auto=0000 intsrc=00000000 intmsk=01ff1e1f
CPPI: txcr=1 txsrc=0 txena=f; rxcr=1 rxsrc=0 rxena=f
Gadget driver: (none)
But i am getting the below error when i insert a pendrive to usb port ,
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
When i reinsert it, i also got an error,
davinci_interrupt 370: VBUS error workaround (delay coming)
From Devctl =5D, it is clear that it is operating in host mode and device is also detected.
I followed procedures mentioned in the link,
https://www.ridgerun.com/developer/wiki/index.php/How_to_configure_DM365_for_USB_host,_device_and_OTG_support
I have enabled the power management in kernel and haved removed J26 jumper.
I am using g_file_storage.ko as i dint find g_cdc_ms.ko mentioned in the link.
i checked the vbus GPIO status using , cat /sys/kernel/debug/gpio , which says gpio-33 (usb ) out hi
If i configure usb as host alone, then the pendrive is mounted.
Please let me know where i am going wrong.
Is there any other configuration , which i have left out?