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

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>

authored by

Roger Quadros and committed by
Peter Chen
fa59507f 2b2fe36d

+83 -7
+83 -7
include/linux/usb/otg-fsm.h
··· 72 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 + */ 76 151 struct otg_fsm { 77 152 /* Input */ 78 153 int id; 79 154 int adp_change; 80 155 int power_up; 81 - int test_device; 82 - int a_bus_drop; 83 - int a_bus_req; 84 156 int a_srp_det; 85 157 int a_vbus_vld; 86 158 int b_conn; 87 159 int a_bus_resume; 88 160 int a_bus_suspend; 89 161 int a_conn; 90 - int b_bus_req; 91 162 int b_se0_srp; 92 163 int b_ssend_srp; 93 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 170 /* Auxilary inputs */ 95 171 int a_sess_vld; 96 172 int b_bus_resume; 97 173 int b_bus_suspend; 98 174 99 175 /* Output */ 100 - int data_pulse; 101 176 int drv_vbus; 102 177 int loc_conn; 103 178 int loc_sof; 104 179 int adp_prb; 105 180 int adp_sns; 181 + int data_pulse; 106 182 107 183 /* Internal variables */ 108 184 int a_set_b_hnp_en; ··· 186 110 int b_hnp_enable; 187 111 int a_clr_err; 188 112 189 - /* Informative variables */ 113 + /* Informative variables. All unused as of now */ 190 114 int a_bus_drop_inf; 191 115 int a_bus_req_inf; 192 116 int a_clr_err_inf;