xref: /openbmc/linux/include/linux/phy_fixed.h (revision b3e5464e36c07dba70b544044a297d5819351765)
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)
16*b3e5464eSJoakim 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,
18a5597008SAndrew Lunn 			 struct fixed_phy_status *status,
19a5597008SAndrew Lunn 			 int link_gpio);
20fd2ef0baSPetri Gynther extern struct phy_device *fixed_phy_register(unsigned int irq,
21a7595121SThomas Petazzoni 					     struct fixed_phy_status *status,
22a5597008SAndrew Lunn 					     int link_gpio,
23a7595121SThomas Petazzoni 					     struct device_node *np);
245bcbe0f3SAndrew Lunn extern void fixed_phy_unregister(struct phy_device *phydev);
25464c3668SFlorian Fainelli extern int fixed_phy_set_link_update(struct phy_device *phydev,
26464c3668SFlorian Fainelli 			int (*link_update)(struct net_device *,
27464c3668SFlorian Fainelli 					   struct fixed_phy_status *));
28a79d8e93SVitaly Bordug #else
29a79d8e93SVitaly Bordug static inline int fixed_phy_add(unsigned int irq, int phy_id,
30a5597008SAndrew Lunn 				struct fixed_phy_status *status,
31a5597008SAndrew Lunn 				int link_gpio)
32a79d8e93SVitaly Bordug {
33a79d8e93SVitaly Bordug 	return -ENODEV;
34a79d8e93SVitaly Bordug }
35fd2ef0baSPetri Gynther static inline struct phy_device *fixed_phy_register(unsigned int irq,
36a7595121SThomas Petazzoni 						struct fixed_phy_status *status,
37a5597008SAndrew Lunn 						int gpio_link,
38a7595121SThomas Petazzoni 						struct device_node *np)
39a7595121SThomas Petazzoni {
40fd2ef0baSPetri Gynther 	return ERR_PTR(-ENODEV);
41a7595121SThomas Petazzoni }
425bcbe0f3SAndrew Lunn static inline void fixed_phy_unregister(struct phy_device *phydev)
4346cfd6eaSKonrad Zapalowicz {
4446cfd6eaSKonrad Zapalowicz }
45464c3668SFlorian Fainelli static inline int fixed_phy_set_link_update(struct phy_device *phydev,
46a79d8e93SVitaly Bordug 			int (*link_update)(struct net_device *,
47464c3668SFlorian Fainelli 					   struct fixed_phy_status *))
48464c3668SFlorian Fainelli {
49464c3668SFlorian Fainelli 	return -ENODEV;
50464c3668SFlorian Fainelli }
51*b3e5464eSJoakim Tjernlund static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
52*b3e5464eSJoakim Tjernlund {
53*b3e5464eSJoakim Tjernlund 	return -EINVAL;
54*b3e5464eSJoakim Tjernlund }
55464c3668SFlorian Fainelli #endif /* CONFIG_FIXED_PHY */
567c32f470SVitaly Bordug 
577c32f470SVitaly Bordug #endif /* __PHY_FIXED_H */
58