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 OTG on AM335x: using the same USB for host and device...

Other Parts Discussed in Thread: TWL6030

Hello!

I'm using an AM335x processor and the Kernel-3.2.0-psp04.06.00.11. In my custom board, I have a HUB connected to the USB0 port and a micro-AB connector connected to the USB1 port.

In the board configuration file, I set USB0 to MUSB_HOST and USB1 to MUSB_OTG and these are the options I set in the menuconfig:

 

Under Device Drivers -> USB support

--- USB support
<M> Support for Host-side USB
[ ] USB verbose debug messages

...

[ ] USB verbose debug messages
[*] USB runtime power management (autosuspend) and wakeup
[*] OTG support
[ ] Rely on OTG Targeted Peripherals List

...

< > Host Wire Adapter (HWA) driver (EXPERIMENTAL)
<M> Inventra Highspeed Dual Role Controller (TI, ADI, ...)
*** Platform Glue Layer ***
< > TUSB6010
< > OMAP2430 and onwards
< > AM35x
<M> TI81XX onward
MUSB DMA mode
<M> TI CPPI4.1
[ ] Disable DMA (always use PIO)

...

< > USB Test and Measurement Class support
*** NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may ***
*** also be needed; see USB_STORAGE Help for more info ***
<M> USB Mass Storage support
[ ] USB Mass Storage verbose debug

...

< > Microtek X6USB scanner support
*** USB port drivers ***
<M> USB Serial Converter support --->
*** USB Miscellaneous drivers ***
< > EMI 6|2m USB Audio interface support

...

< > USB YUREX driver support
<*> USB Gadget Support --->
*** OTG and related infrastructure ***
< > GPIO based peripheral-only VBUS sensing 'transceiver'
[*] Generic ULPI Transceiver Driver
< > TWL6030 USB Transceiver Driver
{*} NOP USB Transceiver Driver

.

Under Device Drivers -> USB support -> USB Gadget Support

[ ] Debugging information files (DEVELOPMENT)
(2) Maximum VBUS Power usage (2-500 mA)
(2) Number of storage pipeline buffers
<M> USB Peripheral Controller
< > Faraday FUSB300 USB Peripheral Controller
< > OMAP USB Device Controller
< > Renesas R8A66597 USB Peripheral Controller
<M> Inventra HDRC USB Peripheral (TI, ADI, ...)
< > Renesas M66592 USB Peripheral Controller
< > PLX NET2272
<M> USB Gadget Drivers
< > Gadget Zero (DEVELOPMENT)
< > Ethernet Gadget (with CDC Ethernet support)
< > Network Control Model (NCM) support
< > Gadget Filesystem (EXPERIMENTAL)
< > Function Filesystem (EXPERIMENTAL)
< > File-backed Storage Gadget (DEPRECATED)
<M> Mass Storage Gadget
< > Serial Gadget (with CDC ACM and CDC OBEX support)
< > Printer Gadget
< > CDC Composite Device (Ethernet and ACM)
< > CDC Composite Device (ACM and mass storage)
< > Multifunction Composite Gadget (EXPERIMENTAL)
< > HID Gadget
< > EHCI Debug Device Gadget

 

I also have an initialization script that start these modules: usb-storage and ti81xx (modprobe then take care of the dependencies).

The Kernel image I get is able to properly identify and use the HUB as host, but I don't seem to get the USB1 port to work as both host and device. In fact, as of right now, I can only use it as a device: I can mount one mtd partition with g_mass_storage and see its contents no my PC. If I connect a flash drive to this port nothing happens.

I tried changing the board configuration file so that USB1 would be set as MUSB_HOST too. That works, indicating that the problem I'm having is not within my hardware.

I would like to use this port as host until I explicitly configure the g_mass_storage module to change its behavior to device. Am I missing some configuration I would have to set when the Linux is running? Maybe some other configuration?

Regards,

DAVI

  • Hi Davi,
     
    OTG role (Host/Device) is usually switched by the USB_ID signal. I will ask the factory team to comment on your use case.
  • Davi,

    Davi Evangelista said:
    I would like to use this port as host until I explicitly configure the g_mass_storage module to change its behavior to device.

    It looks to me that you did not load g_mass_storage module when you want this port work in host mode, did you?

    Please note that a gadget driver is also required for a otg port to work in _host_ mode in 3.2 kernel. If you don't want to load g_mass_storage.ko in host mode, you can load any other gadget module, for example, g_zero.ko.

  • The moment the Linux is up and running there isn't any gadget module loaded for the USB1 port, neither the g_mass_storage nor any other. I was expecting that without a gadget driver loaded the port would work as host...

    The only gadget driver I'm going to use is the g_mass_storage, hence the example.

    Is there any module I need to load so that I can configure USB1 to host?

    Regards,

    DAVI

  • g_zero worked! I didn't notice at first that that was the module I should load...

    Regards,

    DAVI