xref: /openbmc/linux/include/linux/phy_fixed.h (revision 17bc4815de586d001c82d0ddf75247283c3f002a)
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 			 int link_gpio);
20 extern struct phy_device *fixed_phy_register(unsigned int irq,
21 					     struct fixed_phy_status *status,
22 					     int link_gpio,
23 					     struct device_node *np);
24 extern void fixed_phy_unregister(struct phy_device *phydev);
25 extern int fixed_phy_set_link_update(struct phy_device *phydev,
26 			int (*link_update)(struct net_device *,
27 					   struct fixed_phy_status *));
28 #else
29 static inline int fixed_phy_add(unsigned int irq, int phy_id,
30 				struct fixed_phy_status *status,
31 				int link_gpio)
32 {
33 	return -ENODEV;
34 }
35 static inline struct phy_device *fixed_phy_register(unsigned int irq,
36 						struct fixed_phy_status *status,
37 						int gpio_link,
38 						struct device_node *np)
39 {
40 	return ERR_PTR(-ENODEV);
41 }
42 static inline void fixed_phy_unregister(struct phy_device *phydev)
43 {
44 }
45 static inline int fixed_phy_set_link_update(struct phy_device *phydev,
46 			int (*link_update)(struct net_device *,
47 					   struct fixed_phy_status *))
48 {
49 	return -ENODEV;
50 }
51 static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
52 {
53 	return -EINVAL;
54 }
55 #endif /* CONFIG_FIXED_PHY */
56 
57 #endif /* __PHY_FIXED_H */
58