diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-06-19 05:45:14 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-22 07:13:41 +0200 |
commit | 63fd2b318ea3866c46bd4f85b4a64a269512db35 (patch) | |
tree | 7bf734f70d32a74d80b2253978ca1b112d2407b9 /include/of_net.h | |
parent | 33be33ea617514df622a2a468b426e8a628c87e8 (diff) | |
download | barebox-63fd2b318ea3866c46bd4f85b4a64a269512db35.tar.gz barebox-63fd2b318ea3866c46bd4f85b4a64a269512db35.tar.xz |
of: of_net: sync of_get_mac_address with Linux for NVMEM support
We don't use of_get_mac_address anywhere, but it can come in handy as a
last resort before barebox generates a random MAC address. With the
existing implementation, that MAC address is written literally into the
DT, so it's mainly useful when barebox is booted with an external device
tree. The kernel implementation adds support for parsing the MAC address
out of a revered mac-address nvmem cell, which is much more prevalent.
Sync the implementation with Linux v5.13 in preparation for using it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210619034516.6737-12-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/of_net.h')
-rw-r--r-- | include/of_net.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/include/of_net.h b/include/of_net.h index f37af58303..4e23deb28e 100644 --- a/include/of_net.h +++ b/include/of_net.h @@ -6,8 +6,27 @@ #ifndef __LINUX_OF_NET_H #define __LINUX_OF_NET_H +#include <linux/types.h> #include <of.h> + +#ifdef CONFIG_OFTREE +int of_get_mac_addr_nvmem(struct device_node *np, u8 *addr); +int of_get_mac_address(struct device_node *np, u8 *addr); int of_get_phy_mode(struct device_node *np); -const void *of_get_mac_address(struct device_node *np); +#else +static inline int of_get_mac_addr_nvmem(struct device_node *np, u8 *addr) +{ + return -ENOSYS; +} +static inline int of_get_mac_address(struct device_node *np, u8 *addr) +{ + return -ENOSYS; +} + +static inline int of_get_phy_mode(struct device_node *np) +{ + return -ENOSYS; +} +#endif #endif /* __LINUX_OF_NET_H */ |