From b3d00246a5de02f483e1db785ee258200dc9a552 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 16 Dec 2015 17:26:52 +0100 Subject: [PATCH] mt7603: extract mac address from eeprom Signed-off-by: Felix Fietkau --- mt7603.h | 1 + mt7603_init.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mt7603.h b/mt7603.h index a33ae961..d5f97ec6 100644 --- a/mt7603.h +++ b/mt7603.h @@ -75,6 +75,7 @@ struct mt7603_dev { u8 tx_chains; u8 rssi_offset[3]; + u8 macaddr[ETH_ALEN]; struct mt7603_mcu mcu; struct mt76_queue q_rx; diff --git a/mt7603_init.c b/mt7603_init.c index 45b07929..39fad5e1 100644 --- a/mt7603_init.c +++ b/mt7603_init.c @@ -14,6 +14,7 @@ #include #include "mt7603.h" #include "mt7603_dma.h" +#include "mt7603_eeprom.h" struct mt7603_dev *mt7603_alloc_device(struct device *pdev) { @@ -223,6 +224,7 @@ mt7603_init_hardware(struct mt7603_dev *dev) return ret; dev->mt76.cap.has_2ghz = true; + memcpy(dev->macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR, ETH_ALEN); ret = mt7603_dma_init(dev); if (ret) @@ -278,7 +280,6 @@ static struct ieee80211_rate mt7603_rates[] = { int mt7603_register_device(struct mt7603_dev *dev) { - static u8 macaddr[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; struct ieee80211_hw *hw = mt76_hw(dev); struct ieee80211_supported_band *sband; struct wiphy *wiphy = hw->wiphy; @@ -299,7 +300,7 @@ int mt7603_register_device(struct mt7603_dev *dev) hw->max_rate_tries = 1; hw->extra_tx_headroom = 2; - SET_IEEE80211_PERM_ADDR(hw, macaddr); + SET_IEEE80211_PERM_ADDR(hw, dev->macaddr); ret = mt76_register_device(&dev->mt76, true, mt7603_rates, ARRAY_SIZE(mt7603_rates));