xref: /linux/include/linux/phy_fixed.h (revision 8f7aa3d3c7323f4ca2768a9e74ebbe359c4f8f88)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PHY_FIXED_H
3 #define __PHY_FIXED_H
4 
5 #include <linux/types.h>
6 
7 struct fixed_phy_status {
8 	int speed;
9 	int duplex;
10 	bool link:1;
11 	bool pause:1;
12 	bool asym_pause:1;
13 };
14 
15 struct device_node;
16 struct net_device;
17 
18 #if IS_ENABLED(CONFIG_FIXED_PHY)
19 extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
20 struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
21 				      struct device_node *np);
22 struct phy_device *fixed_phy_register_100fd(void);
23 
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 struct phy_device *
fixed_phy_register(const struct fixed_phy_status * status,struct device_node * np)30 fixed_phy_register(const struct fixed_phy_status *status,
31 		   struct device_node *np)
32 {
33 	return ERR_PTR(-ENODEV);
34 }
35 
fixed_phy_register_100fd(void)36 static inline struct phy_device *fixed_phy_register_100fd(void)
37 {
38 	return ERR_PTR(-ENODEV);
39 }
40 
fixed_phy_unregister(struct phy_device * phydev)41 static inline void fixed_phy_unregister(struct phy_device *phydev)
42 {
43 }
44 #endif /* CONFIG_FIXED_PHY */
45 
46 #endif /* __PHY_FIXED_H */
47