mt76x2: clean up MAC/BSSID address initialization

Drop the use of the EEPROM address entirely, rely on interface address
only

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2017-12-07 19:51:01 +01:00
parent 170f3341c6
commit 3563b8fd0a
2 changed files with 18 additions and 7 deletions
+4 -7
View File
@@ -231,7 +231,6 @@ mt76x2_init_beacon_offsets(struct mt76x2_dev *dev)
int mt76x2_mac_reset(struct mt76x2_dev *dev, bool hard)
{
static const u8 null_addr[ETH_ALEN] = {};
const u8 *macaddr = dev->mt76.macaddr;
u32 val;
int i, k;
@@ -271,13 +270,11 @@ int mt76x2_mac_reset(struct mt76x2_dev *dev, bool hard)
mt76_wr(dev, MT_MCU_CLOCK_CTL, 0x1401);
mt76_clear(dev, MT_FCE_L2_STUFF, MT_FCE_L2_STUFF_WR_MPDU_LEN_EN);
mt76_wr(dev, MT_MAC_ADDR_DW0, get_unaligned_le32(macaddr));
mt76_wr(dev, MT_MAC_ADDR_DW1, get_unaligned_le16(macaddr + 4));
mt76_wr(dev, MT_MAC_ADDR_DW0, 0);
mt76_wr(dev, MT_MAC_ADDR_DW1, 0);
mt76_wr(dev, MT_MAC_BSSID_DW0, get_unaligned_le32(macaddr));
mt76_wr(dev, MT_MAC_BSSID_DW1, get_unaligned_le16(macaddr + 4) |
FIELD_PREP(MT_MAC_BSSID_DW1_MBSS_MODE, 3) | /* 8 beacons */
MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT);
mt76_wr(dev, MT_MAC_BSSID_DW0, 0);
mt76_wr(dev, MT_MAC_BSSID_DW1, 0);
mt76_set(dev, MT_MAC_ADDR_EXT_CTL, MT_MAC_ADDR_EXT_CTL_EN);
+14
View File
@@ -27,6 +27,15 @@ void mt76x2_mac_set_bssid(struct mt76x2_dev *dev, u8 idx, const u8 *addr)
if (addr) {
lo = get_unaligned_le32(addr);
hi = get_unaligned_le16(addr + 4);
if (!idx) {
mt76_wr(dev, MT_MAC_BSSID_DW0, lo);
mt76_rmw_field(dev, MT_MAC_BSSID_DW1,
MT_MAC_BSSID_DW1_ADDR,
hi);
}
hi |= MT_MAC_APC_BSSID0_H_EN;
}
@@ -41,6 +50,11 @@ void mt76x2_mac_set_ext_mac(struct mt76x2_dev *dev, u8 idx, const u8 *addr)
if (addr) {
lo = get_unaligned_le32(addr);
hi = get_unaligned_le16(addr + 4);
if (!idx) {
mt76_wr(dev, MT_MAC_ADDR_DW0, lo);
mt76_wr(dev, MT_MAC_ADDR_DW1, hi);
}
}
mt76_wr(dev, MT_MAC_ADDR_EXT_L(idx), lo);