aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-05 18:35:41 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-05 18:35:41 -0400
commitff9cce82772a78983b529e044d85884d3ec95fda (patch)
tree6491adac0538739a415f7b776d1865ce7ae5d1f7 /include/linux/usb
parent933141509cefd64102a943d61d154c5c53bad889 (diff)
parentf8ecf829481b2cc7301a811da9d2df53ef174977 (diff)
Merge tag 'xceiv-for-v3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
usb: phy: patches for v3.6 merge window We are starting to support multiple USB phys as we should thanks for Kishon's work. DeviceTree support for USB PHYs won't come until discussion with DeviceTree maintainer is finished. Together with that series, we have one fix for twl4030 which missed a IRQF_ONESHOT annotation when requesting a threaded IRQ without a top half handler, and removal of an unused variable compilation warning to isp1301_omap.
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/musb-omap.h30
-rw-r--r--include/linux/usb/otg.h46
2 files changed, 71 insertions, 5 deletions
diff --git a/include/linux/usb/musb-omap.h b/include/linux/usb/musb-omap.h
new file mode 100644
index 00000000000..7774c5986f0
--- /dev/null
+++ b/include/linux/usb/musb-omap.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2011-2012 by Texas Instruments
3 *
4 * The Inventra Controller Driver for Linux is free software; you
5 * can redistribute it and/or modify it under the terms of the GNU
6 * General Public License version 2 as published by the Free Software
7 * Foundation.
8 */
9
10#ifndef __MUSB_OMAP_H__
11#define __MUSB_OMAP_H__
12
13enum omap_musb_vbus_id_status {
14 OMAP_MUSB_UNKNOWN = 0,
15 OMAP_MUSB_ID_GROUND,
16 OMAP_MUSB_ID_FLOAT,
17 OMAP_MUSB_VBUS_VALID,
18 OMAP_MUSB_VBUS_OFF,
19};
20
21#if (defined(CONFIG_USB_MUSB_OMAP2PLUS) || \
22 defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE))
23void omap_musb_mailbox(enum omap_musb_vbus_id_status status);
24#else
25static inline void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
26{
27}
28#endif
29
30#endif /* __MUSB_OMAP_H__ */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 38ab3f46346..0cb2ec2e50c 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -43,6 +43,13 @@ enum usb_phy_events {
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */ 43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44}; 44};
45 45
46/* associate a type with PHY */
47enum usb_phy_type {
48 USB_PHY_TYPE_UNDEFINED,
49 USB_PHY_TYPE_USB2,
50 USB_PHY_TYPE_USB3,
51};
52
46struct usb_phy; 53struct usb_phy;
47 54
48/* for transceivers connected thru an ULPI interface, the user must 55/* for transceivers connected thru an ULPI interface, the user must
@@ -89,6 +96,7 @@ struct usb_phy {
89 const char *label; 96 const char *label;
90 unsigned int flags; 97 unsigned int flags;
91 98
99 enum usb_phy_type type;
92 enum usb_otg_state state; 100 enum usb_otg_state state;
93 enum usb_phy_events last_event; 101 enum usb_phy_events last_event;
94 102
@@ -105,6 +113,9 @@ struct usb_phy {
105 u16 port_status; 113 u16 port_status;
106 u16 port_change; 114 u16 port_change;
107 115
116 /* to support controllers that have multiple transceivers */
117 struct list_head head;
118
108 /* initialize/shutdown the OTG controller */ 119 /* initialize/shutdown the OTG controller */
109 int (*init)(struct usb_phy *x); 120 int (*init)(struct usb_phy *x);
110 void (*shutdown)(struct usb_phy *x); 121 void (*shutdown)(struct usb_phy *x);
@@ -121,7 +132,8 @@ struct usb_phy {
121 132
122 133
123/* for board-specific init logic */ 134/* for board-specific init logic */
124extern int usb_set_transceiver(struct usb_phy *); 135extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type);
136extern void usb_remove_phy(struct usb_phy *);
125 137
126#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 138#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
127/* sometimes transceivers are accessed only through e.g. ULPI */ 139/* sometimes transceivers are accessed only through e.g. ULPI */
@@ -172,16 +184,29 @@ usb_phy_shutdown(struct usb_phy *x)
172 184
173/* for usb host and peripheral controller drivers */ 185/* for usb host and peripheral controller drivers */
174#ifdef CONFIG_USB_OTG_UTILS 186#ifdef CONFIG_USB_OTG_UTILS
175extern struct usb_phy *usb_get_transceiver(void); 187extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
176extern void usb_put_transceiver(struct usb_phy *); 188extern struct usb_phy *devm_usb_get_phy(struct device *dev,
189 enum usb_phy_type type);
190extern void usb_put_phy(struct usb_phy *);
191extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x);
177extern const char *otg_state_string(enum usb_otg_state state); 192extern const char *otg_state_string(enum usb_otg_state state);
178#else 193#else
179static inline struct usb_phy *usb_get_transceiver(void) 194static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
195{
196 return NULL;
197}
198
199static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
200 enum usb_phy_type type)
180{ 201{
181 return NULL; 202 return NULL;
182} 203}
183 204
184static inline void usb_put_transceiver(struct usb_phy *x) 205static inline void usb_put_phy(struct usb_phy *x)
206{
207}
208
209static inline void devm_usb_put_phy(struct device *dev, struct usb_phy *x)
185{ 210{
186} 211}
187 212
@@ -276,4 +301,15 @@ usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
276/* for OTG controller drivers (and maybe other stuff) */ 301/* for OTG controller drivers (and maybe other stuff) */
277extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 302extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
278 303
304static inline const char *usb_phy_type_string(enum usb_phy_type type)
305{
306 switch (type) {
307 case USB_PHY_TYPE_USB2:
308 return "USB2 PHY";
309 case USB_PHY_TYPE_USB3:
310 return "USB3 PHY";
311 default:
312 return "UNKNOWN PHY TYPE";
313 }
314}
279#endif /* __LINUX_USB_OTG_H */ 315#endif /* __LINUX_USB_OTG_H */