of_net.h 806 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * OF helpers for network devices.
  4. */
  5. #ifndef __LINUX_OF_NET_H
  6. #define __LINUX_OF_NET_H
  7. #include <linux/phy.h>
  8. #ifdef CONFIG_OF_NET
  9. #include <linux/of.h>
  10. struct net_device;
  11. extern int of_get_phy_mode(struct device_node *np, phy_interface_t *interface);
  12. extern const void *of_get_mac_address(struct device_node *np);
  13. extern struct net_device *of_find_net_device_by_node(struct device_node *np);
  14. #else
  15. static inline int of_get_phy_mode(struct device_node *np,
  16. phy_interface_t *interface)
  17. {
  18. return -ENODEV;
  19. }
  20. static inline const void *of_get_mac_address(struct device_node *np)
  21. {
  22. return ERR_PTR(-ENODEV);
  23. }
  24. static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
  25. {
  26. return NULL;
  27. }
  28. #endif
  29. #endif /* __LINUX_OF_NET_H */