aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/otg/otg_fsm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/otg/otg_fsm.c')
-rw-r--r--drivers/usb/otg/otg_fsm.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/usb/otg/otg_fsm.c b/drivers/usb/otg/otg_fsm.c
index 09117387d2a4..ade131a8ae5e 100644
--- a/drivers/usb/otg/otg_fsm.c
+++ b/drivers/usb/otg/otg_fsm.c
@@ -117,10 +117,10 @@ void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
117int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) 117int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
118{ 118{
119 state_changed = 1; 119 state_changed = 1;
120 if (fsm->transceiver->state == new_state) 120 if (fsm->otg->phy->state == new_state)
121 return 0; 121 return 0;
122 VDBG("Set state: %s\n", otg_state_string(new_state)); 122 VDBG("Set state: %s\n", otg_state_string(new_state));
123 otg_leave_state(fsm, fsm->transceiver->state); 123 otg_leave_state(fsm, fsm->otg->phy->state);
124 switch (new_state) { 124 switch (new_state) {
125 case OTG_STATE_B_IDLE: 125 case OTG_STATE_B_IDLE:
126 otg_drv_vbus(fsm, 0); 126 otg_drv_vbus(fsm, 0);
@@ -155,8 +155,8 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
155 otg_loc_conn(fsm, 0); 155 otg_loc_conn(fsm, 0);
156 otg_loc_sof(fsm, 1); 156 otg_loc_sof(fsm, 1);
157 otg_set_protocol(fsm, PROTO_HOST); 157 otg_set_protocol(fsm, PROTO_HOST);
158 usb_bus_start_enum(fsm->transceiver->host, 158 usb_bus_start_enum(fsm->otg->host,
159 fsm->transceiver->host->otg_port); 159 fsm->otg->host->otg_port);
160 break; 160 break;
161 case OTG_STATE_A_IDLE: 161 case OTG_STATE_A_IDLE:
162 otg_drv_vbus(fsm, 0); 162 otg_drv_vbus(fsm, 0);
@@ -221,7 +221,7 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
221 break; 221 break;
222 } 222 }
223 223
224 fsm->transceiver->state = new_state; 224 fsm->otg->phy->state = new_state;
225 return 0; 225 return 0;
226} 226}
227 227
@@ -233,7 +233,7 @@ int otg_statemachine(struct otg_fsm *fsm)
233 233
234 spin_lock_irqsave(&fsm->lock, flags); 234 spin_lock_irqsave(&fsm->lock, flags);
235 235
236 state = fsm->transceiver->state; 236 state = fsm->otg->phy->state;
237 state_changed = 0; 237 state_changed = 0;
238 /* State machine state change judgement */ 238 /* State machine state change judgement */
239 239
@@ -248,7 +248,7 @@ int otg_statemachine(struct otg_fsm *fsm)
248 case OTG_STATE_B_IDLE: 248 case OTG_STATE_B_IDLE:
249 if (!fsm->id) 249 if (!fsm->id)
250 otg_set_state(fsm, OTG_STATE_A_IDLE); 250 otg_set_state(fsm, OTG_STATE_A_IDLE);
251 else if (fsm->b_sess_vld && fsm->transceiver->gadget) 251 else if (fsm->b_sess_vld && fsm->otg->gadget)
252 otg_set_state(fsm, OTG_STATE_B_PERIPHERAL); 252 otg_set_state(fsm, OTG_STATE_B_PERIPHERAL);
253 else if (fsm->b_bus_req && fsm->b_sess_end && fsm->b_se0_srp) 253 else if (fsm->b_bus_req && fsm->b_sess_end && fsm->b_se0_srp)
254 otg_set_state(fsm, OTG_STATE_B_SRP_INIT); 254 otg_set_state(fsm, OTG_STATE_B_SRP_INIT);
@@ -260,7 +260,7 @@ int otg_statemachine(struct otg_fsm *fsm)
260 case OTG_STATE_B_PERIPHERAL: 260 case OTG_STATE_B_PERIPHERAL:
261 if (!fsm->id || !fsm->b_sess_vld) 261 if (!fsm->id || !fsm->b_sess_vld)
262 otg_set_state(fsm, OTG_STATE_B_IDLE); 262 otg_set_state(fsm, OTG_STATE_B_IDLE);
263 else if (fsm->b_bus_req && fsm->transceiver-> 263 else if (fsm->b_bus_req && fsm->otg->
264 gadget->b_hnp_enable && fsm->a_bus_suspend) 264 gadget->b_hnp_enable && fsm->a_bus_suspend)
265 otg_set_state(fsm, OTG_STATE_B_WAIT_ACON); 265 otg_set_state(fsm, OTG_STATE_B_WAIT_ACON);
266 break; 266 break;
@@ -302,7 +302,7 @@ int otg_statemachine(struct otg_fsm *fsm)
302 break; 302 break;
303 case OTG_STATE_A_HOST: 303 case OTG_STATE_A_HOST:
304 if ((!fsm->a_bus_req || fsm->a_suspend_req) && 304 if ((!fsm->a_bus_req || fsm->a_suspend_req) &&
305 fsm->transceiver->host->b_hnp_enable) 305 fsm->otg->host->b_hnp_enable)
306 otg_set_state(fsm, OTG_STATE_A_SUSPEND); 306 otg_set_state(fsm, OTG_STATE_A_SUSPEND);
307 else if (fsm->id || !fsm->b_conn || fsm->a_bus_drop) 307 else if (fsm->id || !fsm->b_conn || fsm->a_bus_drop)
308 otg_set_state(fsm, OTG_STATE_A_WAIT_BCON); 308 otg_set_state(fsm, OTG_STATE_A_WAIT_BCON);
@@ -310,9 +310,9 @@ int otg_statemachine(struct otg_fsm *fsm)
310 otg_set_state(fsm, OTG_STATE_A_VBUS_ERR); 310 otg_set_state(fsm, OTG_STATE_A_VBUS_ERR);
311 break; 311 break;
312 case OTG_STATE_A_SUSPEND: 312 case OTG_STATE_A_SUSPEND:
313 if (!fsm->b_conn && fsm->transceiver->host->b_hnp_enable) 313 if (!fsm->b_conn && fsm->otg->host->b_hnp_enable)
314 otg_set_state(fsm, OTG_STATE_A_PERIPHERAL); 314 otg_set_state(fsm, OTG_STATE_A_PERIPHERAL);
315 else if (!fsm->b_conn && !fsm->transceiver->host->b_hnp_enable) 315 else if (!fsm->b_conn && !fsm->otg->host->b_hnp_enable)
316 otg_set_state(fsm, OTG_STATE_A_WAIT_BCON); 316 otg_set_state(fsm, OTG_STATE_A_WAIT_BCON);
317 else if (fsm->a_bus_req || fsm->b_bus_resume) 317 else if (fsm->a_bus_req || fsm->b_bus_resume)
318 otg_set_state(fsm, OTG_STATE_A_HOST); 318 otg_set_state(fsm, OTG_STATE_A_HOST);