Merge tag 'tty-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
[linux-block.git] / Documentation / usb / chipidea.rst
CommitLineData
d80b5005
MCC
1==============================================
2ChipIdea Highspeed Dual Role Controller Driver
3==============================================
4
9159e049
LJ
51. How to test OTG FSM(HNP and SRP)
6-----------------------------------
d80b5005 7
9159e049
LJ
8To show how to demo OTG HNP and SRP functions via sys input files
9with 2 Freescale i.MX6Q sabre SD boards.
10
764763f0 111.1 How to enable OTG FSM
d80b5005
MCC
12-------------------------
13
764763f0 141.1.1 Select CONFIG_USB_OTG_FSM in menuconfig, rebuild kernel
d80b5005
MCC
15^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16
764763f0
PC
17Image and modules. If you want to check some internal
18variables for otg fsm, mount debugfs, there are 2 files
d80b5005
MCC
19which can show otg fsm variables and some controller registers value::
20
21 cat /sys/kernel/debug/ci_hdrc.0/otg
22 cat /sys/kernel/debug/ci_hdrc.0/registers
23
764763f0 241.1.2 Add below entries in your dts file for your controller node
d80b5005
MCC
25^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26
27::
28
764763f0
PC
29 otg-rev = <0x0200>;
30 adp-disable;
9159e049
LJ
31
321.2 Test operations
33-------------------
d80b5005 34
9159e049
LJ
351) Power up 2 Freescale i.MX6Q sabre SD boards with gadget class driver loaded
36 (e.g. g_mass_storage).
37
e4157519 382) Connect 2 boards with usb cable: one end is micro A plug, the other end
9159e049
LJ
39 is micro B plug.
40
e4157519 41 The A-device (with micro A plug inserted) should enumerate B-device.
9159e049
LJ
42
433) Role switch
d80b5005
MCC
44
45 On B-device::
46
47 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
9159e049 48
aa73f28e 49 B-device should take host role and enumerate A-device.
9159e049
LJ
50
514) A-device switch back to host.
d80b5005
MCC
52
53 On B-device::
54
55 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
9159e049 56
e4157519
RD
57 or, by introducing HNP polling, B-Host can know when A-peripheral wishes to
58 be in the host role, so this role switch also can be triggered in
59 A-peripheral side by answering the polling from B-Host. This can be done on
60 A-device::
d80b5005
MCC
61
62 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
dfbae330 63
aa73f28e 64 A-device should switch back to host and enumerate B-device.
9159e049 65
e4157519 665) Remove B-device (unplug micro B plug) and insert again in 10 seconds;
aa73f28e 67 A-device should enumerate B-device again.
9159e049 68
e4157519 696) Remove B-device (unplug micro B plug) and insert again after 10 seconds;
aa73f28e 70 A-device should NOT enumerate B-device.
9159e049
LJ
71
72 if A-device wants to use bus:
d80b5005
MCC
73
74 On A-device::
75
76 echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop
77 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
9159e049
LJ
78
79 if B-device wants to use bus:
d80b5005
MCC
80
81 On B-device::
82
83 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
9159e049
LJ
84
857) A-device power down the bus.
d80b5005
MCC
86
87 On A-device::
88
89 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop
9159e049
LJ
90
91 A-device should disconnect with B-device and power down the bus.
92
938) B-device does data pulse for SRP.
d80b5005
MCC
94
95 On B-device::
96
97 echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
9159e049 98
aa73f28e 99 A-device should resume usb bus and enumerate B-device.
9159e049
LJ
100
1011.3 Reference document
102----------------------
103"On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification
104July 27, 2012 Revision 2.0 version 1.1a"
01e3ad86
PC
105
1062. How to enable USB as system wakeup source
d80b5005 107--------------------------------------------
01e3ad86 108Below is the example for how to enable USB as system wakeup source
e4157519 109on an imx6 platform.
01e3ad86 110
d80b5005
MCC
1112.1 Enable core's wakeup::
112
113 echo enabled > /sys/bus/platform/devices/ci_hdrc.0/power/wakeup
114
1152.2 Enable glue layer's wakeup::
116
117 echo enabled > /sys/bus/platform/devices/2184000.usb/power/wakeup
118
1192.3 Enable PHY's wakeup (optional)::
120
121 echo enabled > /sys/bus/platform/devices/20c9000.usbphy/power/wakeup
122
1232.4 Enable roothub's wakeup::
124
125 echo enabled > /sys/bus/usb/devices/usb1/power/wakeup
126
1272.5 Enable related device's wakeup::
128
129 echo enabled > /sys/bus/usb/devices/1-1/power/wakeup
01e3ad86
PC
130
131If the system has only one usb port, and you want usb wakeup at this port, you
e4157519 132can use the below script to enable usb wakeup::
01e3ad86 133
d80b5005 134 for i in $(find /sys -name wakeup | grep usb);do echo enabled > $i;done;