chipidea.txt 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.
  5. 1.1 How to enable OTG FSM in menuconfig
  6. ---------------------------------------
  7. Select CONFIG_USB_OTG_FSM, rebuild kernel Image and modules.
  8. If you want to check some internal variables for otg fsm,
  9. select CONFIG_USB_CHIPIDEA_DEBUG, there are 2 files which
  10. can show otg fsm variables and some controller registers value:
  11. cat /sys/kernel/debug/ci_hdrc.0/otg
  12. cat /sys/kernel/debug/ci_hdrc.0/registers
  13. 1.2 Test operations
  14. -------------------
  15. 1) Power up 2 Freescale i.MX6Q sabre SD boards with gadget class driver loaded
  16. (e.g. g_mass_storage).
  17. 2) Connect 2 boards with usb cable with one end is micro A plug, the other end
  18. is micro B plug.
  19. The A-device(with micro A plug inserted) should enumrate B-device.
  20. 3) Role switch
  21. On B-device:
  22. echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
  23. if HNP polling is not supported, also need:
  24. On A-device:
  25. echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
  26. B-device should take host role and enumrate A-device.
  27. 4) A-device switch back to host.
  28. On B-device:
  29. echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
  30. A-device should switch back to host and enumrate B-device.
  31. 5) Remove B-device(unplug micro B plug) and insert again in 10 seconds,
  32. A-device should enumrate B-device again.
  33. 6) Remove B-device(unplug micro B plug) and insert again after 10 seconds,
  34. A-device should NOT enumrate B-device.
  35. if A-device wants to use bus:
  36. On A-device:
  37. echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop
  38. echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
  39. if B-device wants to use bus:
  40. On B-device:
  41. echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
  42. 7) A-device power down the bus.
  43. On A-device:
  44. echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop
  45. A-device should disconnect with B-device and power down the bus.
  46. 8) B-device does data pulse for SRP.
  47. On B-device:
  48. echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
  49. A-device should resume usb bus and enumrate B-device.
  50. 1.3 Reference document
  51. ----------------------
  52. "On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification
  53. July 27, 2012 Revision 2.0 version 1.1a"
  54. 2. How to enable USB as system wakeup source
  55. -----------------------------------
  56. Below is the example for how to enable USB as system wakeup source
  57. at imx6 platform.
  58. 2.1 Enable core's wakeup
  59. echo enabled > /sys/bus/platform/devices/ci_hdrc.0/power/wakeup
  60. 2.2 Enable glue layer's wakeup
  61. echo enabled > /sys/bus/platform/devices/2184000.usb/power/wakeup
  62. 2.3 Enable PHY's wakeup (optional)
  63. echo enabled > /sys/bus/platform/devices/20c9000.usbphy/power/wakeup
  64. 2.4 Enable roothub's wakeup
  65. echo enabled > /sys/bus/usb/devices/usb1/power/wakeup
  66. 2.5 Enable related device's wakeup
  67. echo enabled > /sys/bus/usb/devices/1-1/power/wakeup
  68. If the system has only one usb port, and you want usb wakeup at this port, you
  69. can use below script to enable usb wakeup.
  70. for i in $(find /sys -name wakeup | grep usb);do echo enabled > $i;done;