xref: /linux/include/linux/of_net.h (revision b83deaa741558babf4b8d51d34f6637ccfff1b26)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * OF helpers for network devices.
4  */
5 
6 #ifndef __LINUX_OF_NET_H
7 #define __LINUX_OF_NET_H
8 
9 #include <linux/phy.h>
10 
11 #if defined(CONFIG_OF) && defined(CONFIG_NET)
12 #include <linux/of.h>
13 
14 struct net_device;
15 extern int of_get_phy_mode(struct device_node *np, phy_interface_t *interface);
16 extern int of_get_mac_address(struct device_node *np, u8 *mac);
17 int of_get_ethdev_address(struct device_node *np, struct net_device *dev);
18 extern struct net_device *of_find_net_device_by_node(struct device_node *np);
19 #else
20 static inline int of_get_phy_mode(struct device_node *np,
21 				  phy_interface_t *interface)
22 {
23 	return -ENODEV;
24 }
25 
26 static inline int of_get_mac_address(struct device_node *np, u8 *mac)
27 {
28 	return -ENODEV;
29 }
30 
31 static inline int of_get_ethdev_address(struct device_node *np, struct net_device *dev)
32 {
33 	return -ENODEV;
34 }
35 
36 static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
37 {
38 	return NULL;
39 }
40 #endif
41 
42 #endif /* __LINUX_OF_NET_H */
43