diff options
| author | Kishon Vijay Abraham I <kishon@ti.com> | 2012-06-22 07:32:46 -0400 |
|---|---|---|
| committer | Felipe Balbi <balbi@ti.com> | 2012-06-25 07:05:35 -0400 |
| commit | 662dca54ca67c92b7aa14b9a2ec54acacf33ce45 (patch) | |
| tree | 80c77434b1c4d33ce4e7db56f284c9ae65e16a8d /include/linux/usb | |
| parent | 721002ec1dd55a52425455826af49cf8853b2d4f (diff) | |
usb: otg: support for multiple transceivers by a single controller
Add a linked list for keeping multiple PHY instances with different
types so that we can have separate USB2 and USB3 PHYs on one single
board. _get_phy_ has been changed so that the controller gets
the transceiver by type. _remove_phy_ has been added to let the phy
be removed from the phy list.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include/linux/usb')
| -rw-r--r-- | include/linux/usb/otg.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 0e739c810525..1def65fb57d0 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 */ | ||
| 47 | enum usb_phy_type { | ||
| 48 | USB_PHY_TYPE_UNDEFINED, | ||
| 49 | USB_PHY_TYPE_USB2, | ||
| 50 | USB_PHY_TYPE_USB3, | ||
| 51 | }; | ||
| 52 | |||
| 46 | struct usb_phy; | 53 | struct 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 */ |
| 124 | extern int usb_add_phy(struct usb_phy *); | 135 | extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type); |
| 136 | extern 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,11 +184,11 @@ 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 |
| 175 | extern struct usb_phy *usb_get_phy(void); | 187 | extern struct usb_phy *usb_get_phy(enum usb_phy_type type); |
| 176 | extern void usb_put_phy(struct usb_phy *); | 188 | extern void usb_put_phy(struct usb_phy *); |
| 177 | extern const char *otg_state_string(enum usb_otg_state state); | 189 | extern const char *otg_state_string(enum usb_otg_state state); |
| 178 | #else | 190 | #else |
| 179 | static inline struct usb_phy *usb_get_phy(void) | 191 | static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) |
| 180 | { | 192 | { |
| 181 | return NULL; | 193 | return NULL; |
| 182 | } | 194 | } |
| @@ -276,4 +288,15 @@ usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb) | |||
| 276 | /* for OTG controller drivers (and maybe other stuff) */ | 288 | /* for OTG controller drivers (and maybe other stuff) */ |
| 277 | extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); | 289 | extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); |
| 278 | 290 | ||
| 291 | static inline const char *usb_phy_type_string(enum usb_phy_type type) | ||
| 292 | { | ||
| 293 | switch (type) { | ||
| 294 | case USB_PHY_TYPE_USB2: | ||
| 295 | return "USB2 PHY"; | ||
| 296 | case USB_PHY_TYPE_USB3: | ||
| 297 | return "USB3 PHY"; | ||
| 298 | default: | ||
| 299 | return "UNKNOWN PHY TYPE"; | ||
| 300 | } | ||
| 301 | } | ||
| 279 | #endif /* __LINUX_USB_OTG_H */ | 302 | #endif /* __LINUX_USB_OTG_H */ |
