xref: /openbmc/linux/include/linux/phy_fixed.h (revision 5468e82f7034f0ae175a3ce075441356099bdaa3)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
27c32f470SVitaly Bordug #ifndef __PHY_FIXED_H
37c32f470SVitaly Bordug #define __PHY_FIXED_H
47c32f470SVitaly Bordug 
57c32f470SVitaly Bordug struct fixed_phy_status {
6a79d8e93SVitaly Bordug 	int link;
7a79d8e93SVitaly Bordug 	int speed;
8a79d8e93SVitaly Bordug 	int duplex;
9a79d8e93SVitaly Bordug 	int pause;
10a79d8e93SVitaly Bordug 	int asym_pause;
117c32f470SVitaly Bordug };
127c32f470SVitaly Bordug 
13a7595121SThomas Petazzoni struct device_node;
14a7595121SThomas Petazzoni 
156539c44dSDavid S. Miller #if IS_ENABLED(CONFIG_FIXED_PHY)
16b3e5464eSJoakim Tjernlund extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
17a79d8e93SVitaly Bordug extern int fixed_phy_add(unsigned int irq, int phy_id,
18*5468e82fSLinus Walleij 			 struct fixed_phy_status *status);
19fd2ef0baSPetri Gynther extern struct phy_device *fixed_phy_register(unsigned int irq,
20a7595121SThomas Petazzoni 					     struct fixed_phy_status *status,
21a7595121SThomas Petazzoni 					     struct device_node *np);
225bcbe0f3SAndrew Lunn extern void fixed_phy_unregister(struct phy_device *phydev);
23464c3668SFlorian Fainelli extern int fixed_phy_set_link_update(struct phy_device *phydev,
24464c3668SFlorian Fainelli 			int (*link_update)(struct net_device *,
25464c3668SFlorian Fainelli 					   struct fixed_phy_status *));
26a79d8e93SVitaly Bordug #else
27a79d8e93SVitaly Bordug static inline int fixed_phy_add(unsigned int irq, int phy_id,
28*5468e82fSLinus Walleij 				struct fixed_phy_status *status)
29a79d8e93SVitaly Bordug {
30a79d8e93SVitaly Bordug 	return -ENODEV;
31a79d8e93SVitaly Bordug }
32fd2ef0baSPetri Gynther static inline struct phy_device *fixed_phy_register(unsigned int irq,
33a7595121SThomas Petazzoni 						struct fixed_phy_status *status,
34a7595121SThomas Petazzoni 						struct device_node *np)
35a7595121SThomas Petazzoni {
36fd2ef0baSPetri Gynther 	return ERR_PTR(-ENODEV);
37a7595121SThomas Petazzoni }
385bcbe0f3SAndrew Lunn static inline void fixed_phy_unregister(struct phy_device *phydev)
3946cfd6eaSKonrad Zapalowicz {
4046cfd6eaSKonrad Zapalowicz }
41464c3668SFlorian Fainelli static inline int fixed_phy_set_link_update(struct phy_device *phydev,
42a79d8e93SVitaly Bordug 			int (*link_update)(struct net_device *,
43464c3668SFlorian Fainelli 					   struct fixed_phy_status *))
44464c3668SFlorian Fainelli {
45464c3668SFlorian Fainelli 	return -ENODEV;
46464c3668SFlorian Fainelli }
47b3e5464eSJoakim Tjernlund static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
48b3e5464eSJoakim Tjernlund {
49b3e5464eSJoakim Tjernlund 	return -EINVAL;
50b3e5464eSJoakim Tjernlund }
51464c3668SFlorian Fainelli #endif /* CONFIG_FIXED_PHY */
527c32f470SVitaly Bordug 
537c32f470SVitaly Bordug #endif /* __PHY_FIXED_H */
54