Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v4.6-rc4 93 lines 3.4 kB view raw
11. How to test OTG FSM(HNP and SRP) 2----------------------------------- 3To show how to demo OTG HNP and SRP functions via sys input files 4with 2 Freescale i.MX6Q sabre SD boards. 5 61.1 How to enable OTG FSM in menuconfig 7--------------------------------------- 8Select CONFIG_USB_OTG_FSM, rebuild kernel Image and modules. 9If you want to check some internal variables for otg fsm, 10mount debugfs, there are 2 files which can show otg fsm 11variables and some controller registers value: 12cat /sys/kernel/debug/ci_hdrc.0/otg 13cat /sys/kernel/debug/ci_hdrc.0/registers 14 151.2 Test operations 16------------------- 171) Power up 2 Freescale i.MX6Q sabre SD boards with gadget class driver loaded 18 (e.g. g_mass_storage). 19 202) Connect 2 boards with usb cable with one end is micro A plug, the other end 21 is micro B plug. 22 23 The A-device(with micro A plug inserted) should enumrate B-device. 24 253) Role switch 26 On B-device: 27 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req 28 29 B-device should take host role and enumrate A-device. 30 314) A-device switch back to host. 32 On B-device: 33 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req 34 35 or, by introducing HNP polling, B-Host can know when A-peripheral wish 36 to be host role, so this role switch also can be trigged in A-peripheral 37 side by answering the polling from B-Host, this can be done on A-device: 38 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req 39 40 A-device should switch back to host and enumrate B-device. 41 425) Remove B-device(unplug micro B plug) and insert again in 10 seconds, 43 A-device should enumrate B-device again. 44 456) Remove B-device(unplug micro B plug) and insert again after 10 seconds, 46 A-device should NOT enumrate B-device. 47 48 if A-device wants to use bus: 49 On A-device: 50 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop 51 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req 52 53 if B-device wants to use bus: 54 On B-device: 55 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req 56 577) A-device power down the bus. 58 On A-device: 59 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop 60 61 A-device should disconnect with B-device and power down the bus. 62 638) B-device does data pulse for SRP. 64 On B-device: 65 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req 66 67 A-device should resume usb bus and enumrate B-device. 68 691.3 Reference document 70---------------------- 71"On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification 72July 27, 2012 Revision 2.0 version 1.1a" 73 742. How to enable USB as system wakeup source 75----------------------------------- 76Below is the example for how to enable USB as system wakeup source 77at imx6 platform. 78 792.1 Enable core's wakeup 80echo enabled > /sys/bus/platform/devices/ci_hdrc.0/power/wakeup 812.2 Enable glue layer's wakeup 82echo enabled > /sys/bus/platform/devices/2184000.usb/power/wakeup 832.3 Enable PHY's wakeup (optional) 84echo enabled > /sys/bus/platform/devices/20c9000.usbphy/power/wakeup 852.4 Enable roothub's wakeup 86echo enabled > /sys/bus/usb/devices/usb1/power/wakeup 872.5 Enable related device's wakeup 88echo enabled > /sys/bus/usb/devices/1-1/power/wakeup 89 90If the system has only one usb port, and you want usb wakeup at this port, you 91can use below script to enable usb wakeup. 92for i in $(find /sys -name wakeup | grep usb);do echo enabled > $i;done; 93