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) 16b3e5464eSJoakim 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, 185468e82fSLinus Walleij struct fixed_phy_status *status); 19fd2ef0baSPetri Gynther extern struct phy_device *fixed_phy_register(unsigned int irq, 20a7595121SThomas Petazzoni struct fixed_phy_status *status, 21a7595121SThomas Petazzoni struct device_node *np); 22*71bd106dSMoritz Fischer 23*71bd106dSMoritz Fischer extern struct phy_device * 24*71bd106dSMoritz Fischer fixed_phy_register_with_gpiod(unsigned int irq, 25*71bd106dSMoritz Fischer struct fixed_phy_status *status, 26*71bd106dSMoritz Fischer struct gpio_desc *gpiod); 27*71bd106dSMoritz Fischer 285bcbe0f3SAndrew Lunn extern void fixed_phy_unregister(struct phy_device *phydev); 29464c3668SFlorian Fainelli extern int fixed_phy_set_link_update(struct phy_device *phydev, 30464c3668SFlorian Fainelli int (*link_update)(struct net_device *, 31464c3668SFlorian Fainelli struct fixed_phy_status *)); 32a79d8e93SVitaly Bordug #else 33a79d8e93SVitaly Bordug static inline int fixed_phy_add(unsigned int irq, int phy_id, 345468e82fSLinus Walleij struct fixed_phy_status *status) 35a79d8e93SVitaly Bordug { 36a79d8e93SVitaly Bordug return -ENODEV; 37a79d8e93SVitaly Bordug } 38fd2ef0baSPetri Gynther static inline struct phy_device *fixed_phy_register(unsigned int irq, 39a7595121SThomas Petazzoni struct fixed_phy_status *status, 40a7595121SThomas Petazzoni struct device_node *np) 41a7595121SThomas Petazzoni { 42fd2ef0baSPetri Gynther return ERR_PTR(-ENODEV); 43a7595121SThomas Petazzoni } 44*71bd106dSMoritz Fischer 45*71bd106dSMoritz Fischer static inline struct phy_device * 46*71bd106dSMoritz Fischer fixed_phy_register_with_gpiod(unsigned int irq, 47*71bd106dSMoritz Fischer struct fixed_phy_status *status, 48*71bd106dSMoritz Fischer struct gpio_desc *gpiod) 49*71bd106dSMoritz Fischer { 50*71bd106dSMoritz Fischer return ERR_PTR(-ENODEV); 51*71bd106dSMoritz Fischer } 52*71bd106dSMoritz Fischer 535bcbe0f3SAndrew Lunn static inline void fixed_phy_unregister(struct phy_device *phydev) 5446cfd6eaSKonrad Zapalowicz { 5546cfd6eaSKonrad Zapalowicz } 56464c3668SFlorian Fainelli static inline int fixed_phy_set_link_update(struct phy_device *phydev, 57a79d8e93SVitaly Bordug int (*link_update)(struct net_device *, 58464c3668SFlorian Fainelli struct fixed_phy_status *)) 59464c3668SFlorian Fainelli { 60464c3668SFlorian Fainelli return -ENODEV; 61464c3668SFlorian Fainelli } 62b3e5464eSJoakim Tjernlund static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier) 63b3e5464eSJoakim Tjernlund { 64b3e5464eSJoakim Tjernlund return -EINVAL; 65b3e5464eSJoakim Tjernlund } 66464c3668SFlorian Fainelli #endif /* CONFIG_FIXED_PHY */ 677c32f470SVitaly Bordug 687c32f470SVitaly Bordug #endif /* __PHY_FIXED_H */ 69