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

source code of linux/include/linux/of_net.h