xref: /openbmc/linux/include/linux/phy_fixed.h (revision 5bcbe0f35fb13e31fdd0b2dc9695f19ab0208207)
17c32f470SVitaly Bordug #ifndef __PHY_FIXED_H
27c32f470SVitaly Bordug #define __PHY_FIXED_H
37c32f470SVitaly Bordug 
47c32f470SVitaly Bordug struct fixed_phy_status {
5a79d8e93SVitaly Bordug 	int link;
6a79d8e93SVitaly Bordug 	int speed;
7a79d8e93SVitaly Bordug 	int duplex;
8a79d8e93SVitaly Bordug 	int pause;
9a79d8e93SVitaly Bordug 	int asym_pause;
107c32f470SVitaly Bordug };
117c32f470SVitaly Bordug 
12a7595121SThomas Petazzoni struct device_node;
13a7595121SThomas Petazzoni 
146539c44dSDavid S. Miller #if IS_ENABLED(CONFIG_FIXED_PHY)
15a79d8e93SVitaly Bordug extern int fixed_phy_add(unsigned int irq, int phy_id,
16a5597008SAndrew Lunn 			 struct fixed_phy_status *status,
17a5597008SAndrew Lunn 			 int link_gpio);
18fd2ef0baSPetri Gynther extern struct phy_device *fixed_phy_register(unsigned int irq,
19a7595121SThomas Petazzoni 					     struct fixed_phy_status *status,
20a5597008SAndrew Lunn 					     int link_gpio,
21a7595121SThomas Petazzoni 					     struct device_node *np);
22*5bcbe0f3SAndrew Lunn extern void fixed_phy_unregister(struct phy_device *phydev);
23464c3668SFlorian Fainelli extern int fixed_phy_set_link_update(struct phy_device *phydev,
24464c3668SFlorian Fainelli 			int (*link_update)(struct net_device *,
25464c3668SFlorian Fainelli 					   struct fixed_phy_status *));
26a3bebdceSStas Sergeev extern int fixed_phy_update_state(struct phy_device *phydev,
27a3bebdceSStas Sergeev 			   const struct fixed_phy_status *status,
28a3bebdceSStas Sergeev 			   const struct fixed_phy_status *changed);
29a79d8e93SVitaly Bordug #else
30a79d8e93SVitaly Bordug static inline int fixed_phy_add(unsigned int irq, int phy_id,
31a5597008SAndrew Lunn 				struct fixed_phy_status *status,
32a5597008SAndrew Lunn 				int link_gpio)
33a79d8e93SVitaly Bordug {
34a79d8e93SVitaly Bordug 	return -ENODEV;
35a79d8e93SVitaly Bordug }
36fd2ef0baSPetri Gynther static inline struct phy_device *fixed_phy_register(unsigned int irq,
37a7595121SThomas Petazzoni 						struct fixed_phy_status *status,
38a5597008SAndrew Lunn 						int gpio_link,
39a7595121SThomas Petazzoni 						struct device_node *np)
40a7595121SThomas Petazzoni {
41fd2ef0baSPetri Gynther 	return ERR_PTR(-ENODEV);
42a7595121SThomas Petazzoni }
43*5bcbe0f3SAndrew Lunn static inline void fixed_phy_unregister(struct phy_device *phydev)
4446cfd6eaSKonrad Zapalowicz {
4546cfd6eaSKonrad Zapalowicz }
46464c3668SFlorian Fainelli static inline int fixed_phy_set_link_update(struct phy_device *phydev,
47a79d8e93SVitaly Bordug 			int (*link_update)(struct net_device *,
48464c3668SFlorian Fainelli 					   struct fixed_phy_status *))
49464c3668SFlorian Fainelli {
50464c3668SFlorian Fainelli 	return -ENODEV;
51464c3668SFlorian Fainelli }
52a3bebdceSStas Sergeev static inline int fixed_phy_update_state(struct phy_device *phydev,
53a3bebdceSStas Sergeev 			   const struct fixed_phy_status *status,
54a3bebdceSStas Sergeev 			   const struct fixed_phy_status *changed)
55a3bebdceSStas Sergeev {
56a3bebdceSStas Sergeev 	return -ENODEV;
57a3bebdceSStas Sergeev }
58464c3668SFlorian Fainelli #endif /* CONFIG_FIXED_PHY */
597c32f470SVitaly Bordug 
607c32f470SVitaly Bordug #endif /* __PHY_FIXED_H */
61