0001 ==============================================
0002 ChipIdea Highspeed Dual Role Controller Driver
0003 ==============================================
0004
0005 1. How to test OTG FSM(HNP and SRP)
0006 -----------------------------------
0007
0008 To show how to demo OTG HNP and SRP functions via sys input files
0009 with 2 Freescale i.MX6Q sabre SD boards.
0010
0011 1.1 How to enable OTG FSM
0012 -------------------------
0013
0014 1.1.1 Select CONFIG_USB_OTG_FSM in menuconfig, rebuild kernel
0015 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0016
0017 Image and modules. If you want to check some internal
0018 variables for otg fsm, mount debugfs, there are 2 files
0019 which can show otg fsm variables and some controller registers value::
0020
0021 cat /sys/kernel/debug/ci_hdrc.0/otg
0022 cat /sys/kernel/debug/ci_hdrc.0/registers
0023
0024 1.1.2 Add below entries in your dts file for your controller node
0025 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0026
0027 ::
0028
0029 otg-rev = <0x0200>;
0030 adp-disable;
0031
0032 1.2 Test operations
0033 -------------------
0034
0035 1) Power up 2 Freescale i.MX6Q sabre SD boards with gadget class driver loaded
0036 (e.g. g_mass_storage).
0037
0038 2) Connect 2 boards with usb cable with one end is micro A plug, the other end
0039 is micro B plug.
0040
0041 The A-device(with micro A plug inserted) should enumerate B-device.
0042
0043 3) Role switch
0044
0045 On B-device::
0046
0047 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
0048
0049 B-device should take host role and enumerate A-device.
0050
0051 4) A-device switch back to host.
0052
0053 On B-device::
0054
0055 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
0056
0057 or, by introducing HNP polling, B-Host can know when A-peripheral wish
0058 to be host role, so this role switch also can be trigged in A-peripheral
0059 side by answering the polling from B-Host, this can be done on A-device::
0060
0061 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
0062
0063 A-device should switch back to host and enumerate B-device.
0064
0065 5) Remove B-device(unplug micro B plug) and insert again in 10 seconds,
0066 A-device should enumerate B-device again.
0067
0068 6) Remove B-device(unplug micro B plug) and insert again after 10 seconds,
0069 A-device should NOT enumerate B-device.
0070
0071 if A-device wants to use bus:
0072
0073 On A-device::
0074
0075 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop
0076 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
0077
0078 if B-device wants to use bus:
0079
0080 On B-device::
0081
0082 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
0083
0084 7) A-device power down the bus.
0085
0086 On A-device::
0087
0088 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop
0089
0090 A-device should disconnect with B-device and power down the bus.
0091
0092 8) B-device does data pulse for SRP.
0093
0094 On B-device::
0095
0096 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
0097
0098 A-device should resume usb bus and enumerate B-device.
0099
0100 1.3 Reference document
0101 ----------------------
0102 "On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification
0103 July 27, 2012 Revision 2.0 version 1.1a"
0104
0105 2. How to enable USB as system wakeup source
0106 --------------------------------------------
0107 Below is the example for how to enable USB as system wakeup source
0108 at imx6 platform.
0109
0110 2.1 Enable core's wakeup::
0111
0112 echo enabled > /sys/bus/platform/devices/ci_hdrc.0/power/wakeup
0113
0114 2.2 Enable glue layer's wakeup::
0115
0116 echo enabled > /sys/bus/platform/devices/2184000.usb/power/wakeup
0117
0118 2.3 Enable PHY's wakeup (optional)::
0119
0120 echo enabled > /sys/bus/platform/devices/20c9000.usbphy/power/wakeup
0121
0122 2.4 Enable roothub's wakeup::
0123
0124 echo enabled > /sys/bus/usb/devices/usb1/power/wakeup
0125
0126 2.5 Enable related device's wakeup::
0127
0128 echo enabled > /sys/bus/usb/devices/1-1/power/wakeup
0129
0130 If the system has only one usb port, and you want usb wakeup at this port, you
0131 can use below script to enable usb wakeup::
0132
0133 for i in $(find /sys -name wakeup | grep usb);do echo enabled > $i;done;