Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ |
| 4 | * Written by Jean-Jacques Hiblot <jjhiblot@ti.com> |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __GENERIC_PHY_H |
| 8 | #define __GENERIC_PHY_H |
| 9 | |
Neil Armstrong | c2b9aa9 | 2020-03-30 11:27:23 +0200 | [diff] [blame] | 10 | #include <dm/ofnode.h> |
| 11 | |
Marek Vasut | a265e5e | 2018-08-16 14:37:03 +0200 | [diff] [blame] | 12 | struct ofnode_phandle_args; |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 13 | |
| 14 | /** |
| 15 | * struct phy - A handle to (allowing control of) a single phy port. |
| 16 | * |
| 17 | * Clients provide storage for phy handles. The content of the structure is |
| 18 | * managed solely by the PHY API and PHY drivers. A phy struct is |
| 19 | * initialized by "get"ing the phy struct. The phy struct is passed to all |
| 20 | * other phy APIs to identify which PHY port to operate upon. |
| 21 | * |
| 22 | * @dev: The device which implements the PHY port. |
| 23 | * @id: The PHY ID within the provider. |
| 24 | * |
| 25 | */ |
| 26 | struct phy { |
| 27 | struct udevice *dev; |
| 28 | unsigned long id; |
| 29 | }; |
| 30 | |
| 31 | /* |
| 32 | * struct udevice_ops - set of function pointers for phy operations |
| 33 | * @init: operation to be performed for initializing phy (optional) |
| 34 | * @exit: operation to be performed while exiting (optional) |
| 35 | * @reset: reset the phy (optional). |
| 36 | * @power_on: powering on the phy (optional) |
| 37 | * @power_off: powering off the phy (optional) |
| 38 | */ |
| 39 | struct phy_ops { |
| 40 | /** |
| 41 | * of_xlate - Translate a client's device-tree (OF) phy specifier. |
| 42 | * |
| 43 | * The PHY core calls this function as the first step in implementing |
| 44 | * a client's generic_phy_get_by_*() call. |
| 45 | * |
| 46 | * If this function pointer is set to NULL, the PHY core will use a |
| 47 | * default implementation, which assumes #phy-cells = <0> or |
| 48 | * #phy-cells = <1>, and in the later case that the DT cell |
| 49 | * contains a simple integer PHY port ID. |
| 50 | * |
| 51 | * @phy: The phy struct to hold the translation result. |
| 52 | * @args: The phy specifier values from device tree. |
| 53 | * @return 0 if OK, or a negative error code. |
| 54 | */ |
Simon Glass | 23558bb | 2017-05-18 20:09:47 -0600 | [diff] [blame] | 55 | int (*of_xlate)(struct phy *phy, struct ofnode_phandle_args *args); |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * init - initialize the hardware. |
| 59 | * |
| 60 | * Hardware intialization should not be done in during probe() but |
| 61 | * should be implemented in this init() function. It could be starting |
| 62 | * PLL, taking a controller out of reset, routing, etc. This function |
| 63 | * is typically called only once per PHY port. |
| 64 | * If power_on() is not implemented, it must power up the phy. |
| 65 | * |
| 66 | * @phy: the PHY port to initialize |
| 67 | * @return 0 if OK, or a negative error code. |
| 68 | */ |
| 69 | int (*init)(struct phy *phy); |
| 70 | |
| 71 | /** |
| 72 | * exit - de-initialize the PHY device |
| 73 | * |
| 74 | * Hardware de-intialization should be done here. Every step done in |
| 75 | * init() should be undone here. |
| 76 | * This could be used to suspend the phy to reduce power consumption or |
| 77 | * to put the phy in a known condition before booting the OS (though it |
| 78 | * is NOT called automatically before booting the OS) |
| 79 | * If power_off() is not implemented, it must power down the phy. |
| 80 | * |
| 81 | * @phy: PHY port to be de-initialized |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 82 | * Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 83 | */ |
| 84 | int (*exit)(struct phy *phy); |
| 85 | |
| 86 | /** |
| 87 | * reset - resets a PHY device without shutting down |
| 88 | * |
| 89 | * @phy: PHY port to be reset |
| 90 | * |
| 91 | * During runtime, the PHY may need to be reset in order to |
| 92 | * re-establish connection etc without being shut down or exit. |
| 93 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 94 | * Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 95 | */ |
| 96 | int (*reset)(struct phy *phy); |
| 97 | |
| 98 | /** |
| 99 | * power_on - power on a PHY device |
| 100 | * |
| 101 | * @phy: PHY port to be powered on |
| 102 | * |
| 103 | * During runtime, the PHY may need to be powered on or off several |
| 104 | * times. This function is used to power on the PHY. It relies on the |
| 105 | * setup done in init(). If init() is not implemented, it must take care |
| 106 | * of setting up the context (PLLs, ...) |
| 107 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 108 | * Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 109 | */ |
| 110 | int (*power_on)(struct phy *phy); |
| 111 | |
| 112 | /** |
| 113 | * power_off - power off a PHY device |
| 114 | * |
| 115 | * @phy: PHY port to be powered off |
| 116 | * |
| 117 | * During runtime, the PHY may need to be powered on or off several |
| 118 | * times. This function is used to power off the PHY. Except if |
| 119 | * init()/deinit() are not implemented, it must not de-initialize |
| 120 | * everything. |
| 121 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 122 | * Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 123 | */ |
| 124 | int (*power_off)(struct phy *phy); |
Neil Armstrong | f8da8a8 | 2020-12-29 14:58:59 +0100 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * configure - configure a PHY device |
| 128 | * |
| 129 | * @phy: PHY port to be configured |
| 130 | * @params: PHY Parameters, underlying data is specific to the PHY function |
| 131 | * |
| 132 | * During runtime, the PHY may need to be configured for it's main function. |
| 133 | * This function configures the PHY for it's main function following |
| 134 | * power_on/off() after beeing initialized. |
| 135 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 136 | * Return: 0 if OK, or a negative error code |
Neil Armstrong | f8da8a8 | 2020-12-29 14:58:59 +0100 | [diff] [blame] | 137 | */ |
| 138 | int (*configure)(struct phy *phy, void *params); |
he.he | f888b8c | 2023-02-14 06:01:50 +0000 | [diff] [blame] | 139 | #ifdef CONFIG_AMLOGIC_USB |
| 140 | int (*getinfo)(struct phy *phy); |
| 141 | #endif |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 142 | }; |
| 143 | |
Chunfeng Yun | b13307b | 2020-05-02 11:35:11 +0200 | [diff] [blame] | 144 | /** |
| 145 | * struct phy_bulk - A handle to (allowing control of) a bulk of phys. |
| 146 | * |
| 147 | * Consumers provide storage for the phy bulk. The content of the structure is |
| 148 | * managed solely by the phy API. A phy bulk struct is initialized |
| 149 | * by "get"ing the phy bulk struct. |
| 150 | * The phy bulk struct is passed to all other bulk phy APIs to apply |
| 151 | * the API to all the phy in the bulk struct. |
| 152 | * |
| 153 | * @phys: An array of phy handles. |
| 154 | * @count: The number of phy handles in the phys array. |
| 155 | */ |
| 156 | struct phy_bulk { |
| 157 | struct phy *phys; |
| 158 | unsigned int count; |
| 159 | }; |
| 160 | |
Michal Simek | e81782a | 2022-03-09 10:05:44 +0100 | [diff] [blame] | 161 | #if CONFIG_IS_ENABLED(PHY) |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 162 | |
| 163 | /** |
| 164 | * generic_phy_init() - initialize the PHY port |
| 165 | * |
| 166 | * @phy: the PHY port to initialize |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 167 | * Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 168 | */ |
| 169 | int generic_phy_init(struct phy *phy); |
| 170 | |
| 171 | /** |
| 172 | * generic_phy_init() - de-initialize the PHY device |
| 173 | * |
| 174 | * @phy: PHY port to be de-initialized |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 175 | * Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 176 | */ |
| 177 | int generic_phy_exit(struct phy *phy); |
| 178 | |
| 179 | /** |
| 180 | * generic_phy_reset() - resets a PHY device without shutting down |
| 181 | * |
| 182 | * @phy: PHY port to be reset |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 183 | *Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 184 | */ |
| 185 | int generic_phy_reset(struct phy *phy); |
| 186 | |
| 187 | /** |
| 188 | * generic_phy_power_on() - power on a PHY device |
| 189 | * |
| 190 | * @phy: PHY port to be powered on |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 191 | * Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 192 | */ |
| 193 | int generic_phy_power_on(struct phy *phy); |
| 194 | |
| 195 | /** |
| 196 | * generic_phy_power_off() - power off a PHY device |
| 197 | * |
| 198 | * @phy: PHY port to be powered off |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 199 | * Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 200 | */ |
| 201 | int generic_phy_power_off(struct phy *phy); |
| 202 | |
Neil Armstrong | f8da8a8 | 2020-12-29 14:58:59 +0100 | [diff] [blame] | 203 | /** |
| 204 | * generic_phy_configure() - configure a PHY device |
| 205 | * |
| 206 | * @phy: PHY port to be configured |
Wolfgang Denk | 0cf207e | 2021-09-27 17:42:39 +0200 | [diff] [blame] | 207 | * @params: PHY Parameters, underlying data is specific to the PHY function |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 208 | * Return: 0 if OK, or a negative error code |
Neil Armstrong | f8da8a8 | 2020-12-29 14:58:59 +0100 | [diff] [blame] | 209 | */ |
| 210 | int generic_phy_configure(struct phy *phy, void *params); |
| 211 | |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 212 | |
| 213 | /** |
| 214 | * generic_phy_get_by_index() - Get a PHY device by integer index. |
| 215 | * |
| 216 | * @user: the client device |
| 217 | * @index: The index in the list of available PHYs |
| 218 | * @phy: A pointer to the PHY port |
| 219 | * |
| 220 | * This looks up a PHY device for a client device based on its position in the |
| 221 | * list of the possible PHYs. |
| 222 | * |
| 223 | * example: |
| 224 | * usb1: usb_otg_ss@xxx { |
| 225 | * compatible = "xxx"; |
| 226 | * reg = <xxx>; |
| 227 | * . |
| 228 | * . |
| 229 | * phys = <&usb2_phy>, <&usb3_phy>; |
| 230 | * . |
| 231 | * . |
| 232 | * }; |
| 233 | * the USB2 phy can be accessed by passing index '0' and the USB3 phy can |
| 234 | * be accessed by passing index '1' |
| 235 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 236 | * Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 237 | */ |
| 238 | int generic_phy_get_by_index(struct udevice *user, int index, |
| 239 | struct phy *phy); |
| 240 | |
| 241 | /** |
Jagan Teki | 5a2b677 | 2020-05-01 23:44:18 +0530 | [diff] [blame] | 242 | * generic_phy_get_by_index_nodev() - Get a PHY device by integer index |
| 243 | * without a device |
Neil Armstrong | c2b9aa9 | 2020-03-30 11:27:23 +0200 | [diff] [blame] | 244 | * |
Jagan Teki | cd3e01b | 2020-05-01 23:44:17 +0530 | [diff] [blame] | 245 | * @node: The client ofnode. |
Neil Armstrong | c2b9aa9 | 2020-03-30 11:27:23 +0200 | [diff] [blame] | 246 | * @index: The index in the list of available PHYs |
| 247 | * @phy: A pointer to the PHY port |
| 248 | * |
Jagan Teki | 5a2b677 | 2020-05-01 23:44:18 +0530 | [diff] [blame] | 249 | * This is a version of generic_phy_get_by_index() that does not use a device. |
| 250 | * |
Neil Armstrong | c2b9aa9 | 2020-03-30 11:27:23 +0200 | [diff] [blame] | 251 | * This looks up a PHY device for a client device based on its ofnode and on |
| 252 | * its position in the list of the possible PHYs. |
| 253 | * |
| 254 | * example: |
| 255 | * usb1: usb_otg_ss@xxx { |
| 256 | * compatible = "xxx"; |
| 257 | * reg = <xxx>; |
| 258 | * . |
| 259 | * . |
| 260 | * phys = <&usb2_phy>, <&usb3_phy>; |
| 261 | * . |
| 262 | * . |
| 263 | * }; |
| 264 | * the USB2 phy can be accessed by passing index '0' and the USB3 phy can |
| 265 | * be accessed by passing index '1' |
| 266 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 267 | * Return: 0 if OK, or a negative error code |
Neil Armstrong | c2b9aa9 | 2020-03-30 11:27:23 +0200 | [diff] [blame] | 268 | */ |
Jagan Teki | 5a2b677 | 2020-05-01 23:44:18 +0530 | [diff] [blame] | 269 | int generic_phy_get_by_index_nodev(ofnode node, int index, struct phy *phy); |
Neil Armstrong | c2b9aa9 | 2020-03-30 11:27:23 +0200 | [diff] [blame] | 270 | |
| 271 | /** |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 272 | * generic_phy_get_by_name() - Get a PHY device by its name. |
| 273 | * |
| 274 | * @user: the client device |
| 275 | * @phy_name: The name of the PHY in the list of possible PHYs |
| 276 | * @phy: A pointer to the PHY port |
| 277 | * |
| 278 | * This looks up a PHY device for a client device in the |
| 279 | * list of the possible PHYs based on its name. |
| 280 | * |
| 281 | * example: |
| 282 | * usb1: usb_otg_ss@xxx { |
| 283 | * compatible = "xxx"; |
| 284 | * reg = <xxx>; |
| 285 | * . |
| 286 | * . |
| 287 | * phys = <&usb2_phy>, <&usb3_phy>; |
| 288 | * phy-names = "usb2phy", "usb3phy"; |
| 289 | * . |
| 290 | * . |
| 291 | * }; |
| 292 | * the USB3 phy can be accessed using "usb3phy", and USB2 by using "usb2phy" |
| 293 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 294 | * Return: 0 if OK, or a negative error code |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 295 | */ |
| 296 | int generic_phy_get_by_name(struct udevice *user, const char *phy_name, |
| 297 | struct phy *phy); |
| 298 | |
Chunfeng Yun | b13307b | 2020-05-02 11:35:11 +0200 | [diff] [blame] | 299 | /** |
| 300 | * generic_phy_get_bulk - Get all phys of a device. |
| 301 | * |
| 302 | * This looks up and gets all phys of the consumer device; each device is |
| 303 | * assumed to have n phys associated with it somehow, and this function finds |
| 304 | * and gets all of them in a separate structure. |
| 305 | * |
| 306 | * @dev: The consumer device. |
| 307 | * @bulk A pointer to a phy bulk struct to initialize. |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 308 | * Return: 0 if OK, or a negative error code. |
Chunfeng Yun | b13307b | 2020-05-02 11:35:11 +0200 | [diff] [blame] | 309 | */ |
| 310 | int generic_phy_get_bulk(struct udevice *dev, struct phy_bulk *bulk); |
| 311 | |
| 312 | /** |
| 313 | * generic_phy_init_bulk() - Initialize all phys in a phy bulk struct. |
| 314 | * |
| 315 | * @bulk: A phy bulk struct that was previously successfully requested |
| 316 | * by generic_phy_get_bulk(). |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 317 | * Return: 0 if OK, or negative error code. |
Chunfeng Yun | b13307b | 2020-05-02 11:35:11 +0200 | [diff] [blame] | 318 | */ |
| 319 | int generic_phy_init_bulk(struct phy_bulk *bulk); |
| 320 | |
| 321 | /** |
| 322 | * generic_phy_exit_bulk() - de-initialize all phys in a phy bulk struct. |
| 323 | * |
| 324 | * @bulk: A phy bulk struct that was previously successfully requested |
| 325 | * by generic_phy_get_bulk(). |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 326 | * Return: 0 if OK, or negative error code. |
Chunfeng Yun | b13307b | 2020-05-02 11:35:11 +0200 | [diff] [blame] | 327 | */ |
| 328 | int generic_phy_exit_bulk(struct phy_bulk *bulk); |
| 329 | |
| 330 | /** |
| 331 | * generic_phy_power_on_bulk() - Power on all phys in a phy bulk struct. |
| 332 | * |
| 333 | * @bulk: A phy bulk struct that was previously successfully requested |
| 334 | * by generic_phy_get_bulk(). |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 335 | * Return: 0 if OK, or negative error code. |
Chunfeng Yun | b13307b | 2020-05-02 11:35:11 +0200 | [diff] [blame] | 336 | */ |
| 337 | int generic_phy_power_on_bulk(struct phy_bulk *bulk); |
| 338 | |
| 339 | /** |
| 340 | * generic_phy_power_off_bulk() - Power off all phys in a phy bulk struct. |
| 341 | * |
| 342 | * @bulk: A phy bulk struct that was previously successfully requested |
| 343 | * by generic_phy_get_bulk(). |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 344 | * Return: 0 if OK, or negative error code. |
Chunfeng Yun | b13307b | 2020-05-02 11:35:11 +0200 | [diff] [blame] | 345 | */ |
| 346 | int generic_phy_power_off_bulk(struct phy_bulk *bulk); |
| 347 | |
Patrice Chotard | 84e5614 | 2022-09-06 08:15:26 +0200 | [diff] [blame] | 348 | /** |
| 349 | * generic_setup_phy() - Get, initialize and power on phy. |
| 350 | * |
| 351 | * @dev: The consumer device. |
| 352 | * @phy: A pointer to the PHY port |
| 353 | * @index: The index in the list of available PHYs |
| 354 | * |
| 355 | * Return: 0 if OK, or negative error code. |
| 356 | */ |
| 357 | int generic_setup_phy(struct udevice *dev, struct phy *phy, int index); |
| 358 | |
| 359 | /** |
| 360 | * generic_shutdown_phy() - Power off and de-initialize phy. |
| 361 | * |
| 362 | * @phy: A pointer to the PHY port. |
| 363 | * |
| 364 | * Return: 0 if OK, or negative error code. |
| 365 | */ |
| 366 | int generic_shutdown_phy(struct phy *phy); |
he.he | f888b8c | 2023-02-14 06:01:50 +0000 | [diff] [blame] | 367 | #ifdef CONFIG_AMLOGIC_USB |
| 368 | int generic_phy_getinfo(struct phy *phy); |
| 369 | #endif |
Patrice Chotard | d9fb7be | 2017-07-24 17:07:02 +0200 | [diff] [blame] | 370 | #else /* CONFIG_PHY */ |
| 371 | |
| 372 | static inline int generic_phy_init(struct phy *phy) |
| 373 | { |
| 374 | return 0; |
| 375 | } |
| 376 | |
| 377 | static inline int generic_phy_exit(struct phy *phy) |
| 378 | { |
| 379 | return 0; |
| 380 | } |
| 381 | |
| 382 | static inline int generic_phy_reset(struct phy *phy) |
| 383 | { |
| 384 | return 0; |
| 385 | } |
| 386 | |
| 387 | static inline int generic_phy_power_on(struct phy *phy) |
| 388 | { |
| 389 | return 0; |
| 390 | } |
| 391 | |
| 392 | static inline int generic_phy_power_off(struct phy *phy) |
| 393 | { |
| 394 | return 0; |
| 395 | } |
| 396 | |
| 397 | static inline int generic_phy_get_by_index(struct udevice *user, int index, |
| 398 | struct phy *phy) |
| 399 | { |
| 400 | return 0; |
| 401 | } |
| 402 | |
| 403 | static inline int generic_phy_get_by_name(struct udevice *user, const char *phy_name, |
| 404 | struct phy *phy) |
| 405 | { |
| 406 | return 0; |
| 407 | } |
| 408 | |
Chunfeng Yun | b13307b | 2020-05-02 11:35:11 +0200 | [diff] [blame] | 409 | static inline int |
| 410 | generic_phy_get_bulk(struct udevice *dev, struct phy_bulk *bulk) |
| 411 | { |
| 412 | return 0; |
| 413 | } |
| 414 | |
| 415 | static inline int generic_phy_init_bulk(struct phy_bulk *bulk) |
| 416 | { |
| 417 | return 0; |
| 418 | } |
| 419 | |
| 420 | static inline int generic_phy_exit_bulk(struct phy_bulk *bulk) |
| 421 | { |
| 422 | return 0; |
| 423 | } |
| 424 | |
| 425 | static inline int generic_phy_power_on_bulk(struct phy_bulk *bulk) |
| 426 | { |
| 427 | return 0; |
| 428 | } |
| 429 | |
| 430 | static inline int generic_phy_power_off_bulk(struct phy_bulk *bulk) |
| 431 | { |
| 432 | return 0; |
| 433 | } |
| 434 | |
Patrice Chotard | 84e5614 | 2022-09-06 08:15:26 +0200 | [diff] [blame] | 435 | static inline int generic_setup_phy(struct udevice *dev, struct phy *phy, int index) |
| 436 | { |
| 437 | return 0; |
| 438 | } |
| 439 | |
| 440 | static inline int generic_shutdown_phy(struct phy *phy) |
| 441 | { |
| 442 | return 0; |
| 443 | } |
| 444 | |
Patrice Chotard | d9fb7be | 2017-07-24 17:07:02 +0200 | [diff] [blame] | 445 | #endif /* CONFIG_PHY */ |
| 446 | |
Patrice Chotard | b94888b | 2017-07-18 11:38:43 +0200 | [diff] [blame] | 447 | /** |
| 448 | * generic_phy_valid() - check if PHY port is valid |
| 449 | * |
| 450 | * @phy: the PHY port to check |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 451 | * Return: TRUE if valid, or FALSE |
Patrice Chotard | b94888b | 2017-07-18 11:38:43 +0200 | [diff] [blame] | 452 | */ |
| 453 | static inline bool generic_phy_valid(struct phy *phy) |
| 454 | { |
Jean-Jacques Hiblot | 4e18429 | 2019-10-01 14:03:26 +0200 | [diff] [blame] | 455 | return phy && phy->dev; |
Patrice Chotard | b94888b | 2017-07-18 11:38:43 +0200 | [diff] [blame] | 456 | } |
| 457 | |
Jean-Jacques Hiblot | 72e5016 | 2017-04-24 11:51:27 +0200 | [diff] [blame] | 458 | #endif /*__GENERIC_PHY_H */ |