1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * phy.h -- generic phy header file
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
6*4882a593Smuzhiyun *
7*4882a593Smuzhiyun * Author: Kishon Vijay Abraham I <kishon@ti.com>
8*4882a593Smuzhiyun */
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun #ifndef __DRIVERS_PHY_H
11*4882a593Smuzhiyun #define __DRIVERS_PHY_H
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun #include <linux/err.h>
14*4882a593Smuzhiyun #include <linux/of.h>
15*4882a593Smuzhiyun #include <linux/device.h>
16*4882a593Smuzhiyun #include <linux/pm_runtime.h>
17*4882a593Smuzhiyun #include <linux/regulator/consumer.h>
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun #include <linux/phy/phy-dp.h>
20*4882a593Smuzhiyun #include <linux/phy/phy-mipi-dphy.h>
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun struct phy;
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun enum phy_mode {
25*4882a593Smuzhiyun PHY_MODE_INVALID,
26*4882a593Smuzhiyun PHY_MODE_USB_HOST,
27*4882a593Smuzhiyun PHY_MODE_USB_HOST_LS,
28*4882a593Smuzhiyun PHY_MODE_USB_HOST_FS,
29*4882a593Smuzhiyun PHY_MODE_USB_HOST_HS,
30*4882a593Smuzhiyun PHY_MODE_USB_HOST_SS,
31*4882a593Smuzhiyun PHY_MODE_USB_DEVICE,
32*4882a593Smuzhiyun PHY_MODE_USB_DEVICE_LS,
33*4882a593Smuzhiyun PHY_MODE_USB_DEVICE_FS,
34*4882a593Smuzhiyun PHY_MODE_USB_DEVICE_HS,
35*4882a593Smuzhiyun PHY_MODE_USB_DEVICE_SS,
36*4882a593Smuzhiyun PHY_MODE_USB_OTG,
37*4882a593Smuzhiyun PHY_MODE_UFS_HS_A,
38*4882a593Smuzhiyun PHY_MODE_UFS_HS_B,
39*4882a593Smuzhiyun PHY_MODE_PCIE,
40*4882a593Smuzhiyun PHY_MODE_ETHERNET,
41*4882a593Smuzhiyun PHY_MODE_MIPI_DPHY,
42*4882a593Smuzhiyun PHY_MODE_SATA,
43*4882a593Smuzhiyun PHY_MODE_LVDS,
44*4882a593Smuzhiyun PHY_MODE_DP
45*4882a593Smuzhiyun };
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun /**
48*4882a593Smuzhiyun * union phy_configure_opts - Opaque generic phy configuration
49*4882a593Smuzhiyun *
50*4882a593Smuzhiyun * @mipi_dphy: Configuration set applicable for phys supporting
51*4882a593Smuzhiyun * the MIPI_DPHY phy mode.
52*4882a593Smuzhiyun * @dp: Configuration set applicable for phys supporting
53*4882a593Smuzhiyun * the DisplayPort protocol.
54*4882a593Smuzhiyun */
55*4882a593Smuzhiyun union phy_configure_opts {
56*4882a593Smuzhiyun struct phy_configure_opts_mipi_dphy mipi_dphy;
57*4882a593Smuzhiyun struct phy_configure_opts_dp dp;
58*4882a593Smuzhiyun };
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun /**
61*4882a593Smuzhiyun * struct phy_ops - set of function pointers for performing phy operations
62*4882a593Smuzhiyun * @init: operation to be performed for initializing phy
63*4882a593Smuzhiyun * @exit: operation to be performed while exiting
64*4882a593Smuzhiyun * @power_on: powering on the phy
65*4882a593Smuzhiyun * @power_off: powering off the phy
66*4882a593Smuzhiyun * @set_mode: set the mode of the phy
67*4882a593Smuzhiyun * @reset: resetting the phy
68*4882a593Smuzhiyun * @calibrate: calibrate the phy
69*4882a593Smuzhiyun * @release: ops to be performed while the consumer relinquishes the PHY
70*4882a593Smuzhiyun * @owner: the module owner containing the ops
71*4882a593Smuzhiyun */
72*4882a593Smuzhiyun struct phy_ops {
73*4882a593Smuzhiyun int (*init)(struct phy *phy);
74*4882a593Smuzhiyun int (*exit)(struct phy *phy);
75*4882a593Smuzhiyun int (*power_on)(struct phy *phy);
76*4882a593Smuzhiyun int (*power_off)(struct phy *phy);
77*4882a593Smuzhiyun int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode);
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun /**
80*4882a593Smuzhiyun * @configure:
81*4882a593Smuzhiyun *
82*4882a593Smuzhiyun * Optional.
83*4882a593Smuzhiyun *
84*4882a593Smuzhiyun * Used to change the PHY parameters. phy_init() must have
85*4882a593Smuzhiyun * been called on the phy.
86*4882a593Smuzhiyun *
87*4882a593Smuzhiyun * Returns: 0 if successful, an negative error code otherwise
88*4882a593Smuzhiyun */
89*4882a593Smuzhiyun int (*configure)(struct phy *phy, union phy_configure_opts *opts);
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun /**
92*4882a593Smuzhiyun * @validate:
93*4882a593Smuzhiyun *
94*4882a593Smuzhiyun * Optional.
95*4882a593Smuzhiyun *
96*4882a593Smuzhiyun * Used to check that the current set of parameters can be
97*4882a593Smuzhiyun * handled by the phy. Implementations are free to tune the
98*4882a593Smuzhiyun * parameters passed as arguments if needed by some
99*4882a593Smuzhiyun * implementation detail or constraints. It must not change
100*4882a593Smuzhiyun * any actual configuration of the PHY, so calling it as many
101*4882a593Smuzhiyun * times as deemed fit by the consumer must have no side
102*4882a593Smuzhiyun * effect.
103*4882a593Smuzhiyun *
104*4882a593Smuzhiyun * Returns: 0 if the configuration can be applied, an negative
105*4882a593Smuzhiyun * error code otherwise
106*4882a593Smuzhiyun */
107*4882a593Smuzhiyun int (*validate)(struct phy *phy, enum phy_mode mode, int submode,
108*4882a593Smuzhiyun union phy_configure_opts *opts);
109*4882a593Smuzhiyun int (*reset)(struct phy *phy);
110*4882a593Smuzhiyun int (*calibrate)(struct phy *phy);
111*4882a593Smuzhiyun void (*release)(struct phy *phy);
112*4882a593Smuzhiyun struct module *owner;
113*4882a593Smuzhiyun };
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun /**
116*4882a593Smuzhiyun * struct phy_attrs - represents phy attributes
117*4882a593Smuzhiyun * @bus_width: Data path width implemented by PHY
118*4882a593Smuzhiyun * @max_link_rate: Maximum link rate supported by PHY (in Mbps)
119*4882a593Smuzhiyun * @mode: PHY mode
120*4882a593Smuzhiyun */
121*4882a593Smuzhiyun struct phy_attrs {
122*4882a593Smuzhiyun u32 bus_width;
123*4882a593Smuzhiyun u32 max_link_rate;
124*4882a593Smuzhiyun enum phy_mode mode;
125*4882a593Smuzhiyun };
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun /**
128*4882a593Smuzhiyun * struct phy - represents the phy device
129*4882a593Smuzhiyun * @dev: phy device
130*4882a593Smuzhiyun * @id: id of the phy device
131*4882a593Smuzhiyun * @ops: function pointers for performing phy operations
132*4882a593Smuzhiyun * @mutex: mutex to protect phy_ops
133*4882a593Smuzhiyun * @init_count: used to protect when the PHY is used by multiple consumers
134*4882a593Smuzhiyun * @power_count: used to protect when the PHY is used by multiple consumers
135*4882a593Smuzhiyun * @attrs: used to specify PHY specific attributes
136*4882a593Smuzhiyun * @pwr: power regulator associated with the phy
137*4882a593Smuzhiyun */
138*4882a593Smuzhiyun struct phy {
139*4882a593Smuzhiyun struct device dev;
140*4882a593Smuzhiyun int id;
141*4882a593Smuzhiyun const struct phy_ops *ops;
142*4882a593Smuzhiyun struct mutex mutex;
143*4882a593Smuzhiyun int init_count;
144*4882a593Smuzhiyun int power_count;
145*4882a593Smuzhiyun struct phy_attrs attrs;
146*4882a593Smuzhiyun struct regulator *pwr;
147*4882a593Smuzhiyun };
148*4882a593Smuzhiyun
149*4882a593Smuzhiyun /**
150*4882a593Smuzhiyun * struct phy_provider - represents the phy provider
151*4882a593Smuzhiyun * @dev: phy provider device
152*4882a593Smuzhiyun * @children: can be used to override the default (dev->of_node) child node
153*4882a593Smuzhiyun * @owner: the module owner having of_xlate
154*4882a593Smuzhiyun * @list: to maintain a linked list of PHY providers
155*4882a593Smuzhiyun * @of_xlate: function pointer to obtain phy instance from phy pointer
156*4882a593Smuzhiyun */
157*4882a593Smuzhiyun struct phy_provider {
158*4882a593Smuzhiyun struct device *dev;
159*4882a593Smuzhiyun struct device_node *children;
160*4882a593Smuzhiyun struct module *owner;
161*4882a593Smuzhiyun struct list_head list;
162*4882a593Smuzhiyun struct phy * (*of_xlate)(struct device *dev,
163*4882a593Smuzhiyun struct of_phandle_args *args);
164*4882a593Smuzhiyun };
165*4882a593Smuzhiyun
166*4882a593Smuzhiyun /**
167*4882a593Smuzhiyun * struct phy_lookup - PHY association in list of phys managed by the phy driver
168*4882a593Smuzhiyun * @node: list node
169*4882a593Smuzhiyun * @dev_id: the device of the association
170*4882a593Smuzhiyun * @con_id: connection ID string on device
171*4882a593Smuzhiyun * @phy: the phy of the association
172*4882a593Smuzhiyun */
173*4882a593Smuzhiyun struct phy_lookup {
174*4882a593Smuzhiyun struct list_head node;
175*4882a593Smuzhiyun const char *dev_id;
176*4882a593Smuzhiyun const char *con_id;
177*4882a593Smuzhiyun struct phy *phy;
178*4882a593Smuzhiyun };
179*4882a593Smuzhiyun
180*4882a593Smuzhiyun #define to_phy(a) (container_of((a), struct phy, dev))
181*4882a593Smuzhiyun
182*4882a593Smuzhiyun #define of_phy_provider_register(dev, xlate) \
183*4882a593Smuzhiyun __of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate))
184*4882a593Smuzhiyun
185*4882a593Smuzhiyun #define devm_of_phy_provider_register(dev, xlate) \
186*4882a593Smuzhiyun __devm_of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate))
187*4882a593Smuzhiyun
188*4882a593Smuzhiyun #define of_phy_provider_register_full(dev, children, xlate) \
189*4882a593Smuzhiyun __of_phy_provider_register(dev, children, THIS_MODULE, xlate)
190*4882a593Smuzhiyun
191*4882a593Smuzhiyun #define devm_of_phy_provider_register_full(dev, children, xlate) \
192*4882a593Smuzhiyun __devm_of_phy_provider_register(dev, children, THIS_MODULE, xlate)
193*4882a593Smuzhiyun
phy_set_drvdata(struct phy * phy,void * data)194*4882a593Smuzhiyun static inline void phy_set_drvdata(struct phy *phy, void *data)
195*4882a593Smuzhiyun {
196*4882a593Smuzhiyun dev_set_drvdata(&phy->dev, data);
197*4882a593Smuzhiyun }
198*4882a593Smuzhiyun
phy_get_drvdata(struct phy * phy)199*4882a593Smuzhiyun static inline void *phy_get_drvdata(struct phy *phy)
200*4882a593Smuzhiyun {
201*4882a593Smuzhiyun return dev_get_drvdata(&phy->dev);
202*4882a593Smuzhiyun }
203*4882a593Smuzhiyun
204*4882a593Smuzhiyun #if IS_ENABLED(CONFIG_GENERIC_PHY)
205*4882a593Smuzhiyun int phy_pm_runtime_get(struct phy *phy);
206*4882a593Smuzhiyun int phy_pm_runtime_get_sync(struct phy *phy);
207*4882a593Smuzhiyun int phy_pm_runtime_put(struct phy *phy);
208*4882a593Smuzhiyun int phy_pm_runtime_put_sync(struct phy *phy);
209*4882a593Smuzhiyun void phy_pm_runtime_allow(struct phy *phy);
210*4882a593Smuzhiyun void phy_pm_runtime_forbid(struct phy *phy);
211*4882a593Smuzhiyun int phy_init(struct phy *phy);
212*4882a593Smuzhiyun int phy_exit(struct phy *phy);
213*4882a593Smuzhiyun int phy_power_on(struct phy *phy);
214*4882a593Smuzhiyun int phy_power_off(struct phy *phy);
215*4882a593Smuzhiyun int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode);
216*4882a593Smuzhiyun #define phy_set_mode(phy, mode) \
217*4882a593Smuzhiyun phy_set_mode_ext(phy, mode, 0)
218*4882a593Smuzhiyun int phy_configure(struct phy *phy, union phy_configure_opts *opts);
219*4882a593Smuzhiyun int phy_validate(struct phy *phy, enum phy_mode mode, int submode,
220*4882a593Smuzhiyun union phy_configure_opts *opts);
221*4882a593Smuzhiyun
phy_get_mode(struct phy * phy)222*4882a593Smuzhiyun static inline enum phy_mode phy_get_mode(struct phy *phy)
223*4882a593Smuzhiyun {
224*4882a593Smuzhiyun return phy->attrs.mode;
225*4882a593Smuzhiyun }
226*4882a593Smuzhiyun int phy_reset(struct phy *phy);
227*4882a593Smuzhiyun int phy_calibrate(struct phy *phy);
phy_get_bus_width(struct phy * phy)228*4882a593Smuzhiyun static inline int phy_get_bus_width(struct phy *phy)
229*4882a593Smuzhiyun {
230*4882a593Smuzhiyun return phy->attrs.bus_width;
231*4882a593Smuzhiyun }
phy_set_bus_width(struct phy * phy,int bus_width)232*4882a593Smuzhiyun static inline void phy_set_bus_width(struct phy *phy, int bus_width)
233*4882a593Smuzhiyun {
234*4882a593Smuzhiyun phy->attrs.bus_width = bus_width;
235*4882a593Smuzhiyun }
236*4882a593Smuzhiyun struct phy *phy_get(struct device *dev, const char *string);
237*4882a593Smuzhiyun struct phy *phy_optional_get(struct device *dev, const char *string);
238*4882a593Smuzhiyun struct phy *devm_phy_get(struct device *dev, const char *string);
239*4882a593Smuzhiyun struct phy *devm_phy_optional_get(struct device *dev, const char *string);
240*4882a593Smuzhiyun struct phy *devm_of_phy_get(struct device *dev, struct device_node *np,
241*4882a593Smuzhiyun const char *con_id);
242*4882a593Smuzhiyun struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np,
243*4882a593Smuzhiyun int index);
244*4882a593Smuzhiyun void of_phy_put(struct phy *phy);
245*4882a593Smuzhiyun void phy_put(struct device *dev, struct phy *phy);
246*4882a593Smuzhiyun void devm_phy_put(struct device *dev, struct phy *phy);
247*4882a593Smuzhiyun struct phy *of_phy_get(struct device_node *np, const char *con_id);
248*4882a593Smuzhiyun struct phy *of_phy_simple_xlate(struct device *dev,
249*4882a593Smuzhiyun struct of_phandle_args *args);
250*4882a593Smuzhiyun struct phy *phy_create(struct device *dev, struct device_node *node,
251*4882a593Smuzhiyun const struct phy_ops *ops);
252*4882a593Smuzhiyun struct phy *devm_phy_create(struct device *dev, struct device_node *node,
253*4882a593Smuzhiyun const struct phy_ops *ops);
254*4882a593Smuzhiyun void phy_destroy(struct phy *phy);
255*4882a593Smuzhiyun void devm_phy_destroy(struct device *dev, struct phy *phy);
256*4882a593Smuzhiyun struct phy_provider *__of_phy_provider_register(struct device *dev,
257*4882a593Smuzhiyun struct device_node *children, struct module *owner,
258*4882a593Smuzhiyun struct phy * (*of_xlate)(struct device *dev,
259*4882a593Smuzhiyun struct of_phandle_args *args));
260*4882a593Smuzhiyun struct phy_provider *__devm_of_phy_provider_register(struct device *dev,
261*4882a593Smuzhiyun struct device_node *children, struct module *owner,
262*4882a593Smuzhiyun struct phy * (*of_xlate)(struct device *dev,
263*4882a593Smuzhiyun struct of_phandle_args *args));
264*4882a593Smuzhiyun void of_phy_provider_unregister(struct phy_provider *phy_provider);
265*4882a593Smuzhiyun void devm_of_phy_provider_unregister(struct device *dev,
266*4882a593Smuzhiyun struct phy_provider *phy_provider);
267*4882a593Smuzhiyun int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id);
268*4882a593Smuzhiyun void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id);
269*4882a593Smuzhiyun #else
phy_pm_runtime_get(struct phy * phy)270*4882a593Smuzhiyun static inline int phy_pm_runtime_get(struct phy *phy)
271*4882a593Smuzhiyun {
272*4882a593Smuzhiyun if (!phy)
273*4882a593Smuzhiyun return 0;
274*4882a593Smuzhiyun return -ENOSYS;
275*4882a593Smuzhiyun }
276*4882a593Smuzhiyun
phy_pm_runtime_get_sync(struct phy * phy)277*4882a593Smuzhiyun static inline int phy_pm_runtime_get_sync(struct phy *phy)
278*4882a593Smuzhiyun {
279*4882a593Smuzhiyun if (!phy)
280*4882a593Smuzhiyun return 0;
281*4882a593Smuzhiyun return -ENOSYS;
282*4882a593Smuzhiyun }
283*4882a593Smuzhiyun
phy_pm_runtime_put(struct phy * phy)284*4882a593Smuzhiyun static inline int phy_pm_runtime_put(struct phy *phy)
285*4882a593Smuzhiyun {
286*4882a593Smuzhiyun if (!phy)
287*4882a593Smuzhiyun return 0;
288*4882a593Smuzhiyun return -ENOSYS;
289*4882a593Smuzhiyun }
290*4882a593Smuzhiyun
phy_pm_runtime_put_sync(struct phy * phy)291*4882a593Smuzhiyun static inline int phy_pm_runtime_put_sync(struct phy *phy)
292*4882a593Smuzhiyun {
293*4882a593Smuzhiyun if (!phy)
294*4882a593Smuzhiyun return 0;
295*4882a593Smuzhiyun return -ENOSYS;
296*4882a593Smuzhiyun }
297*4882a593Smuzhiyun
phy_pm_runtime_allow(struct phy * phy)298*4882a593Smuzhiyun static inline void phy_pm_runtime_allow(struct phy *phy)
299*4882a593Smuzhiyun {
300*4882a593Smuzhiyun return;
301*4882a593Smuzhiyun }
302*4882a593Smuzhiyun
phy_pm_runtime_forbid(struct phy * phy)303*4882a593Smuzhiyun static inline void phy_pm_runtime_forbid(struct phy *phy)
304*4882a593Smuzhiyun {
305*4882a593Smuzhiyun return;
306*4882a593Smuzhiyun }
307*4882a593Smuzhiyun
phy_init(struct phy * phy)308*4882a593Smuzhiyun static inline int phy_init(struct phy *phy)
309*4882a593Smuzhiyun {
310*4882a593Smuzhiyun if (!phy)
311*4882a593Smuzhiyun return 0;
312*4882a593Smuzhiyun return -ENOSYS;
313*4882a593Smuzhiyun }
314*4882a593Smuzhiyun
phy_exit(struct phy * phy)315*4882a593Smuzhiyun static inline int phy_exit(struct phy *phy)
316*4882a593Smuzhiyun {
317*4882a593Smuzhiyun if (!phy)
318*4882a593Smuzhiyun return 0;
319*4882a593Smuzhiyun return -ENOSYS;
320*4882a593Smuzhiyun }
321*4882a593Smuzhiyun
phy_power_on(struct phy * phy)322*4882a593Smuzhiyun static inline int phy_power_on(struct phy *phy)
323*4882a593Smuzhiyun {
324*4882a593Smuzhiyun if (!phy)
325*4882a593Smuzhiyun return 0;
326*4882a593Smuzhiyun return -ENOSYS;
327*4882a593Smuzhiyun }
328*4882a593Smuzhiyun
phy_power_off(struct phy * phy)329*4882a593Smuzhiyun static inline int phy_power_off(struct phy *phy)
330*4882a593Smuzhiyun {
331*4882a593Smuzhiyun if (!phy)
332*4882a593Smuzhiyun return 0;
333*4882a593Smuzhiyun return -ENOSYS;
334*4882a593Smuzhiyun }
335*4882a593Smuzhiyun
phy_set_mode_ext(struct phy * phy,enum phy_mode mode,int submode)336*4882a593Smuzhiyun static inline int phy_set_mode_ext(struct phy *phy, enum phy_mode mode,
337*4882a593Smuzhiyun int submode)
338*4882a593Smuzhiyun {
339*4882a593Smuzhiyun if (!phy)
340*4882a593Smuzhiyun return 0;
341*4882a593Smuzhiyun return -ENOSYS;
342*4882a593Smuzhiyun }
343*4882a593Smuzhiyun
344*4882a593Smuzhiyun #define phy_set_mode(phy, mode) \
345*4882a593Smuzhiyun phy_set_mode_ext(phy, mode, 0)
346*4882a593Smuzhiyun
phy_get_mode(struct phy * phy)347*4882a593Smuzhiyun static inline enum phy_mode phy_get_mode(struct phy *phy)
348*4882a593Smuzhiyun {
349*4882a593Smuzhiyun return PHY_MODE_INVALID;
350*4882a593Smuzhiyun }
351*4882a593Smuzhiyun
phy_reset(struct phy * phy)352*4882a593Smuzhiyun static inline int phy_reset(struct phy *phy)
353*4882a593Smuzhiyun {
354*4882a593Smuzhiyun if (!phy)
355*4882a593Smuzhiyun return 0;
356*4882a593Smuzhiyun return -ENOSYS;
357*4882a593Smuzhiyun }
358*4882a593Smuzhiyun
phy_calibrate(struct phy * phy)359*4882a593Smuzhiyun static inline int phy_calibrate(struct phy *phy)
360*4882a593Smuzhiyun {
361*4882a593Smuzhiyun if (!phy)
362*4882a593Smuzhiyun return 0;
363*4882a593Smuzhiyun return -ENOSYS;
364*4882a593Smuzhiyun }
365*4882a593Smuzhiyun
phy_configure(struct phy * phy,union phy_configure_opts * opts)366*4882a593Smuzhiyun static inline int phy_configure(struct phy *phy,
367*4882a593Smuzhiyun union phy_configure_opts *opts)
368*4882a593Smuzhiyun {
369*4882a593Smuzhiyun if (!phy)
370*4882a593Smuzhiyun return 0;
371*4882a593Smuzhiyun
372*4882a593Smuzhiyun return -ENOSYS;
373*4882a593Smuzhiyun }
374*4882a593Smuzhiyun
phy_validate(struct phy * phy,enum phy_mode mode,int submode,union phy_configure_opts * opts)375*4882a593Smuzhiyun static inline int phy_validate(struct phy *phy, enum phy_mode mode, int submode,
376*4882a593Smuzhiyun union phy_configure_opts *opts)
377*4882a593Smuzhiyun {
378*4882a593Smuzhiyun if (!phy)
379*4882a593Smuzhiyun return 0;
380*4882a593Smuzhiyun
381*4882a593Smuzhiyun return -ENOSYS;
382*4882a593Smuzhiyun }
383*4882a593Smuzhiyun
phy_get_bus_width(struct phy * phy)384*4882a593Smuzhiyun static inline int phy_get_bus_width(struct phy *phy)
385*4882a593Smuzhiyun {
386*4882a593Smuzhiyun return -ENOSYS;
387*4882a593Smuzhiyun }
388*4882a593Smuzhiyun
phy_set_bus_width(struct phy * phy,int bus_width)389*4882a593Smuzhiyun static inline void phy_set_bus_width(struct phy *phy, int bus_width)
390*4882a593Smuzhiyun {
391*4882a593Smuzhiyun return;
392*4882a593Smuzhiyun }
393*4882a593Smuzhiyun
phy_get(struct device * dev,const char * string)394*4882a593Smuzhiyun static inline struct phy *phy_get(struct device *dev, const char *string)
395*4882a593Smuzhiyun {
396*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
397*4882a593Smuzhiyun }
398*4882a593Smuzhiyun
phy_optional_get(struct device * dev,const char * string)399*4882a593Smuzhiyun static inline struct phy *phy_optional_get(struct device *dev,
400*4882a593Smuzhiyun const char *string)
401*4882a593Smuzhiyun {
402*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
403*4882a593Smuzhiyun }
404*4882a593Smuzhiyun
devm_phy_get(struct device * dev,const char * string)405*4882a593Smuzhiyun static inline struct phy *devm_phy_get(struct device *dev, const char *string)
406*4882a593Smuzhiyun {
407*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
408*4882a593Smuzhiyun }
409*4882a593Smuzhiyun
devm_phy_optional_get(struct device * dev,const char * string)410*4882a593Smuzhiyun static inline struct phy *devm_phy_optional_get(struct device *dev,
411*4882a593Smuzhiyun const char *string)
412*4882a593Smuzhiyun {
413*4882a593Smuzhiyun return NULL;
414*4882a593Smuzhiyun }
415*4882a593Smuzhiyun
devm_of_phy_get(struct device * dev,struct device_node * np,const char * con_id)416*4882a593Smuzhiyun static inline struct phy *devm_of_phy_get(struct device *dev,
417*4882a593Smuzhiyun struct device_node *np,
418*4882a593Smuzhiyun const char *con_id)
419*4882a593Smuzhiyun {
420*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
421*4882a593Smuzhiyun }
422*4882a593Smuzhiyun
devm_of_phy_get_by_index(struct device * dev,struct device_node * np,int index)423*4882a593Smuzhiyun static inline struct phy *devm_of_phy_get_by_index(struct device *dev,
424*4882a593Smuzhiyun struct device_node *np,
425*4882a593Smuzhiyun int index)
426*4882a593Smuzhiyun {
427*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
428*4882a593Smuzhiyun }
429*4882a593Smuzhiyun
of_phy_put(struct phy * phy)430*4882a593Smuzhiyun static inline void of_phy_put(struct phy *phy)
431*4882a593Smuzhiyun {
432*4882a593Smuzhiyun }
433*4882a593Smuzhiyun
phy_put(struct device * dev,struct phy * phy)434*4882a593Smuzhiyun static inline void phy_put(struct device *dev, struct phy *phy)
435*4882a593Smuzhiyun {
436*4882a593Smuzhiyun }
437*4882a593Smuzhiyun
devm_phy_put(struct device * dev,struct phy * phy)438*4882a593Smuzhiyun static inline void devm_phy_put(struct device *dev, struct phy *phy)
439*4882a593Smuzhiyun {
440*4882a593Smuzhiyun }
441*4882a593Smuzhiyun
of_phy_get(struct device_node * np,const char * con_id)442*4882a593Smuzhiyun static inline struct phy *of_phy_get(struct device_node *np, const char *con_id)
443*4882a593Smuzhiyun {
444*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
445*4882a593Smuzhiyun }
446*4882a593Smuzhiyun
of_phy_simple_xlate(struct device * dev,struct of_phandle_args * args)447*4882a593Smuzhiyun static inline struct phy *of_phy_simple_xlate(struct device *dev,
448*4882a593Smuzhiyun struct of_phandle_args *args)
449*4882a593Smuzhiyun {
450*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
451*4882a593Smuzhiyun }
452*4882a593Smuzhiyun
phy_create(struct device * dev,struct device_node * node,const struct phy_ops * ops)453*4882a593Smuzhiyun static inline struct phy *phy_create(struct device *dev,
454*4882a593Smuzhiyun struct device_node *node,
455*4882a593Smuzhiyun const struct phy_ops *ops)
456*4882a593Smuzhiyun {
457*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
458*4882a593Smuzhiyun }
459*4882a593Smuzhiyun
devm_phy_create(struct device * dev,struct device_node * node,const struct phy_ops * ops)460*4882a593Smuzhiyun static inline struct phy *devm_phy_create(struct device *dev,
461*4882a593Smuzhiyun struct device_node *node,
462*4882a593Smuzhiyun const struct phy_ops *ops)
463*4882a593Smuzhiyun {
464*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
465*4882a593Smuzhiyun }
466*4882a593Smuzhiyun
phy_destroy(struct phy * phy)467*4882a593Smuzhiyun static inline void phy_destroy(struct phy *phy)
468*4882a593Smuzhiyun {
469*4882a593Smuzhiyun }
470*4882a593Smuzhiyun
devm_phy_destroy(struct device * dev,struct phy * phy)471*4882a593Smuzhiyun static inline void devm_phy_destroy(struct device *dev, struct phy *phy)
472*4882a593Smuzhiyun {
473*4882a593Smuzhiyun }
474*4882a593Smuzhiyun
__of_phy_provider_register(struct device * dev,struct device_node * children,struct module * owner,struct phy * (* of_xlate)(struct device * dev,struct of_phandle_args * args))475*4882a593Smuzhiyun static inline struct phy_provider *__of_phy_provider_register(
476*4882a593Smuzhiyun struct device *dev, struct device_node *children, struct module *owner,
477*4882a593Smuzhiyun struct phy * (*of_xlate)(struct device *dev,
478*4882a593Smuzhiyun struct of_phandle_args *args))
479*4882a593Smuzhiyun {
480*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
481*4882a593Smuzhiyun }
482*4882a593Smuzhiyun
__devm_of_phy_provider_register(struct device * dev,struct device_node * children,struct module * owner,struct phy * (* of_xlate)(struct device * dev,struct of_phandle_args * args))483*4882a593Smuzhiyun static inline struct phy_provider *__devm_of_phy_provider_register(struct device
484*4882a593Smuzhiyun *dev, struct device_node *children, struct module *owner,
485*4882a593Smuzhiyun struct phy * (*of_xlate)(struct device *dev,
486*4882a593Smuzhiyun struct of_phandle_args *args))
487*4882a593Smuzhiyun {
488*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
489*4882a593Smuzhiyun }
490*4882a593Smuzhiyun
of_phy_provider_unregister(struct phy_provider * phy_provider)491*4882a593Smuzhiyun static inline void of_phy_provider_unregister(struct phy_provider *phy_provider)
492*4882a593Smuzhiyun {
493*4882a593Smuzhiyun }
494*4882a593Smuzhiyun
devm_of_phy_provider_unregister(struct device * dev,struct phy_provider * phy_provider)495*4882a593Smuzhiyun static inline void devm_of_phy_provider_unregister(struct device *dev,
496*4882a593Smuzhiyun struct phy_provider *phy_provider)
497*4882a593Smuzhiyun {
498*4882a593Smuzhiyun }
499*4882a593Smuzhiyun static inline int
phy_create_lookup(struct phy * phy,const char * con_id,const char * dev_id)500*4882a593Smuzhiyun phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id)
501*4882a593Smuzhiyun {
502*4882a593Smuzhiyun return 0;
503*4882a593Smuzhiyun }
phy_remove_lookup(struct phy * phy,const char * con_id,const char * dev_id)504*4882a593Smuzhiyun static inline void phy_remove_lookup(struct phy *phy, const char *con_id,
505*4882a593Smuzhiyun const char *dev_id) { }
506*4882a593Smuzhiyun #endif
507*4882a593Smuzhiyun
508*4882a593Smuzhiyun #endif /* __DRIVERS_PHY_H */
509