chipidea.rst 3.7 KB

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