phy_fixed.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __PHY_FIXED_H
  3. #define __PHY_FIXED_H
  4. struct fixed_phy_status {
  5. int link;
  6. int speed;
  7. int duplex;
  8. int pause;
  9. int asym_pause;
  10. };
  11. struct device_node;
  12. struct gpio_desc;
  13. #if IS_ENABLED(CONFIG_FIXED_PHY)
  14. extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
  15. extern int fixed_phy_add(unsigned int irq, int phy_id,
  16. struct fixed_phy_status *status);
  17. extern struct phy_device *fixed_phy_register(unsigned int irq,
  18. struct fixed_phy_status *status,
  19. struct device_node *np);
  20. extern struct phy_device *
  21. fixed_phy_register_with_gpiod(unsigned int irq,
  22. struct fixed_phy_status *status,
  23. struct gpio_desc *gpiod);
  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. {
  32. return -ENODEV;
  33. }
  34. static inline struct phy_device *fixed_phy_register(unsigned int irq,
  35. struct fixed_phy_status *status,
  36. struct device_node *np)
  37. {
  38. return ERR_PTR(-ENODEV);
  39. }
  40. static inline struct phy_device *
  41. fixed_phy_register_with_gpiod(unsigned int irq,
  42. struct fixed_phy_status *status,
  43. struct gpio_desc *gpiod)
  44. {
  45. return ERR_PTR(-ENODEV);
  46. }
  47. static inline void fixed_phy_unregister(struct phy_device *phydev)
  48. {
  49. }
  50. static inline int fixed_phy_set_link_update(struct phy_device *phydev,
  51. int (*link_update)(struct net_device *,
  52. struct fixed_phy_status *))
  53. {
  54. return -ENODEV;
  55. }
  56. static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
  57. {
  58. return -EINVAL;
  59. }
  60. #endif /* CONFIG_FIXED_PHY */
  61. #endif /* __PHY_FIXED_H */