xref: /openbmc/linux/include/linux/phy_fixed.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
27c32f470SVitaly Bordug #ifndef __PHY_FIXED_H
37c32f470SVitaly Bordug #define __PHY_FIXED_H
47c32f470SVitaly Bordug 
5*5f10376bSJakub Kicinski #include <linux/types.h>
6*5f10376bSJakub Kicinski 
77c32f470SVitaly Bordug struct fixed_phy_status {
8a79d8e93SVitaly Bordug 	int link;
9a79d8e93SVitaly Bordug 	int speed;
10a79d8e93SVitaly Bordug 	int duplex;
11a79d8e93SVitaly Bordug 	int pause;
12a79d8e93SVitaly Bordug 	int asym_pause;
137c32f470SVitaly Bordug };
147c32f470SVitaly Bordug 
15a7595121SThomas Petazzoni struct device_node;
16ebe26acaSMoritz Fischer struct gpio_desc;
17*5f10376bSJakub Kicinski struct net_device;
18a7595121SThomas Petazzoni 
196539c44dSDavid S. Miller #if IS_ENABLED(CONFIG_FIXED_PHY)
20b3e5464eSJoakim Tjernlund extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
21a79d8e93SVitaly Bordug extern int fixed_phy_add(unsigned int irq, int phy_id,
225468e82fSLinus Walleij 			 struct fixed_phy_status *status);
23fd2ef0baSPetri Gynther extern struct phy_device *fixed_phy_register(unsigned int irq,
24a7595121SThomas Petazzoni 					     struct fixed_phy_status *status,
25a7595121SThomas Petazzoni 					     struct device_node *np);
2671bd106dSMoritz Fischer 
2771bd106dSMoritz Fischer extern struct phy_device *
2871bd106dSMoritz Fischer fixed_phy_register_with_gpiod(unsigned int irq,
2971bd106dSMoritz Fischer 			      struct fixed_phy_status *status,
3071bd106dSMoritz Fischer 			      struct gpio_desc *gpiod);
3171bd106dSMoritz Fischer 
325bcbe0f3SAndrew Lunn extern void fixed_phy_unregister(struct phy_device *phydev);
33464c3668SFlorian Fainelli extern int fixed_phy_set_link_update(struct phy_device *phydev,
34464c3668SFlorian Fainelli 			int (*link_update)(struct net_device *,
35464c3668SFlorian Fainelli 					   struct fixed_phy_status *));
36a79d8e93SVitaly Bordug #else
fixed_phy_add(unsigned int irq,int phy_id,struct fixed_phy_status * status)37a79d8e93SVitaly Bordug static inline int fixed_phy_add(unsigned int irq, int phy_id,
385468e82fSLinus Walleij 				struct fixed_phy_status *status)
39a79d8e93SVitaly Bordug {
40a79d8e93SVitaly Bordug 	return -ENODEV;
41a79d8e93SVitaly Bordug }
fixed_phy_register(unsigned int irq,struct fixed_phy_status * status,struct device_node * np)42fd2ef0baSPetri Gynther static inline struct phy_device *fixed_phy_register(unsigned int irq,
43a7595121SThomas Petazzoni 						struct fixed_phy_status *status,
44a7595121SThomas Petazzoni 						struct device_node *np)
45a7595121SThomas Petazzoni {
46fd2ef0baSPetri Gynther 	return ERR_PTR(-ENODEV);
47a7595121SThomas Petazzoni }
4871bd106dSMoritz Fischer 
4971bd106dSMoritz Fischer static inline struct phy_device *
fixed_phy_register_with_gpiod(unsigned int irq,struct fixed_phy_status * status,struct gpio_desc * gpiod)5071bd106dSMoritz Fischer fixed_phy_register_with_gpiod(unsigned int irq,
5171bd106dSMoritz Fischer 			      struct fixed_phy_status *status,
5271bd106dSMoritz Fischer 			      struct gpio_desc *gpiod)
5371bd106dSMoritz Fischer {
5471bd106dSMoritz Fischer 	return ERR_PTR(-ENODEV);
5571bd106dSMoritz Fischer }
5671bd106dSMoritz Fischer 
fixed_phy_unregister(struct phy_device * phydev)575bcbe0f3SAndrew Lunn static inline void fixed_phy_unregister(struct phy_device *phydev)
5846cfd6eaSKonrad Zapalowicz {
5946cfd6eaSKonrad Zapalowicz }
fixed_phy_set_link_update(struct phy_device * phydev,int (* link_update)(struct net_device *,struct fixed_phy_status *))60464c3668SFlorian Fainelli static inline int fixed_phy_set_link_update(struct phy_device *phydev,
61a79d8e93SVitaly Bordug 			int (*link_update)(struct net_device *,
62464c3668SFlorian Fainelli 					   struct fixed_phy_status *))
63464c3668SFlorian Fainelli {
64464c3668SFlorian Fainelli 	return -ENODEV;
65464c3668SFlorian Fainelli }
fixed_phy_change_carrier(struct net_device * dev,bool new_carrier)66b3e5464eSJoakim Tjernlund static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
67b3e5464eSJoakim Tjernlund {
68b3e5464eSJoakim Tjernlund 	return -EINVAL;
69b3e5464eSJoakim Tjernlund }
70464c3668SFlorian Fainelli #endif /* CONFIG_FIXED_PHY */
717c32f470SVitaly Bordug 
727c32f470SVitaly Bordug #endif /* __PHY_FIXED_H */
73