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