.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * phy.h -- generic phy header file |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com |
---|
5 | 6 | * |
---|
6 | 7 | * 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 | 8 | */ |
---|
13 | 9 | |
---|
14 | 10 | #ifndef __DRIVERS_PHY_H |
---|
.. | .. |
---|
38 | 34 | PHY_MODE_USB_DEVICE_HS, |
---|
39 | 35 | PHY_MODE_USB_DEVICE_SS, |
---|
40 | 36 | PHY_MODE_USB_OTG, |
---|
41 | | - PHY_MODE_SGMII, |
---|
42 | | - PHY_MODE_2500SGMII, |
---|
43 | | - PHY_MODE_10GKR, |
---|
44 | 37 | PHY_MODE_UFS_HS_A, |
---|
45 | 38 | PHY_MODE_UFS_HS_B, |
---|
46 | | - PHY_MODE_VIDEO_MIPI, |
---|
47 | | - PHY_MODE_VIDEO_LVDS, |
---|
48 | | - PHY_MODE_VIDEO_TTL, |
---|
49 | | - PHY_MODE_PCIE_RC, |
---|
50 | | - PHY_MODE_PCIE_EP, |
---|
51 | | - PHY_MODE_PCIE_BIFURCATION, |
---|
52 | | - PHY_MODE_GVI, |
---|
53 | | - PHY_MODE_HDMI, |
---|
| 39 | + PHY_MODE_PCIE, |
---|
| 40 | + PHY_MODE_ETHERNET, |
---|
| 41 | + PHY_MODE_MIPI_DPHY, |
---|
| 42 | + PHY_MODE_SATA, |
---|
| 43 | + PHY_MODE_LVDS, |
---|
54 | 44 | PHY_MODE_DP |
---|
55 | 45 | }; |
---|
56 | 46 | |
---|
.. | .. |
---|
76 | 66 | * @set_mode: set the mode of the phy |
---|
77 | 67 | * @reset: resetting the phy |
---|
78 | 68 | * @calibrate: calibrate the phy |
---|
| 69 | + * @release: ops to be performed while the consumer relinquishes the PHY |
---|
79 | 70 | * @owner: the module owner containing the ops |
---|
80 | 71 | */ |
---|
81 | 72 | struct phy_ops { |
---|
.. | .. |
---|
83 | 74 | int (*exit)(struct phy *phy); |
---|
84 | 75 | int (*power_on)(struct phy *phy); |
---|
85 | 76 | int (*power_off)(struct phy *phy); |
---|
86 | | - int (*set_mode)(struct phy *phy, enum phy_mode mode); |
---|
| 77 | + int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode); |
---|
87 | 78 | |
---|
88 | 79 | /** |
---|
89 | 80 | * @configure: |
---|
.. | .. |
---|
117 | 108 | union phy_configure_opts *opts); |
---|
118 | 109 | int (*reset)(struct phy *phy); |
---|
119 | 110 | int (*calibrate)(struct phy *phy); |
---|
| 111 | + void (*release)(struct phy *phy); |
---|
120 | 112 | struct module *owner; |
---|
121 | 113 | }; |
---|
122 | 114 | |
---|
123 | 115 | /** |
---|
124 | 116 | * struct phy_attrs - represents phy attributes |
---|
125 | 117 | * @bus_width: Data path width implemented by PHY |
---|
| 118 | + * @max_link_rate: Maximum link rate supported by PHY (in Mbps) |
---|
| 119 | + * @mode: PHY mode |
---|
126 | 120 | */ |
---|
127 | 121 | struct phy_attrs { |
---|
128 | 122 | u32 bus_width; |
---|
| 123 | + u32 max_link_rate; |
---|
129 | 124 | enum phy_mode mode; |
---|
130 | 125 | }; |
---|
131 | 126 | |
---|
.. | .. |
---|
134 | 129 | * @dev: phy device |
---|
135 | 130 | * @id: id of the phy device |
---|
136 | 131 | * @ops: function pointers for performing phy operations |
---|
137 | | - * @init_data: list of PHY consumers (non-dt only) |
---|
138 | 132 | * @mutex: mutex to protect phy_ops |
---|
139 | 133 | * @init_count: used to protect when the PHY is used by multiple consumers |
---|
140 | 134 | * @power_count: used to protect when the PHY is used by multiple consumers |
---|
.. | .. |
---|
218 | 212 | int phy_exit(struct phy *phy); |
---|
219 | 213 | int phy_power_on(struct phy *phy); |
---|
220 | 214 | int phy_power_off(struct phy *phy); |
---|
221 | | -int phy_set_mode(struct phy *phy, enum phy_mode mode); |
---|
| 215 | +int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode); |
---|
| 216 | +#define phy_set_mode(phy, mode) \ |
---|
| 217 | + phy_set_mode_ext(phy, mode, 0) |
---|
222 | 218 | int phy_configure(struct phy *phy, union phy_configure_opts *opts); |
---|
223 | 219 | int phy_validate(struct phy *phy, enum phy_mode mode, int submode, |
---|
224 | 220 | union phy_configure_opts *opts); |
---|
.. | .. |
---|
245 | 241 | const char *con_id); |
---|
246 | 242 | struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, |
---|
247 | 243 | int index); |
---|
248 | | -void phy_put(struct phy *phy); |
---|
| 244 | +void of_phy_put(struct phy *phy); |
---|
| 245 | +void phy_put(struct device *dev, struct phy *phy); |
---|
249 | 246 | void devm_phy_put(struct device *dev, struct phy *phy); |
---|
250 | 247 | struct phy *of_phy_get(struct device_node *np, const char *con_id); |
---|
251 | 248 | struct phy *of_phy_simple_xlate(struct device *dev, |
---|
.. | .. |
---|
336 | 333 | return -ENOSYS; |
---|
337 | 334 | } |
---|
338 | 335 | |
---|
339 | | -static inline int phy_set_mode(struct phy *phy, enum phy_mode mode) |
---|
| 336 | +static inline int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, |
---|
| 337 | + int submode) |
---|
340 | 338 | { |
---|
341 | 339 | if (!phy) |
---|
342 | 340 | return 0; |
---|
343 | 341 | return -ENOSYS; |
---|
344 | 342 | } |
---|
| 343 | + |
---|
| 344 | +#define phy_set_mode(phy, mode) \ |
---|
| 345 | + phy_set_mode_ext(phy, mode, 0) |
---|
345 | 346 | |
---|
346 | 347 | static inline enum phy_mode phy_get_mode(struct phy *phy) |
---|
347 | 348 | { |
---|
.. | .. |
---|
426 | 427 | return ERR_PTR(-ENOSYS); |
---|
427 | 428 | } |
---|
428 | 429 | |
---|
429 | | -static inline void phy_put(struct phy *phy) |
---|
| 430 | +static inline void of_phy_put(struct phy *phy) |
---|
| 431 | +{ |
---|
| 432 | +} |
---|
| 433 | + |
---|
| 434 | +static inline void phy_put(struct device *dev, struct phy *phy) |
---|
430 | 435 | { |
---|
431 | 436 | } |
---|
432 | 437 | |
---|