155716d26SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
24b6ba8aaSDavid Daney /*
34b6ba8aaSDavid Daney * OF helpers for network devices.
44b6ba8aaSDavid Daney */
54b6ba8aaSDavid Daney
64b6ba8aaSDavid Daney #ifndef __LINUX_OF_NET_H
74b6ba8aaSDavid Daney #define __LINUX_OF_NET_H
84b6ba8aaSDavid Daney
90c65b2b9SAndrew Lunn #include <linux/phy.h>
100c65b2b9SAndrew Lunn
118b017fbeSArnd Bergmann #if defined(CONFIG_OF) && defined(CONFIG_NET)
124b6ba8aaSDavid Daney #include <linux/of.h>
13aa836df9SFlorian Fainelli
14aa836df9SFlorian Fainelli struct net_device;
150c65b2b9SAndrew Lunn extern int of_get_phy_mode(struct device_node *np, phy_interface_t *interface);
1683216e39SMichael Walle extern int of_get_mac_address(struct device_node *np, u8 *mac);
17*4c47867bSMiquel Raynal extern int of_get_mac_address_nvmem(struct device_node *np, u8 *mac);
18d466effeSJakub Kicinski int of_get_ethdev_address(struct device_node *np, struct net_device *dev);
19aa836df9SFlorian Fainelli extern struct net_device *of_find_net_device_by_node(struct device_node *np);
2065b3841bSGuenter Roeck #else
of_get_phy_mode(struct device_node * np,phy_interface_t * interface)210c65b2b9SAndrew Lunn static inline int of_get_phy_mode(struct device_node *np,
220c65b2b9SAndrew Lunn phy_interface_t *interface)
2365b3841bSGuenter Roeck {
2465b3841bSGuenter Roeck return -ENODEV;
2565b3841bSGuenter Roeck }
2665b3841bSGuenter Roeck
of_get_mac_address(struct device_node * np,u8 * mac)2783216e39SMichael Walle static inline int of_get_mac_address(struct device_node *np, u8 *mac)
2865b3841bSGuenter Roeck {
2983216e39SMichael Walle return -ENODEV;
3065b3841bSGuenter Roeck }
31aa836df9SFlorian Fainelli
of_get_mac_address_nvmem(struct device_node * np,u8 * mac)32*4c47867bSMiquel Raynal static inline int of_get_mac_address_nvmem(struct device_node *np, u8 *mac)
33*4c47867bSMiquel Raynal {
34*4c47867bSMiquel Raynal return -ENODEV;
35*4c47867bSMiquel Raynal }
36*4c47867bSMiquel Raynal
of_get_ethdev_address(struct device_node * np,struct net_device * dev)37d466effeSJakub Kicinski static inline int of_get_ethdev_address(struct device_node *np, struct net_device *dev)
38d466effeSJakub Kicinski {
39d466effeSJakub Kicinski return -ENODEV;
40d466effeSJakub Kicinski }
41d466effeSJakub Kicinski
of_find_net_device_by_node(struct device_node * np)42aa836df9SFlorian Fainelli static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
43aa836df9SFlorian Fainelli {
44aa836df9SFlorian Fainelli return NULL;
45aa836df9SFlorian Fainelli }
464b6ba8aaSDavid Daney #endif
474b6ba8aaSDavid Daney
484b6ba8aaSDavid Daney #endif /* __LINUX_OF_NET_H */
49