From d8d9600e12f49b89d2b1b8342dc9e224cc12be85 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 1 Jan 2016 19:40:30 +0100 Subject: [PATCH] eeprom: add support for overriding the mac address via OF Signed-off-by: Felix Fietkau --- eeprom.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eeprom.c b/eeprom.c index f4d7659f..1aa080bb 100644 --- a/eeprom.c +++ b/eeprom.c @@ -11,6 +11,7 @@ * GNU General Public License for more details. */ #include +#include #include #include #include @@ -77,6 +78,7 @@ mt76_eeprom_override(struct mt76_dev *dev) #ifdef CONFIG_OF struct device_node *np = dev->dev->of_node; const __be32 *val; + const u8 *mac; int size; if (!np) @@ -89,6 +91,10 @@ mt76_eeprom_override(struct mt76_dev *dev) val = of_get_property(np, "mediatek,5ghz", &size); if (val) dev->cap.has_5ghz = be32_to_cpup(val); + + mac = of_get_mac_address(np); + if (mac) + memcpy(dev->macaddr, mac, ETH_ALEN); #endif if (!is_valid_ether_addr(dev->macaddr)) {