1 1. How to test OTG FSM(HNP and SRP)
2 -----------------------------------
3 To show how to demo OTG HNP and SRP functions via sys input files
4 with 2 Freescale i.MX6Q sabre SD boards.
6 1.1 How to enable OTG FSM in menuconfig
7 ---------------------------------------
8 Select CONFIG_USB_OTG_FSM, rebuild kernel Image and modules.
9 If you want to check some internal variables for otg fsm,
10 select CONFIG_USB_CHIPIDEA_DEBUG, there are 2 files which
11 can show otg fsm variables and some controller registers value:
12 cat /sys/kernel/debug/ci_hdrc.0/otg
13 cat /sys/kernel/debug/ci_hdrc.0/registers
17 1) Power up 2 Freescale i.MX6Q sabre SD boards with gadget class driver loaded
18 (e.g. g_mass_storage).
20 2) Connect 2 boards with usb cable with one end is micro A plug, the other end
23 The A-device(with micro A plug inserted) should enumrate B-device.
27 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
29 if HNP polling is not supported, also need:
31 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
33 B-device should take host role and enumrate A-device.
35 4) A-device switch back to host.
37 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
39 A-device should switch back to host and enumrate B-device.
41 5) Remove B-device(unplug micro B plug) and insert again in 10 seconds,
42 A-device should enumrate B-device again.
44 6) Remove B-device(unplug micro B plug) and insert again after 10 seconds,
45 A-device should NOT enumrate B-device.
47 if A-device wants to use bus:
49 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop
50 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
52 if B-device wants to use bus:
54 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
56 7) A-device power down the bus.
58 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop
60 A-device should disconnect with B-device and power down the bus.
62 8) B-device does data pulse for SRP.
64 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
66 A-device should resume usb bus and enumrate B-device.
68 1.3 Reference document
69 ----------------------
70 "On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification
71 July 27, 2012 Revision 2.0 version 1.1a"