xref: /linux-6.15/include/linux/phy_fixed.h (revision 5468e82f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PHY_FIXED_H
3 #define __PHY_FIXED_H
4 
5 struct fixed_phy_status {
6 	int link;
7 	int speed;
8 	int duplex;
9 	int pause;
10 	int asym_pause;
11 };
12 
13 struct device_node;
14 
15 #if IS_ENABLED(CONFIG_FIXED_PHY)
16 extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
17 extern int fixed_phy_add(unsigned int irq, int phy_id,
18 			 struct fixed_phy_status *status);
19 extern struct phy_device *fixed_phy_register(unsigned int irq,
20 					     struct fixed_phy_status *status,
21 					     struct device_node *np);
22 extern void fixed_phy_unregister(struct phy_device *phydev);
23 extern int fixed_phy_set_link_update(struct phy_device *phydev,
24 			int (*link_update)(struct net_device *,
25 					   struct fixed_phy_status *));
26 #else
27 static inline int fixed_phy_add(unsigned int irq, int phy_id,
28 				struct fixed_phy_status *status)
29 {
30 	return -ENODEV;
31 }
32 static inline struct phy_device *fixed_phy_register(unsigned int irq,
33 						struct fixed_phy_status *status,
34 						struct device_node *np)
35 {
36 	return ERR_PTR(-ENODEV);
37 }
38 static inline void fixed_phy_unregister(struct phy_device *phydev)
39 {
40 }
41 static inline int fixed_phy_set_link_update(struct phy_device *phydev,
42 			int (*link_update)(struct net_device *,
43 					   struct fixed_phy_status *))
44 {
45 	return -ENODEV;
46 }
47 static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
48 {
49 	return -EINVAL;
50 }
51 #endif /* CONFIG_FIXED_PHY */
52 
53 #endif /* __PHY_FIXED_H */
54