aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2016-03-30 05:56:28 -0400
committerPeter Chen <peter.chen@nxp.com>2016-04-06 05:14:50 -0400
commitfa59507f720077a856c9952a31cfd45cd97ef6f9 (patch)
treee2fbaa5216ce0c43c71029360cd31fde4ebe8eab /include/linux/usb
parent2b2fe36def086f0b721be2f34223cf662dd87902 (diff)
usb: otg-fsm: Add documentation for struct otg_fsm
struct otg_fsm is the interface to the OTG state machine. Document the input, output and internal state variables. Definations are taken from Table 7-2 and Table 7-4 of the USB OTG & EH Specification Rev.2.0 Re-arrange some of the members as per use case for more clarity. Signed-off-by: Roger Quadros <rogerq@ti.com> Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/otg-fsm.h90
1 files changed, 83 insertions, 7 deletions
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index 24198e16f849..8eec0c261be5 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -72,37 +72,113 @@ enum otg_fsm_timer {
72 NUM_OTG_FSM_TIMERS, 72 NUM_OTG_FSM_TIMERS,
73}; 73};
74 74
75/* OTG state machine according to the OTG spec */ 75/**
76 * struct otg_fsm - OTG state machine according to the OTG spec
77 *
78 * OTG hardware Inputs
79 *
80 * Common inputs for A and B device
81 * @id: TRUE for B-device, FALSE for A-device.
82 * @adp_change: TRUE when current ADP measurement (n) value, compared to the
83 * ADP measurement taken at n-2, differs by more than CADP_THR
84 * @power_up: TRUE when the OTG device first powers up its USB system and
85 * ADP measurement taken if ADP capable
86 *
87 * A-Device state inputs
88 * @a_srp_det: TRUE if the A-device detects SRP
89 * @a_vbus_vld: TRUE when VBUS voltage is in regulation
90 * @b_conn: TRUE if the A-device detects connection from the B-device
91 * @a_bus_resume: TRUE when the B-device detects that the A-device is signaling
92 * a resume (K state)
93 * B-Device state inputs
94 * @a_bus_suspend: TRUE when the B-device detects that the A-device has put the
95 * bus into suspend
96 * @a_conn: TRUE if the B-device detects a connection from the A-device
97 * @b_se0_srp: TRUE when the line has been at SE0 for more than the minimum
98 * time before generating SRP
99 * @b_ssend_srp: TRUE when the VBUS has been below VOTG_SESS_VLD for more than
100 * the minimum time before generating SRP
101 * @b_sess_vld: TRUE when the B-device detects that the voltage on VBUS is
102 * above VOTG_SESS_VLD
103 * @test_device: TRUE when the B-device switches to B-Host and detects an OTG
104 * test device. This must be set by host/hub driver
105 *
106 * Application inputs (A-Device)
107 * @a_bus_drop: TRUE when A-device application needs to power down the bus
108 * @a_bus_req: TRUE when A-device application wants to use the bus.
109 * FALSE to suspend the bus
110 *
111 * Application inputs (B-Device)
112 * @b_bus_req: TRUE during the time that the Application running on the
113 * B-device wants to use the bus
114 *
115 * Auxilary inputs (OTG v1.3 only. Obsolete now.)
116 * @a_sess_vld: TRUE if the A-device detects that VBUS is above VA_SESS_VLD
117 * @b_bus_suspend: TRUE when the A-device detects that the B-device has put
118 * the bus into suspend
119 * @b_bus_resume: TRUE when the A-device detects that the B-device is signaling
120 * resume on the bus
121 *
122 * OTG Output status. Read only for users. Updated by OTG FSM helpers defined
123 * in this file
124 *
125 * Outputs for Both A and B device
126 * @drv_vbus: TRUE when A-device is driving VBUS
127 * @loc_conn: TRUE when the local device has signaled that it is connected
128 * to the bus
129 * @loc_sof: TRUE when the local device is generating activity on the bus
130 * @adp_prb: TRUE when the local device is in the process of doing
131 * ADP probing
132 *
133 * Outputs for B-device state
134 * @adp_sns: TRUE when the B-device is in the process of carrying out
135 * ADP sensing
136 * @data_pulse: TRUE when the B-device is performing data line pulsing
137 *
138 * Internal Variables
139 *
140 * a_set_b_hnp_en: TRUE when the A-device has successfully set the
141 * b_hnp_enable bit in the B-device.
142 * Unused as OTG fsm uses otg->host->b_hnp_enable instead
143 * b_srp_done: TRUE when the B-device has completed initiating SRP
144 * b_hnp_enable: TRUE when the B-device has accepted the
145 * SetFeature(b_hnp_enable) B-device.
146 * Unused as OTG fsm uses otg->gadget->b_hnp_enable instead
147 * a_clr_err: Asserted (by application ?) to clear a_vbus_err due to an
148 * overcurrent condition and causes the A-device to transition
149 * to a_wait_vfall
150 */
76struct otg_fsm { 151struct otg_fsm {
77 /* Input */ 152 /* Input */
78 int id; 153 int id;
79 int adp_change; 154 int adp_change;
80 int power_up; 155 int power_up;
81 int test_device;
82 int a_bus_drop;
83 int a_bus_req;
84 int a_srp_det; 156 int a_srp_det;
85 int a_vbus_vld; 157 int a_vbus_vld;
86 int b_conn; 158 int b_conn;
87 int a_bus_resume; 159 int a_bus_resume;
88 int a_bus_suspend; 160 int a_bus_suspend;
89 int a_conn; 161 int a_conn;
90 int b_bus_req;
91 int b_se0_srp; 162 int b_se0_srp;
92 int b_ssend_srp; 163 int b_ssend_srp;
93 int b_sess_vld; 164 int b_sess_vld;
165 int test_device;
166 int a_bus_drop;
167 int a_bus_req;
168 int b_bus_req;
169
94 /* Auxilary inputs */ 170 /* Auxilary inputs */
95 int a_sess_vld; 171 int a_sess_vld;
96 int b_bus_resume; 172 int b_bus_resume;
97 int b_bus_suspend; 173 int b_bus_suspend;
98 174
99 /* Output */ 175 /* Output */
100 int data_pulse;
101 int drv_vbus; 176 int drv_vbus;
102 int loc_conn; 177 int loc_conn;
103 int loc_sof; 178 int loc_sof;
104 int adp_prb; 179 int adp_prb;
105 int adp_sns; 180 int adp_sns;
181 int data_pulse;
106 182
107 /* Internal variables */ 183 /* Internal variables */
108 int a_set_b_hnp_en; 184 int a_set_b_hnp_en;
@@ -110,7 +186,7 @@ struct otg_fsm {
110 int b_hnp_enable; 186 int b_hnp_enable;
111 int a_clr_err; 187 int a_clr_err;
112 188
113 /* Informative variables */ 189 /* Informative variables. All unused as of now */
114 int a_bus_drop_inf; 190 int a_bus_drop_inf;
115 int a_bus_req_inf; 191 int a_bus_req_inf;
116 int a_clr_err_inf; 192 int a_clr_err_inf;