Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 1 | /* |
| 2 | * phy.h -- generic phy header file |
| 3 | * |
| 4 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com |
| 5 | * |
| 6 | * Author: Kishon Vijay Abraham I <kishon@ti.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | */ |
| 13 | |
| 14 | #ifndef __DRIVERS_PHY_H |
| 15 | #define __DRIVERS_PHY_H |
| 16 | |
| 17 | #include <linux/err.h> |
| 18 | #include <linux/of.h> |
| 19 | #include <linux/device.h> |
| 20 | #include <linux/pm_runtime.h> |
Roger Quadros | 3be8812 | 2014-07-04 12:55:45 +0300 | [diff] [blame] | 21 | #include <linux/regulator/consumer.h> |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 22 | |
| 23 | struct phy; |
| 24 | |
David Lechner | 300eb01 | 2016-05-09 18:39:59 -0500 | [diff] [blame] | 25 | enum phy_mode { |
| 26 | PHY_MODE_INVALID, |
| 27 | PHY_MODE_USB_HOST, |
Manu Gautam | 3b3cd24 | 2018-01-16 16:27:09 +0530 | [diff] [blame] | 28 | PHY_MODE_USB_HOST_LS, |
| 29 | PHY_MODE_USB_HOST_FS, |
| 30 | PHY_MODE_USB_HOST_HS, |
| 31 | PHY_MODE_USB_HOST_SS, |
David Lechner | 300eb01 | 2016-05-09 18:39:59 -0500 | [diff] [blame] | 32 | PHY_MODE_USB_DEVICE, |
Manu Gautam | 3b3cd24 | 2018-01-16 16:27:09 +0530 | [diff] [blame] | 33 | PHY_MODE_USB_DEVICE_LS, |
| 34 | PHY_MODE_USB_DEVICE_FS, |
| 35 | PHY_MODE_USB_DEVICE_HS, |
| 36 | PHY_MODE_USB_DEVICE_SS, |
David Lechner | 300eb01 | 2016-05-09 18:39:59 -0500 | [diff] [blame] | 37 | PHY_MODE_USB_OTG, |
Antoine Tenart | 5c23f2d | 2017-08-30 10:29:12 +0200 | [diff] [blame] | 38 | PHY_MODE_SGMII, |
Antoine Tenart | 5490b87 | 2018-05-17 10:29:32 +0200 | [diff] [blame] | 39 | PHY_MODE_2500SGMII, |
Quentin Schulz | c2a9002 | 2018-10-04 14:22:03 +0200 | [diff] [blame] | 40 | PHY_MODE_QSGMII, |
Antoine Tenart | 5c23f2d | 2017-08-30 10:29:12 +0200 | [diff] [blame] | 41 | PHY_MODE_10GKR, |
Vivek Gautam | fd3e4c9 | 2017-10-12 11:49:33 +0530 | [diff] [blame] | 42 | PHY_MODE_UFS_HS_A, |
| 43 | PHY_MODE_UFS_HS_B, |
Quentin Schulz | c2a9002 | 2018-10-04 14:22:03 +0200 | [diff] [blame] | 44 | PHY_MODE_PCIE, |
David Lechner | 300eb01 | 2016-05-09 18:39:59 -0500 | [diff] [blame] | 45 | }; |
| 46 | |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 47 | /** |
| 48 | * struct phy_ops - set of function pointers for performing phy operations |
| 49 | * @init: operation to be performed for initializing phy |
| 50 | * @exit: operation to be performed while exiting |
| 51 | * @power_on: powering on the phy |
| 52 | * @power_off: powering off the phy |
David Lechner | 300eb01 | 2016-05-09 18:39:59 -0500 | [diff] [blame] | 53 | * @set_mode: set the mode of the phy |
Randy Li | cac18ec | 2016-09-10 02:59:37 +0800 | [diff] [blame] | 54 | * @reset: resetting the phy |
Andrzej Pietrasiewicz | 3691411 | 2017-10-09 14:00:50 +0200 | [diff] [blame] | 55 | * @calibrate: calibrate the phy |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 56 | * @owner: the module owner containing the ops |
| 57 | */ |
| 58 | struct phy_ops { |
| 59 | int (*init)(struct phy *phy); |
| 60 | int (*exit)(struct phy *phy); |
| 61 | int (*power_on)(struct phy *phy); |
| 62 | int (*power_off)(struct phy *phy); |
Grygorii Strashko | 79a5a18 | 2018-11-19 19:24:20 -0600 | [diff] [blame^] | 63 | int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode); |
Randy Li | cac18ec | 2016-09-10 02:59:37 +0800 | [diff] [blame] | 64 | int (*reset)(struct phy *phy); |
Andrzej Pietrasiewicz | 3691411 | 2017-10-09 14:00:50 +0200 | [diff] [blame] | 65 | int (*calibrate)(struct phy *phy); |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 66 | struct module *owner; |
| 67 | }; |
| 68 | |
| 69 | /** |
Matt Porter | 8feed34 | 2013-12-19 09:23:02 -0500 | [diff] [blame] | 70 | * struct phy_attrs - represents phy attributes |
| 71 | * @bus_width: Data path width implemented by PHY |
| 72 | */ |
| 73 | struct phy_attrs { |
| 74 | u32 bus_width; |
Manu Gautam | 3b3cd24 | 2018-01-16 16:27:09 +0530 | [diff] [blame] | 75 | enum phy_mode mode; |
Matt Porter | 8feed34 | 2013-12-19 09:23:02 -0500 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | /** |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 79 | * struct phy - represents the phy device |
| 80 | * @dev: phy device |
| 81 | * @id: id of the phy device |
| 82 | * @ops: function pointers for performing phy operations |
| 83 | * @init_data: list of PHY consumers (non-dt only) |
| 84 | * @mutex: mutex to protect phy_ops |
| 85 | * @init_count: used to protect when the PHY is used by multiple consumers |
| 86 | * @power_count: used to protect when the PHY is used by multiple consumers |
Dov Levenglick | becaf17 | 2018-02-02 18:34:50 +0200 | [diff] [blame] | 87 | * @attrs: used to specify PHY specific attributes |
| 88 | * @pwr: power regulator associated with the phy |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 89 | */ |
| 90 | struct phy { |
| 91 | struct device dev; |
| 92 | int id; |
| 93 | const struct phy_ops *ops; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 94 | struct mutex mutex; |
| 95 | int init_count; |
| 96 | int power_count; |
Matt Porter | 8feed34 | 2013-12-19 09:23:02 -0500 | [diff] [blame] | 97 | struct phy_attrs attrs; |
Roger Quadros | 3be8812 | 2014-07-04 12:55:45 +0300 | [diff] [blame] | 98 | struct regulator *pwr; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 99 | }; |
| 100 | |
| 101 | /** |
| 102 | * struct phy_provider - represents the phy provider |
| 103 | * @dev: phy provider device |
Dov Levenglick | becaf17 | 2018-02-02 18:34:50 +0200 | [diff] [blame] | 104 | * @children: can be used to override the default (dev->of_node) child node |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 105 | * @owner: the module owner having of_xlate |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 106 | * @list: to maintain a linked list of PHY providers |
Dov Levenglick | becaf17 | 2018-02-02 18:34:50 +0200 | [diff] [blame] | 107 | * @of_xlate: function pointer to obtain phy instance from phy pointer |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 108 | */ |
| 109 | struct phy_provider { |
| 110 | struct device *dev; |
Thierry Reding | 1140f7c | 2016-04-05 17:17:34 +0200 | [diff] [blame] | 111 | struct device_node *children; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 112 | struct module *owner; |
| 113 | struct list_head list; |
| 114 | struct phy * (*of_xlate)(struct device *dev, |
| 115 | struct of_phandle_args *args); |
| 116 | }; |
| 117 | |
Dov Levenglick | becaf17 | 2018-02-02 18:34:50 +0200 | [diff] [blame] | 118 | /** |
| 119 | * struct phy_lookup - PHY association in list of phys managed by the phy driver |
| 120 | * @node: list node |
| 121 | * @dev_id: the device of the association |
| 122 | * @con_id: connection ID string on device |
| 123 | * @phy: the phy of the association |
| 124 | */ |
Heikki Krogerus | b7bc15b | 2014-11-19 17:28:18 +0200 | [diff] [blame] | 125 | struct phy_lookup { |
| 126 | struct list_head node; |
| 127 | const char *dev_id; |
| 128 | const char *con_id; |
| 129 | struct phy *phy; |
| 130 | }; |
| 131 | |
Heikki Krogerus | d451057 | 2014-11-19 17:28:17 +0200 | [diff] [blame] | 132 | #define to_phy(a) (container_of((a), struct phy, dev)) |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 133 | |
| 134 | #define of_phy_provider_register(dev, xlate) \ |
Thierry Reding | 1140f7c | 2016-04-05 17:17:34 +0200 | [diff] [blame] | 135 | __of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate)) |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 136 | |
| 137 | #define devm_of_phy_provider_register(dev, xlate) \ |
Thierry Reding | 1140f7c | 2016-04-05 17:17:34 +0200 | [diff] [blame] | 138 | __devm_of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate)) |
| 139 | |
| 140 | #define of_phy_provider_register_full(dev, children, xlate) \ |
| 141 | __of_phy_provider_register(dev, children, THIS_MODULE, xlate) |
| 142 | |
| 143 | #define devm_of_phy_provider_register_full(dev, children, xlate) \ |
| 144 | __devm_of_phy_provider_register(dev, children, THIS_MODULE, xlate) |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 145 | |
| 146 | static inline void phy_set_drvdata(struct phy *phy, void *data) |
| 147 | { |
| 148 | dev_set_drvdata(&phy->dev, data); |
| 149 | } |
| 150 | |
| 151 | static inline void *phy_get_drvdata(struct phy *phy) |
| 152 | { |
| 153 | return dev_get_drvdata(&phy->dev); |
| 154 | } |
| 155 | |
| 156 | #if IS_ENABLED(CONFIG_GENERIC_PHY) |
| 157 | int phy_pm_runtime_get(struct phy *phy); |
| 158 | int phy_pm_runtime_get_sync(struct phy *phy); |
| 159 | int phy_pm_runtime_put(struct phy *phy); |
| 160 | int phy_pm_runtime_put_sync(struct phy *phy); |
| 161 | void phy_pm_runtime_allow(struct phy *phy); |
| 162 | void phy_pm_runtime_forbid(struct phy *phy); |
| 163 | int phy_init(struct phy *phy); |
| 164 | int phy_exit(struct phy *phy); |
| 165 | int phy_power_on(struct phy *phy); |
| 166 | int phy_power_off(struct phy *phy); |
Grygorii Strashko | 79a5a18 | 2018-11-19 19:24:20 -0600 | [diff] [blame^] | 167 | int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode); |
| 168 | #define phy_set_mode(phy, mode) \ |
| 169 | phy_set_mode_ext(phy, mode, 0) |
| 170 | |
Manu Gautam | 3b3cd24 | 2018-01-16 16:27:09 +0530 | [diff] [blame] | 171 | static inline enum phy_mode phy_get_mode(struct phy *phy) |
| 172 | { |
| 173 | return phy->attrs.mode; |
| 174 | } |
Randy Li | cac18ec | 2016-09-10 02:59:37 +0800 | [diff] [blame] | 175 | int phy_reset(struct phy *phy); |
Andrzej Pietrasiewicz | 3691411 | 2017-10-09 14:00:50 +0200 | [diff] [blame] | 176 | int phy_calibrate(struct phy *phy); |
Matt Porter | 8feed34 | 2013-12-19 09:23:02 -0500 | [diff] [blame] | 177 | static inline int phy_get_bus_width(struct phy *phy) |
| 178 | { |
| 179 | return phy->attrs.bus_width; |
| 180 | } |
| 181 | static inline void phy_set_bus_width(struct phy *phy, int bus_width) |
| 182 | { |
| 183 | phy->attrs.bus_width = bus_width; |
| 184 | } |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 185 | struct phy *phy_get(struct device *dev, const char *string); |
Andrew Lunn | 788a4d5 | 2014-02-04 18:33:12 +0100 | [diff] [blame] | 186 | struct phy *phy_optional_get(struct device *dev, const char *string); |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 187 | struct phy *devm_phy_get(struct device *dev, const char *string); |
Andrew Lunn | 788a4d5 | 2014-02-04 18:33:12 +0100 | [diff] [blame] | 188 | struct phy *devm_phy_optional_get(struct device *dev, const char *string); |
Kamil Debski | b5d682f | 2014-03-06 12:16:47 +0100 | [diff] [blame] | 189 | struct phy *devm_of_phy_get(struct device *dev, struct device_node *np, |
| 190 | const char *con_id); |
Arun Ramamurthy | 6be109b | 2015-04-22 16:04:11 -0700 | [diff] [blame] | 191 | struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, |
| 192 | int index); |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 193 | void phy_put(struct phy *phy); |
| 194 | void devm_phy_put(struct device *dev, struct phy *phy); |
Kamil Debski | 0b3f3b2 | 2014-03-06 12:16:46 +0100 | [diff] [blame] | 195 | struct phy *of_phy_get(struct device_node *np, const char *con_id); |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 196 | struct phy *of_phy_simple_xlate(struct device *dev, |
| 197 | struct of_phandle_args *args); |
Kishon Vijay Abraham I | f0ed817 | 2014-07-14 15:55:02 +0530 | [diff] [blame] | 198 | struct phy *phy_create(struct device *dev, struct device_node *node, |
Heikki Krogerus | dbc9863 | 2014-11-19 17:28:21 +0200 | [diff] [blame] | 199 | const struct phy_ops *ops); |
Kishon Vijay Abraham I | f0ed817 | 2014-07-14 15:55:02 +0530 | [diff] [blame] | 200 | struct phy *devm_phy_create(struct device *dev, struct device_node *node, |
Heikki Krogerus | dbc9863 | 2014-11-19 17:28:21 +0200 | [diff] [blame] | 201 | const struct phy_ops *ops); |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 202 | void phy_destroy(struct phy *phy); |
| 203 | void devm_phy_destroy(struct device *dev, struct phy *phy); |
| 204 | struct phy_provider *__of_phy_provider_register(struct device *dev, |
Thierry Reding | 1140f7c | 2016-04-05 17:17:34 +0200 | [diff] [blame] | 205 | struct device_node *children, struct module *owner, |
| 206 | struct phy * (*of_xlate)(struct device *dev, |
| 207 | struct of_phandle_args *args)); |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 208 | struct phy_provider *__devm_of_phy_provider_register(struct device *dev, |
Thierry Reding | 1140f7c | 2016-04-05 17:17:34 +0200 | [diff] [blame] | 209 | struct device_node *children, struct module *owner, |
| 210 | struct phy * (*of_xlate)(struct device *dev, |
| 211 | struct of_phandle_args *args)); |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 212 | void of_phy_provider_unregister(struct phy_provider *phy_provider); |
| 213 | void devm_of_phy_provider_unregister(struct device *dev, |
| 214 | struct phy_provider *phy_provider); |
Heikki Krogerus | b7bc15b | 2014-11-19 17:28:18 +0200 | [diff] [blame] | 215 | int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id); |
| 216 | void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id); |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 217 | #else |
| 218 | static inline int phy_pm_runtime_get(struct phy *phy) |
| 219 | { |
Grygorii Strashko | 2b97789 | 2014-04-19 08:51:44 +0530 | [diff] [blame] | 220 | if (!phy) |
| 221 | return 0; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 222 | return -ENOSYS; |
| 223 | } |
| 224 | |
| 225 | static inline int phy_pm_runtime_get_sync(struct phy *phy) |
| 226 | { |
Grygorii Strashko | 2b97789 | 2014-04-19 08:51:44 +0530 | [diff] [blame] | 227 | if (!phy) |
| 228 | return 0; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 229 | return -ENOSYS; |
| 230 | } |
| 231 | |
| 232 | static inline int phy_pm_runtime_put(struct phy *phy) |
| 233 | { |
Grygorii Strashko | 2b97789 | 2014-04-19 08:51:44 +0530 | [diff] [blame] | 234 | if (!phy) |
| 235 | return 0; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 236 | return -ENOSYS; |
| 237 | } |
| 238 | |
| 239 | static inline int phy_pm_runtime_put_sync(struct phy *phy) |
| 240 | { |
Grygorii Strashko | 2b97789 | 2014-04-19 08:51:44 +0530 | [diff] [blame] | 241 | if (!phy) |
| 242 | return 0; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 243 | return -ENOSYS; |
| 244 | } |
| 245 | |
| 246 | static inline void phy_pm_runtime_allow(struct phy *phy) |
| 247 | { |
| 248 | return; |
| 249 | } |
| 250 | |
| 251 | static inline void phy_pm_runtime_forbid(struct phy *phy) |
| 252 | { |
| 253 | return; |
| 254 | } |
| 255 | |
| 256 | static inline int phy_init(struct phy *phy) |
| 257 | { |
Grygorii Strashko | 2b97789 | 2014-04-19 08:51:44 +0530 | [diff] [blame] | 258 | if (!phy) |
| 259 | return 0; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 260 | return -ENOSYS; |
| 261 | } |
| 262 | |
| 263 | static inline int phy_exit(struct phy *phy) |
| 264 | { |
Grygorii Strashko | 2b97789 | 2014-04-19 08:51:44 +0530 | [diff] [blame] | 265 | if (!phy) |
| 266 | return 0; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 267 | return -ENOSYS; |
| 268 | } |
| 269 | |
| 270 | static inline int phy_power_on(struct phy *phy) |
| 271 | { |
Grygorii Strashko | 2b97789 | 2014-04-19 08:51:44 +0530 | [diff] [blame] | 272 | if (!phy) |
| 273 | return 0; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 274 | return -ENOSYS; |
| 275 | } |
| 276 | |
| 277 | static inline int phy_power_off(struct phy *phy) |
| 278 | { |
Grygorii Strashko | 2b97789 | 2014-04-19 08:51:44 +0530 | [diff] [blame] | 279 | if (!phy) |
| 280 | return 0; |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 281 | return -ENOSYS; |
| 282 | } |
| 283 | |
Grygorii Strashko | 79a5a18 | 2018-11-19 19:24:20 -0600 | [diff] [blame^] | 284 | static inline int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, |
| 285 | int submode) |
David Lechner | 300eb01 | 2016-05-09 18:39:59 -0500 | [diff] [blame] | 286 | { |
| 287 | if (!phy) |
| 288 | return 0; |
| 289 | return -ENOSYS; |
| 290 | } |
| 291 | |
Grygorii Strashko | 79a5a18 | 2018-11-19 19:24:20 -0600 | [diff] [blame^] | 292 | #define phy_set_mode(phy, mode) \ |
| 293 | phy_set_mode_ext(phy, mode, 0) |
| 294 | |
Manu Gautam | 3b3cd24 | 2018-01-16 16:27:09 +0530 | [diff] [blame] | 295 | static inline enum phy_mode phy_get_mode(struct phy *phy) |
| 296 | { |
| 297 | return PHY_MODE_INVALID; |
| 298 | } |
| 299 | |
Randy Li | 98430c7 | 2016-10-25 22:15:34 +0800 | [diff] [blame] | 300 | static inline int phy_reset(struct phy *phy) |
| 301 | { |
| 302 | if (!phy) |
| 303 | return 0; |
| 304 | return -ENOSYS; |
| 305 | } |
| 306 | |
Andrzej Pietrasiewicz | 3691411 | 2017-10-09 14:00:50 +0200 | [diff] [blame] | 307 | static inline int phy_calibrate(struct phy *phy) |
| 308 | { |
| 309 | if (!phy) |
| 310 | return 0; |
| 311 | return -ENOSYS; |
| 312 | } |
| 313 | |
Matt Porter | 8feed34 | 2013-12-19 09:23:02 -0500 | [diff] [blame] | 314 | static inline int phy_get_bus_width(struct phy *phy) |
| 315 | { |
| 316 | return -ENOSYS; |
| 317 | } |
| 318 | |
| 319 | static inline void phy_set_bus_width(struct phy *phy, int bus_width) |
| 320 | { |
| 321 | return; |
| 322 | } |
| 323 | |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 324 | static inline struct phy *phy_get(struct device *dev, const char *string) |
| 325 | { |
| 326 | return ERR_PTR(-ENOSYS); |
| 327 | } |
| 328 | |
Andrew Lunn | 788a4d5 | 2014-02-04 18:33:12 +0100 | [diff] [blame] | 329 | static inline struct phy *phy_optional_get(struct device *dev, |
| 330 | const char *string) |
| 331 | { |
| 332 | return ERR_PTR(-ENOSYS); |
| 333 | } |
| 334 | |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 335 | static inline struct phy *devm_phy_get(struct device *dev, const char *string) |
| 336 | { |
| 337 | return ERR_PTR(-ENOSYS); |
| 338 | } |
| 339 | |
Andrew Lunn | 788a4d5 | 2014-02-04 18:33:12 +0100 | [diff] [blame] | 340 | static inline struct phy *devm_phy_optional_get(struct device *dev, |
| 341 | const char *string) |
| 342 | { |
Maxime Ripard | 11a6e41 | 2017-09-04 14:53:13 +0200 | [diff] [blame] | 343 | return NULL; |
Andrew Lunn | 788a4d5 | 2014-02-04 18:33:12 +0100 | [diff] [blame] | 344 | } |
| 345 | |
Kamil Debski | b5d682f | 2014-03-06 12:16:47 +0100 | [diff] [blame] | 346 | static inline struct phy *devm_of_phy_get(struct device *dev, |
| 347 | struct device_node *np, |
| 348 | const char *con_id) |
| 349 | { |
| 350 | return ERR_PTR(-ENOSYS); |
| 351 | } |
| 352 | |
Arun Ramamurthy | 6be109b | 2015-04-22 16:04:11 -0700 | [diff] [blame] | 353 | static inline struct phy *devm_of_phy_get_by_index(struct device *dev, |
| 354 | struct device_node *np, |
| 355 | int index) |
| 356 | { |
| 357 | return ERR_PTR(-ENOSYS); |
| 358 | } |
| 359 | |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 360 | static inline void phy_put(struct phy *phy) |
| 361 | { |
| 362 | } |
| 363 | |
| 364 | static inline void devm_phy_put(struct device *dev, struct phy *phy) |
| 365 | { |
| 366 | } |
| 367 | |
Kamil Debski | 0b3f3b2 | 2014-03-06 12:16:46 +0100 | [diff] [blame] | 368 | static inline struct phy *of_phy_get(struct device_node *np, const char *con_id) |
| 369 | { |
| 370 | return ERR_PTR(-ENOSYS); |
| 371 | } |
| 372 | |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 373 | static inline struct phy *of_phy_simple_xlate(struct device *dev, |
| 374 | struct of_phandle_args *args) |
| 375 | { |
| 376 | return ERR_PTR(-ENOSYS); |
| 377 | } |
| 378 | |
| 379 | static inline struct phy *phy_create(struct device *dev, |
Kishon Vijay Abraham I | f0ed817 | 2014-07-14 15:55:02 +0530 | [diff] [blame] | 380 | struct device_node *node, |
Heikki Krogerus | dbc9863 | 2014-11-19 17:28:21 +0200 | [diff] [blame] | 381 | const struct phy_ops *ops) |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 382 | { |
| 383 | return ERR_PTR(-ENOSYS); |
| 384 | } |
| 385 | |
| 386 | static inline struct phy *devm_phy_create(struct device *dev, |
Kishon Vijay Abraham I | f0ed817 | 2014-07-14 15:55:02 +0530 | [diff] [blame] | 387 | struct device_node *node, |
Heikki Krogerus | dbc9863 | 2014-11-19 17:28:21 +0200 | [diff] [blame] | 388 | const struct phy_ops *ops) |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 389 | { |
| 390 | return ERR_PTR(-ENOSYS); |
| 391 | } |
| 392 | |
| 393 | static inline void phy_destroy(struct phy *phy) |
| 394 | { |
| 395 | } |
| 396 | |
| 397 | static inline void devm_phy_destroy(struct device *dev, struct phy *phy) |
| 398 | { |
| 399 | } |
| 400 | |
| 401 | static inline struct phy_provider *__of_phy_provider_register( |
Thierry Reding | 1140f7c | 2016-04-05 17:17:34 +0200 | [diff] [blame] | 402 | struct device *dev, struct device_node *children, struct module *owner, |
| 403 | struct phy * (*of_xlate)(struct device *dev, |
| 404 | struct of_phandle_args *args)) |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 405 | { |
| 406 | return ERR_PTR(-ENOSYS); |
| 407 | } |
| 408 | |
| 409 | static inline struct phy_provider *__devm_of_phy_provider_register(struct device |
Thierry Reding | 1140f7c | 2016-04-05 17:17:34 +0200 | [diff] [blame] | 410 | *dev, struct device_node *children, struct module *owner, |
| 411 | struct phy * (*of_xlate)(struct device *dev, |
| 412 | struct of_phandle_args *args)) |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 413 | { |
| 414 | return ERR_PTR(-ENOSYS); |
| 415 | } |
| 416 | |
| 417 | static inline void of_phy_provider_unregister(struct phy_provider *phy_provider) |
| 418 | { |
| 419 | } |
| 420 | |
| 421 | static inline void devm_of_phy_provider_unregister(struct device *dev, |
| 422 | struct phy_provider *phy_provider) |
| 423 | { |
| 424 | } |
Heikki Krogerus | b7bc15b | 2014-11-19 17:28:18 +0200 | [diff] [blame] | 425 | static inline int |
| 426 | phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id) |
| 427 | { |
| 428 | return 0; |
| 429 | } |
| 430 | static inline void phy_remove_lookup(struct phy *phy, const char *con_id, |
| 431 | const char *dev_id) { } |
Kishon Vijay Abraham I | ff76496 | 2013-09-27 11:53:25 +0530 | [diff] [blame] | 432 | #endif |
| 433 | |
| 434 | #endif /* __DRIVERS_PHY_H */ |