summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2019-11-23 23:42:22 +0100
committerKalle Valo <kvalo@codeaurora.org>2019-12-02 15:49:05 +0100
commit693d060536abca7b16d2fb8e66aa56be2a2443a2 (patch)
tree150cc5c15955c94767f42a1c9a52c16e83943f2c /drivers
parentath9k: use iowrite32 over __raw_writel (diff)
downloadlinux-693d060536abca7b16d2fb8e66aa56be2a2443a2.tar.xz
linux-693d060536abca7b16d2fb8e66aa56be2a2443a2.zip
mt76: mt76x0: fix default mac address overwrite
Current implementation always use default eeprom mac address to configure device registers even if it is updated using mt76_eeprom_override. Fix it initializing macaddr filed of mt76_dev data structure with eeprom mac address and running mt76_eeprom_override before mt76x02_mac_setaddr Fixes: d1bc9bf2072c ("mt76: mt76x0: eeprom: add support for MAC address from OF") Tested-by: Kevin Schmidt <kevin.patrick.schmidt@googlemail.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
index a03e2d01fba7..d1405528b504 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
@@ -342,8 +342,11 @@ int mt76x0_eeprom_init(struct mt76x02_dev *dev)
dev_info(dev->mt76.dev, "EEPROM ver:%02hhx fae:%02hhx\n",
version, fae);
- mt76x02_mac_setaddr(dev, dev->mt76.eeprom.data + MT_EE_MAC_ADDR);
+ memcpy(dev->mt76.macaddr, (u8 *)dev->mt76.eeprom.data + MT_EE_MAC_ADDR,
+ ETH_ALEN);
mt76_eeprom_override(&dev->mt76);
+ mt76x02_mac_setaddr(dev, dev->mt76.macaddr);
+
mt76x0_set_chip_cap(dev);
mt76x0_set_freq_offset(dev);
mt76x0_set_temp_offset(dev);