aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/otg.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb/otg.h')
-rw-r--r--include/linux/usb/otg.h50
1 files changed, 5 insertions, 45 deletions
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 5c1cfbc73555..de89342098e4 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -89,15 +89,11 @@ struct usb_phy {
89 const char *label; 89 const char *label;
90 unsigned int flags; 90 unsigned int flags;
91 91
92 u8 default_a;
93 enum usb_otg_state state; 92 enum usb_otg_state state;
94 enum usb_phy_events last_event; 93 enum usb_phy_events last_event;
95 94
96 struct usb_otg *otg; 95 struct usb_otg *otg;
97 96
98 struct usb_bus *host;
99 struct usb_gadget *gadget;
100
101 struct usb_phy_io_ops *io_ops; 97 struct usb_phy_io_ops *io_ops;
102 void __iomem *io_priv; 98 void __iomem *io_priv;
103 99
@@ -112,32 +108,14 @@ struct usb_phy {
112 int (*init)(struct usb_phy *x); 108 int (*init)(struct usb_phy *x);
113 void (*shutdown)(struct usb_phy *x); 109 void (*shutdown)(struct usb_phy *x);
114 110
115 /* bind/unbind the host controller */
116 int (*set_host)(struct usb_phy *x,
117 struct usb_bus *host);
118
119 /* bind/unbind the peripheral controller */
120 int (*set_peripheral)(struct usb_phy *x,
121 struct usb_gadget *gadget);
122
123 /* effective for B devices, ignored for A-peripheral */ 111 /* effective for B devices, ignored for A-peripheral */
124 int (*set_power)(struct usb_phy *x, 112 int (*set_power)(struct usb_phy *x,
125 unsigned mA); 113 unsigned mA);
126 114
127 /* effective for A-peripheral, ignored for B devices */
128 int (*set_vbus)(struct usb_phy *x,
129 bool enabled);
130
131 /* for non-OTG B devices: set transceiver into suspend mode */ 115 /* for non-OTG B devices: set transceiver into suspend mode */
132 int (*set_suspend)(struct usb_phy *x, 116 int (*set_suspend)(struct usb_phy *x,
133 int suspend); 117 int suspend);
134 118
135 /* for B devices only: start session with A-Host */
136 int (*start_srp)(struct usb_phy *x);
137
138 /* start or continue HNP role switch */
139 int (*start_hnp)(struct usb_phy *x);
140
141}; 119};
142 120
143 121
@@ -219,7 +197,7 @@ otg_start_hnp(struct usb_phy *x)
219 if (x->otg && x->otg->start_hnp) 197 if (x->otg && x->otg->start_hnp)
220 return x->otg->start_hnp(x->otg); 198 return x->otg->start_hnp(x->otg);
221 199
222 return x->start_hnp(x); 200 return -ENOTSUPP;
223} 201}
224 202
225/* Context: can sleep */ 203/* Context: can sleep */
@@ -229,7 +207,7 @@ otg_set_vbus(struct usb_phy *x, bool enabled)
229 if (x->otg && x->otg->set_vbus) 207 if (x->otg && x->otg->set_vbus)
230 return x->otg->set_vbus(x->otg, enabled); 208 return x->otg->set_vbus(x->otg, enabled);
231 209
232 return x->set_vbus(x, enabled); 210 return -ENOTSUPP;
233} 211}
234 212
235/* for HCDs */ 213/* for HCDs */
@@ -239,7 +217,7 @@ otg_set_host(struct usb_phy *x, struct usb_bus *host)
239 if (x->otg && x->otg->set_host) 217 if (x->otg && x->otg->set_host)
240 return x->otg->set_host(x->otg, host); 218 return x->otg->set_host(x->otg, host);
241 219
242 return x->set_host(x, host); 220 return -ENOTSUPP;
243} 221}
244 222
245/* for usb peripheral controller drivers */ 223/* for usb peripheral controller drivers */
@@ -251,7 +229,7 @@ otg_set_peripheral(struct usb_phy *x, struct usb_gadget *periph)
251 if (x->otg && x->otg->set_peripheral) 229 if (x->otg && x->otg->set_peripheral)
252 return x->otg->set_peripheral(x->otg, periph); 230 return x->otg->set_peripheral(x->otg, periph);
253 231
254 return x->set_peripheral(x, periph); 232 return -ENOTSUPP;
255} 233}
256 234
257static inline int 235static inline int
@@ -278,7 +256,7 @@ otg_start_srp(struct usb_phy *x)
278 if (x->otg && x->otg->start_srp) 256 if (x->otg && x->otg->start_srp)
279 return x->otg->start_srp(x->otg); 257 return x->otg->start_srp(x->otg);
280 258
281 return x->start_srp(x); 259 return -ENOTSUPP;
282} 260}
283 261
284/* notifiers */ 262/* notifiers */
@@ -297,22 +275,4 @@ usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
297/* for OTG controller drivers (and maybe other stuff) */ 275/* for OTG controller drivers (and maybe other stuff) */
298extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 276extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
299 277
300/* Temporary aliases for transceiver functions */
301#define otg_set_transceiver(x) usb_set_transceiver(x)
302#define otg_get_transceiver() usb_get_transceiver()
303#define otg_put_transceiver(x) usb_put_transceiver(x)
304
305#define otg_io_read(x, a) usb_phy_io_read(x, a)
306#define otg_io_write(x, a, b) usb_phy_io_write(x, a, b)
307
308#define otg_init(x) usb_phy_init(x)
309#define otg_shutdown(x) usb_phy_shutdown(x)
310#define otg_set_power(x, a) usb_phy_set_power(x, a)
311#define otg_set_suspend(x, a) usb_phy_set_suspend(x, a)
312
313#define otg_register_notifier(x, a) usb_register_notifier(x, a)
314#define otg_unregister_notifier(x, a) usb_unregiser_notifier(x, a)
315
316#define otg_io_access_ops usb_phy_io_ops
317
318#endif /* __LINUX_USB_OTG_H */ 278#endif /* __LINUX_USB_OTG_H */