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