aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/phy
diff options
context:
space:
mode:
authorDavid Lechner <david@lechnology.com>2016-05-09 19:39:59 -0400
committerKishon Vijay Abraham I <kishon@ti.com>2016-07-04 07:49:22 -0400
commit300eb0139cf27044c67f6005ff17b8434c7843f0 (patch)
tree62c0de657f6928db11a9139c3c552b877ec7958b /include/linux/phy
parent65048f4dd9fae7335b48ab23a879119c0e7fa105 (diff)
phy: Add set_mode callback
The initial use for this is for PHYs that have a mode related to USB OTG. There are several SoCs (e.g. TI OMAP and DA8xx) that have a mode setting in the USB PHY to override OTG VBUS and ID signals. Of course, the enum can be expaned in the future to include modes for other types of PHYs as well. Suggested-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: David Lechner <david@lechnology.com>
Diffstat (limited to 'include/linux/phy')
-rw-r--r--include/linux/phy/phy.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index a810f2a18842..f08b67238b58 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -22,12 +22,20 @@
22 22
23struct phy; 23struct phy;
24 24
25enum phy_mode {
26 PHY_MODE_INVALID,
27 PHY_MODE_USB_HOST,
28 PHY_MODE_USB_DEVICE,
29 PHY_MODE_USB_OTG,
30};
31
25/** 32/**
26 * struct phy_ops - set of function pointers for performing phy operations 33 * struct phy_ops - set of function pointers for performing phy operations
27 * @init: operation to be performed for initializing phy 34 * @init: operation to be performed for initializing phy
28 * @exit: operation to be performed while exiting 35 * @exit: operation to be performed while exiting
29 * @power_on: powering on the phy 36 * @power_on: powering on the phy
30 * @power_off: powering off the phy 37 * @power_off: powering off the phy
38 * @set_mode: set the mode of the phy
31 * @owner: the module owner containing the ops 39 * @owner: the module owner containing the ops
32 */ 40 */
33struct phy_ops { 41struct phy_ops {
@@ -35,6 +43,7 @@ struct phy_ops {
35 int (*exit)(struct phy *phy); 43 int (*exit)(struct phy *phy);
36 int (*power_on)(struct phy *phy); 44 int (*power_on)(struct phy *phy);
37 int (*power_off)(struct phy *phy); 45 int (*power_off)(struct phy *phy);
46 int (*set_mode)(struct phy *phy, enum phy_mode mode);
38 struct module *owner; 47 struct module *owner;
39}; 48};
40 49
@@ -126,6 +135,7 @@ int phy_init(struct phy *phy);
126int phy_exit(struct phy *phy); 135int phy_exit(struct phy *phy);
127int phy_power_on(struct phy *phy); 136int phy_power_on(struct phy *phy);
128int phy_power_off(struct phy *phy); 137int phy_power_off(struct phy *phy);
138int phy_set_mode(struct phy *phy, enum phy_mode mode);
129static inline int phy_get_bus_width(struct phy *phy) 139static inline int phy_get_bus_width(struct phy *phy)
130{ 140{
131 return phy->attrs.bus_width; 141 return phy->attrs.bus_width;
@@ -233,6 +243,13 @@ static inline int phy_power_off(struct phy *phy)
233 return -ENOSYS; 243 return -ENOSYS;
234} 244}
235 245
246static inline int phy_set_mode(struct phy *phy, enum phy_mode mode)
247{
248 if (!phy)
249 return 0;
250 return -ENOSYS;
251}
252
236static inline int phy_get_bus_width(struct phy *phy) 253static inline int phy_get_bus_width(struct phy *phy)
237{ 254{
238 return -ENOSYS; 255 return -ENOSYS;