hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/phy/phy.h
....@@ -1,14 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * phy.h -- generic phy header file
34 *
45 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
56 *
67 * 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.
128 */
139
1410 #ifndef __DRIVERS_PHY_H
....@@ -38,19 +34,13 @@
3834 PHY_MODE_USB_DEVICE_HS,
3935 PHY_MODE_USB_DEVICE_SS,
4036 PHY_MODE_USB_OTG,
41
- PHY_MODE_SGMII,
42
- PHY_MODE_2500SGMII,
43
- PHY_MODE_10GKR,
4437 PHY_MODE_UFS_HS_A,
4538 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,
5444 PHY_MODE_DP
5545 };
5646
....@@ -76,6 +66,7 @@
7666 * @set_mode: set the mode of the phy
7767 * @reset: resetting the phy
7868 * @calibrate: calibrate the phy
69
+ * @release: ops to be performed while the consumer relinquishes the PHY
7970 * @owner: the module owner containing the ops
8071 */
8172 struct phy_ops {
....@@ -83,7 +74,7 @@
8374 int (*exit)(struct phy *phy);
8475 int (*power_on)(struct phy *phy);
8576 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);
8778
8879 /**
8980 * @configure:
....@@ -117,15 +108,19 @@
117108 union phy_configure_opts *opts);
118109 int (*reset)(struct phy *phy);
119110 int (*calibrate)(struct phy *phy);
111
+ void (*release)(struct phy *phy);
120112 struct module *owner;
121113 };
122114
123115 /**
124116 * struct phy_attrs - represents phy attributes
125117 * @bus_width: Data path width implemented by PHY
118
+ * @max_link_rate: Maximum link rate supported by PHY (in Mbps)
119
+ * @mode: PHY mode
126120 */
127121 struct phy_attrs {
128122 u32 bus_width;
123
+ u32 max_link_rate;
129124 enum phy_mode mode;
130125 };
131126
....@@ -134,7 +129,6 @@
134129 * @dev: phy device
135130 * @id: id of the phy device
136131 * @ops: function pointers for performing phy operations
137
- * @init_data: list of PHY consumers (non-dt only)
138132 * @mutex: mutex to protect phy_ops
139133 * @init_count: used to protect when the PHY is used by multiple consumers
140134 * @power_count: used to protect when the PHY is used by multiple consumers
....@@ -218,7 +212,9 @@
218212 int phy_exit(struct phy *phy);
219213 int phy_power_on(struct phy *phy);
220214 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)
222218 int phy_configure(struct phy *phy, union phy_configure_opts *opts);
223219 int phy_validate(struct phy *phy, enum phy_mode mode, int submode,
224220 union phy_configure_opts *opts);
....@@ -245,7 +241,8 @@
245241 const char *con_id);
246242 struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np,
247243 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);
249246 void devm_phy_put(struct device *dev, struct phy *phy);
250247 struct phy *of_phy_get(struct device_node *np, const char *con_id);
251248 struct phy *of_phy_simple_xlate(struct device *dev,
....@@ -336,12 +333,16 @@
336333 return -ENOSYS;
337334 }
338335
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)
340338 {
341339 if (!phy)
342340 return 0;
343341 return -ENOSYS;
344342 }
343
+
344
+#define phy_set_mode(phy, mode) \
345
+ phy_set_mode_ext(phy, mode, 0)
345346
346347 static inline enum phy_mode phy_get_mode(struct phy *phy)
347348 {
....@@ -426,7 +427,11 @@
426427 return ERR_PTR(-ENOSYS);
427428 }
428429
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)
430435 {
431436 }
432437