6AJ USB DRD

From OMAPpedia

Jump to: navigation, search

Contents

[edit] USB DRD (Dual Role Device)

DRD is dual role device, where DWC3 USB controller can be switched to "host-mode" or "device-mode" at runtime.

The USB mode can be set either manually through sysfs entries or automatically based on usb-id pin when the usb cable (type-A for host, type-B for device) is connected to usb1 or usb2 ports.

[edit] How does DRD work?

The host stack, device stack and the gadget module must all be initialized first.

[edit] Build instructions

       git revert 1603b05dd5ea33e8be254d71060d2a6ff1327041 --no-edit
       http://review.omapzoom.org/#/c/34936/

[edit] DRD Testing performed on TI's J6 EVM.

       # mount -t debugfs debugfs /mnt
       # echo "device" > /mnt/48890000-dwc3/mode
       # echo "device" > /mnt/488d0000-dwc3/mode

To switch usb1 port to host mode

       # echo "host" > /mnt/48890000-dwc3/mode

To switch usb1 port to device mode

       # echo "device" > /mnt/48890000-dwc3/mode

To switch usb2 port to host mode

       # echo "host" > /mnt/488d0000-dwc3/mode

To switch usb2 port to device mode

       # echo "device" > /mnt/488d000-dwc3/mode
       # insmod /lib/modules/3.8.13-xxx/kernel/drivers/usb/gadget/libcomposite.ko
       # insmod /lib/modules/3.8.13-xxx/kernel/drivers/usb/gadget/g_zero.ko (for usb1 port)
       # insmod /lib/modules/3.8.13-xxx/kernel/drivers/usb/gadget/g_mass_storage.ko file=/dev/ram0 stall=0 (for usb2 port)

The g_zero gadget is loaded to usb1, and g_mass_storage to usb2.

To view the current mode of usb1 or usb2

       # cat /mnt/48890000-dwc3/mode
       # cat /mnt/488d0000-dwc3/mode
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox