aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy/phy-fsm-usb.h
diff options
context:
space:
mode:
authorAnton Tikhomirov <av.tikhomirov@samsung.com>2013-10-02 23:42:04 -0400
committerFelipe Balbi <balbi@ti.com>2013-10-04 10:44:46 -0400
commitf6de27eed372f41646b7bd95d6903923f5308517 (patch)
tree16ec735ae61a94ff35dd15474a92e54c0b73cca7 /drivers/usb/phy/phy-fsm-usb.h
parent425d710172cee47ed5e18eefd3308d88643de76d (diff)
usb: phy: Fix OTG FSM timer handling
Get rid of using OTG driver specific timers by passing timer type to corresponding callbacks. Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy/phy-fsm-usb.h')
-rw-r--r--drivers/usb/phy/phy-fsm-usb.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/usb/phy/phy-fsm-usb.h b/drivers/usb/phy/phy-fsm-usb.h
index 157f10672767..b47b32c6ed1f 100644
--- a/drivers/usb/phy/phy-fsm-usb.h
+++ b/drivers/usb/phy/phy-fsm-usb.h
@@ -34,6 +34,17 @@
34#define PROTO_HOST (1) 34#define PROTO_HOST (1)
35#define PROTO_GADGET (2) 35#define PROTO_GADGET (2)
36 36
37enum otg_fsm_timer {
38 A_WAIT_VRISE,
39 A_WAIT_BCON,
40 A_AIDL_BDIS,
41 B_ASE0_BRST,
42 B_SE0_SRP,
43 B_SRP_FAIL,
44 A_WAIT_ENUM,
45 NUM_OTG_FSM_TIMERS,
46};
47
37/* OTG state machine according to the OTG spec */ 48/* OTG state machine according to the OTG spec */
38struct otg_fsm { 49struct otg_fsm {
39 /* Input */ 50 /* Input */
@@ -88,8 +99,8 @@ struct otg_fsm_ops {
88 void (*loc_conn)(struct otg_fsm *fsm, int on); 99 void (*loc_conn)(struct otg_fsm *fsm, int on);
89 void (*loc_sof)(struct otg_fsm *fsm, int on); 100 void (*loc_sof)(struct otg_fsm *fsm, int on);
90 void (*start_pulse)(struct otg_fsm *fsm); 101 void (*start_pulse)(struct otg_fsm *fsm);
91 void (*add_timer)(struct otg_fsm *fsm, void *timer); 102 void (*add_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer);
92 void (*del_timer)(struct otg_fsm *fsm, void *timer); 103 void (*del_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer);
93 int (*start_host)(struct otg_fsm *fsm, int on); 104 int (*start_host)(struct otg_fsm *fsm, int on);
94 int (*start_gadget)(struct otg_fsm *fsm, int on); 105 int (*start_gadget)(struct otg_fsm *fsm, int on);
95}; 106};
@@ -144,7 +155,7 @@ static inline int otg_start_pulse(struct otg_fsm *fsm)
144 return 0; 155 return 0;
145} 156}
146 157
147static inline int otg_add_timer(struct otg_fsm *fsm, void *timer) 158static inline int otg_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer timer)
148{ 159{
149 if (!fsm->ops->add_timer) 160 if (!fsm->ops->add_timer)
150 return -EOPNOTSUPP; 161 return -EOPNOTSUPP;
@@ -152,7 +163,7 @@ static inline int otg_add_timer(struct otg_fsm *fsm, void *timer)
152 return 0; 163 return 0;
153} 164}
154 165
155static inline int otg_del_timer(struct otg_fsm *fsm, void *timer) 166static inline int otg_del_timer(struct otg_fsm *fsm, enum otg_fsm_timer timer)
156{ 167{
157 if (!fsm->ops->del_timer) 168 if (!fsm->ops->del_timer)
158 return -EOPNOTSUPP; 169 return -EOPNOTSUPP;
@@ -175,8 +186,3 @@ static inline int otg_start_gadget(struct otg_fsm *fsm, int on)
175} 186}
176 187
177int otg_statemachine(struct otg_fsm *fsm); 188int otg_statemachine(struct otg_fsm *fsm);
178
179/* Defined by device specific driver, for different timer implementation */
180extern struct fsl_otg_timer *a_wait_vrise_tmr, *a_wait_bcon_tmr,
181 *a_aidl_bdis_tmr, *b_ase0_brst_tmr, *b_se0_srp_tmr, *b_srp_fail_tmr,
182 *a_wait_enum_tmr;