diff options
-rw-r--r-- | drivers/usb/phy/phy-fsm-usb.c | 12 | ||||
-rw-r--r-- | drivers/usb/phy/phy-fsm-usb.h | 8 |
2 files changed, 17 insertions, 3 deletions
diff --git a/drivers/usb/phy/phy-fsm-usb.c b/drivers/usb/phy/phy-fsm-usb.c index f8fe7ec620e6..5e899edcaf39 100644 --- a/drivers/usb/phy/phy-fsm-usb.c +++ b/drivers/usb/phy/phy-fsm-usb.c | |||
@@ -102,8 +102,12 @@ void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) | |||
102 | fsm->a_suspend_req = 0; | 102 | fsm->a_suspend_req = 0; |
103 | break; | 103 | break; |
104 | case OTG_STATE_A_PERIPHERAL: | 104 | case OTG_STATE_A_PERIPHERAL: |
105 | otg_del_timer(fsm, A_BIDL_ADIS); | ||
106 | fsm->a_bidl_adis_tmout = 0; | ||
105 | break; | 107 | break; |
106 | case OTG_STATE_A_WAIT_VFALL: | 108 | case OTG_STATE_A_WAIT_VFALL: |
109 | otg_del_timer(fsm, A_WAIT_VFALL); | ||
110 | fsm->a_wait_vfall_tmout = 0; | ||
107 | otg_del_timer(fsm, A_WAIT_VRISE); | 111 | otg_del_timer(fsm, A_WAIT_VRISE); |
108 | break; | 112 | break; |
109 | case OTG_STATE_A_VBUS_ERR: | 113 | case OTG_STATE_A_VBUS_ERR: |
@@ -204,12 +208,14 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) | |||
204 | otg_loc_sof(fsm, 0); | 208 | otg_loc_sof(fsm, 0); |
205 | otg_set_protocol(fsm, PROTO_GADGET); | 209 | otg_set_protocol(fsm, PROTO_GADGET); |
206 | otg_drv_vbus(fsm, 1); | 210 | otg_drv_vbus(fsm, 1); |
211 | otg_add_timer(fsm, A_BIDL_ADIS); | ||
207 | break; | 212 | break; |
208 | case OTG_STATE_A_WAIT_VFALL: | 213 | case OTG_STATE_A_WAIT_VFALL: |
209 | otg_drv_vbus(fsm, 0); | 214 | otg_drv_vbus(fsm, 0); |
210 | otg_loc_conn(fsm, 0); | 215 | otg_loc_conn(fsm, 0); |
211 | otg_loc_sof(fsm, 0); | 216 | otg_loc_sof(fsm, 0); |
212 | otg_set_protocol(fsm, PROTO_HOST); | 217 | otg_set_protocol(fsm, PROTO_HOST); |
218 | otg_add_timer(fsm, A_WAIT_VFALL); | ||
213 | break; | 219 | break; |
214 | case OTG_STATE_A_VBUS_ERR: | 220 | case OTG_STATE_A_VBUS_ERR: |
215 | otg_drv_vbus(fsm, 0); | 221 | otg_drv_vbus(fsm, 0); |
@@ -324,14 +330,14 @@ int otg_statemachine(struct otg_fsm *fsm) | |||
324 | case OTG_STATE_A_PERIPHERAL: | 330 | case OTG_STATE_A_PERIPHERAL: |
325 | if (fsm->id || fsm->a_bus_drop) | 331 | if (fsm->id || fsm->a_bus_drop) |
326 | otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL); | 332 | otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL); |
327 | else if (fsm->b_bus_suspend) | 333 | else if (fsm->a_bidl_adis_tmout || fsm->b_bus_suspend) |
328 | otg_set_state(fsm, OTG_STATE_A_WAIT_BCON); | 334 | otg_set_state(fsm, OTG_STATE_A_WAIT_BCON); |
329 | else if (!fsm->a_vbus_vld) | 335 | else if (!fsm->a_vbus_vld) |
330 | otg_set_state(fsm, OTG_STATE_A_VBUS_ERR); | 336 | otg_set_state(fsm, OTG_STATE_A_VBUS_ERR); |
331 | break; | 337 | break; |
332 | case OTG_STATE_A_WAIT_VFALL: | 338 | case OTG_STATE_A_WAIT_VFALL: |
333 | if (fsm->id || fsm->a_bus_req || (!fsm->a_sess_vld && | 339 | if (fsm->a_wait_vfall_tmout || fsm->id || fsm->a_bus_req || |
334 | !fsm->b_conn)) | 340 | (!fsm->a_sess_vld && !fsm->b_conn)) |
335 | otg_set_state(fsm, OTG_STATE_A_IDLE); | 341 | otg_set_state(fsm, OTG_STATE_A_IDLE); |
336 | break; | 342 | break; |
337 | case OTG_STATE_A_VBUS_ERR: | 343 | case OTG_STATE_A_VBUS_ERR: |
diff --git a/drivers/usb/phy/phy-fsm-usb.h b/drivers/usb/phy/phy-fsm-usb.h index b47b32c6ed1f..a74e14aaa839 100644 --- a/drivers/usb/phy/phy-fsm-usb.h +++ b/drivers/usb/phy/phy-fsm-usb.h | |||
@@ -35,13 +35,19 @@ | |||
35 | #define PROTO_GADGET (2) | 35 | #define PROTO_GADGET (2) |
36 | 36 | ||
37 | enum otg_fsm_timer { | 37 | enum otg_fsm_timer { |
38 | /* Standard OTG timers */ | ||
38 | A_WAIT_VRISE, | 39 | A_WAIT_VRISE, |
40 | A_WAIT_VFALL, | ||
39 | A_WAIT_BCON, | 41 | A_WAIT_BCON, |
40 | A_AIDL_BDIS, | 42 | A_AIDL_BDIS, |
41 | B_ASE0_BRST, | 43 | B_ASE0_BRST, |
44 | A_BIDL_ADIS, | ||
45 | |||
46 | /* Auxiliary timers */ | ||
42 | B_SE0_SRP, | 47 | B_SE0_SRP, |
43 | B_SRP_FAIL, | 48 | B_SRP_FAIL, |
44 | A_WAIT_ENUM, | 49 | A_WAIT_ENUM, |
50 | |||
45 | NUM_OTG_FSM_TIMERS, | 51 | NUM_OTG_FSM_TIMERS, |
46 | }; | 52 | }; |
47 | 53 | ||
@@ -69,9 +75,11 @@ struct otg_fsm { | |||
69 | 75 | ||
70 | /* Timeout indicator for timers */ | 76 | /* Timeout indicator for timers */ |
71 | int a_wait_vrise_tmout; | 77 | int a_wait_vrise_tmout; |
78 | int a_wait_vfall_tmout; | ||
72 | int a_wait_bcon_tmout; | 79 | int a_wait_bcon_tmout; |
73 | int a_aidl_bdis_tmout; | 80 | int a_aidl_bdis_tmout; |
74 | int b_ase0_brst_tmout; | 81 | int b_ase0_brst_tmout; |
82 | int a_bidl_adis_tmout; | ||
75 | 83 | ||
76 | /* Informative variables */ | 84 | /* Informative variables */ |
77 | int a_bus_drop; | 85 | int a_bus_drop; |