of_net.h 1009 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #if defined(CONFIG_OF) && defined(CONFIG_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 int of_get_mac_address(struct device_node *np, u8 *mac);
  13. int of_get_ethdev_address(struct device_node *np, struct net_device *dev);
  14. extern struct net_device *of_find_net_device_by_node(struct device_node *np);
  15. #else
  16. static inline int of_get_phy_mode(struct device_node *np,
  17. phy_interface_t *interface)
  18. {
  19. return -ENODEV;
  20. }
  21. static inline int of_get_mac_address(struct device_node *np, u8 *mac)
  22. {
  23. return -ENODEV;
  24. }
  25. static inline int of_get_ethdev_address(struct device_node *np, struct net_device *dev)
  26. {
  27. return -ENODEV;
  28. }
  29. static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
  30. {
  31. return NULL;
  32. }
  33. #endif
  34. #endif /* __LINUX_OF_NET_H */