1 ==============================================
2 ChipIdea Highspeed Dual Role Controller Driver
3 ==============================================
5 1. How to test OTG FSM(HNP and SRP)
6 -----------------------------------
8 To show how to demo OTG HNP and SRP functions via sys input files
9 with 2 Freescale i.MX6Q sabre SD boards.
11 1.1 How to enable OTG FSM
12 -------------------------
14 1.1.1 Select CONFIG_USB_OTG_FSM in menuconfig, rebuild kernel
15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 Image and modules. If you want to check some internal
18 variables for otg fsm, mount debugfs, there are 2 files
19 which can show otg fsm variables and some controller registers value::
21 cat /sys/kernel/debug/ci_hdrc.0/otg
22 cat /sys/kernel/debug/ci_hdrc.0/registers
24 1.1.2 Add below entries in your dts file for your controller node
25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35 1) Power up 2 Freescale i.MX6Q sabre SD boards with gadget class driver loaded
36 (e.g. g_mass_storage).
38 2) Connect 2 boards with usb cable: one end is micro A plug, the other end
41 The A-device (with micro A plug inserted) should enumerate B-device.
47 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
49 B-device should take host role and enumerate A-device.
51 4) A-device switch back to host.
55 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
57 or, by introducing HNP polling, B-Host can know when A-peripheral wishes to
58 be in the host role, so this role switch also can be triggered in
59 A-peripheral side by answering the polling from B-Host. This can be done on
62 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
64 A-device should switch back to host and enumerate B-device.
66 5) Remove B-device (unplug micro B plug) and insert again in 10 seconds;
67 A-device should enumerate B-device again.
69 6) Remove B-device (unplug micro B plug) and insert again after 10 seconds;
70 A-device should NOT enumerate B-device.
72 if A-device wants to use bus:
76 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop
77 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
79 if B-device wants to use bus:
83 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
85 7) A-device power down the bus.
89 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop
91 A-device should disconnect with B-device and power down the bus.
93 8) B-device does data pulse for SRP.
97 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
99 A-device should resume usb bus and enumerate B-device.
101 1.3 Reference document
102 ----------------------
103 "On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification
104 July 27, 2012 Revision 2.0 version 1.1a"
106 2. How to enable USB as system wakeup source
107 --------------------------------------------
108 Below is the example for how to enable USB as system wakeup source
111 2.1 Enable core's wakeup::
113 echo enabled > /sys/bus/platform/devices/ci_hdrc.0/power/wakeup
115 2.2 Enable glue layer's wakeup::
117 echo enabled > /sys/bus/platform/devices/2184000.usb/power/wakeup
119 2.3 Enable PHY's wakeup (optional)::
121 echo enabled > /sys/bus/platform/devices/20c9000.usbphy/power/wakeup
123 2.4 Enable roothub's wakeup::
125 echo enabled > /sys/bus/usb/devices/usb1/power/wakeup
127 2.5 Enable related device's wakeup::
129 echo enabled > /sys/bus/usb/devices/1-1/power/wakeup
131 If the system has only one usb port, and you want usb wakeup at this port, you
132 can use the below script to enable usb wakeup::
134 for i in $(find /sys -name wakeup | grep usb);do echo enabled > $i;done;