aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy/phy-fsm-usb.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/phy/phy-fsm-usb.h')
-rw-r--r--drivers/usb/phy/phy-fsm-usb.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/usb/phy/phy-fsm-usb.h b/drivers/usb/phy/phy-fsm-usb.h
index 2f185ed0f54f..6ce3b3cfd7b5 100644
--- a/drivers/usb/phy/phy-fsm-usb.h
+++ b/drivers/usb/phy/phy-fsm-usb.h
@@ -54,6 +54,9 @@ enum otg_fsm_timer {
54/* OTG state machine according to the OTG spec */ 54/* OTG state machine according to the OTG spec */
55struct otg_fsm { 55struct otg_fsm {
56 /* Input */ 56 /* Input */
57 int adp_change;
58 int power_up;
59 int test_device;
57 int a_bus_drop; 60 int a_bus_drop;
58 int a_bus_req; 61 int a_bus_req;
59 int a_bus_resume; 62 int a_bus_resume;
@@ -93,9 +96,12 @@ struct otg_fsm {
93 int b_bus_req_inf; 96 int b_bus_req_inf;
94 97
95 /* Output */ 98 /* Output */
99 int data_pulse;
96 int drv_vbus; 100 int drv_vbus;
97 int loc_conn; 101 int loc_conn;
98 int loc_sof; 102 int loc_sof;
103 int adp_prb;
104 int adp_sns;
99 105
100 struct otg_fsm_ops *ops; 106 struct otg_fsm_ops *ops;
101 struct usb_otg *otg; 107 struct usb_otg *otg;
@@ -111,6 +117,8 @@ struct otg_fsm_ops {
111 void (*loc_conn)(struct otg_fsm *fsm, int on); 117 void (*loc_conn)(struct otg_fsm *fsm, int on);
112 void (*loc_sof)(struct otg_fsm *fsm, int on); 118 void (*loc_sof)(struct otg_fsm *fsm, int on);
113 void (*start_pulse)(struct otg_fsm *fsm); 119 void (*start_pulse)(struct otg_fsm *fsm);
120 void (*start_adp_prb)(struct otg_fsm *fsm);
121 void (*start_adp_sns)(struct otg_fsm *fsm);
114 void (*add_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer); 122 void (*add_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer);
115 void (*del_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer); 123 void (*del_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer);
116 int (*start_host)(struct otg_fsm *fsm, int on); 124 int (*start_host)(struct otg_fsm *fsm, int on);
@@ -163,7 +171,33 @@ static inline int otg_start_pulse(struct otg_fsm *fsm)
163{ 171{
164 if (!fsm->ops->start_pulse) 172 if (!fsm->ops->start_pulse)
165 return -EOPNOTSUPP; 173 return -EOPNOTSUPP;
166 fsm->ops->start_pulse(fsm); 174 if (!fsm->data_pulse) {
175 fsm->data_pulse = 1;
176 fsm->ops->start_pulse(fsm);
177 }
178 return 0;
179}
180
181static inline int otg_start_adp_prb(struct otg_fsm *fsm)
182{
183 if (!fsm->ops->start_adp_prb)
184 return -EOPNOTSUPP;
185 if (!fsm->adp_prb) {
186 fsm->adp_sns = 0;
187 fsm->adp_prb = 1;
188 fsm->ops->start_adp_prb(fsm);
189 }
190 return 0;
191}
192
193static inline int otg_start_adp_sns(struct otg_fsm *fsm)
194{
195 if (!fsm->ops->start_adp_sns)
196 return -EOPNOTSUPP;
197 if (!fsm->adp_sns) {
198 fsm->adp_sns = 1;
199 fsm->ops->start_adp_sns(fsm);
200 }
167 return 0; 201 return 0;
168} 202}
169 203