chipidea.txt 3.4 KB

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