phy_fixed.h 1.8 KB

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