1e87b5039SStanislaw Gruszka /* 2e87b5039SStanislaw Gruszka * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org> 3e87b5039SStanislaw Gruszka * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl> 4e87b5039SStanislaw Gruszka * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl> 5e87b5039SStanislaw Gruszka * 6e87b5039SStanislaw Gruszka * This program is free software; you can redistribute it and/or modify 7e87b5039SStanislaw Gruszka * it under the terms of the GNU General Public License version 2 8e87b5039SStanislaw Gruszka * as published by the Free Software Foundation 9e87b5039SStanislaw Gruszka * 10e87b5039SStanislaw Gruszka * This program is distributed in the hope that it will be useful, 11e87b5039SStanislaw Gruszka * but WITHOUT ANY WARRANTY; without even the implied warranty of 12e87b5039SStanislaw Gruszka * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13e87b5039SStanislaw Gruszka * GNU General Public License for more details. 14e87b5039SStanislaw Gruszka */ 15e87b5039SStanislaw Gruszka 16*db6bb5c6SFelix Fietkau #include <linux/module.h> 17e87b5039SStanislaw Gruszka #include <linux/of.h> 18e87b5039SStanislaw Gruszka #include <linux/mtd/mtd.h> 19e87b5039SStanislaw Gruszka #include <linux/mtd/partitions.h> 20e87b5039SStanislaw Gruszka #include <linux/etherdevice.h> 21e87b5039SStanislaw Gruszka #include <asm/unaligned.h> 22e87b5039SStanislaw Gruszka #include "mt76x0.h" 23e87b5039SStanislaw Gruszka #include "eeprom.h" 24b37bbc8cSLorenzo Bianconi #include "../mt76x02_phy.h" 25e87b5039SStanislaw Gruszka 2617ad18fdSKees Cook #define MT_MAP_READS DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16) 27e87b5039SStanislaw Gruszka static int 28e87b5039SStanislaw Gruszka mt76x0_efuse_physical_size_check(struct mt76x0_dev *dev) 29e87b5039SStanislaw Gruszka { 3017ad18fdSKees Cook u8 data[MT_MAP_READS * 16]; 31e87b5039SStanislaw Gruszka int ret, i; 32e87b5039SStanislaw Gruszka u32 start = 0, end = 0, cnt_free; 33e87b5039SStanislaw Gruszka 34bd724b8fSLorenzo Bianconi ret = mt76x02_get_efuse_data(&dev->mt76, MT_EE_USAGE_MAP_START, 35bd724b8fSLorenzo Bianconi data, sizeof(data), MT_EE_PHYSICAL_READ); 36e87b5039SStanislaw Gruszka if (ret) 37e87b5039SStanislaw Gruszka return ret; 38e87b5039SStanislaw Gruszka 39e87b5039SStanislaw Gruszka for (i = 0; i < MT_EFUSE_USAGE_MAP_SIZE; i++) 40e87b5039SStanislaw Gruszka if (!data[i]) { 41e87b5039SStanislaw Gruszka if (!start) 42e87b5039SStanislaw Gruszka start = MT_EE_USAGE_MAP_START + i; 43e87b5039SStanislaw Gruszka end = MT_EE_USAGE_MAP_START + i; 44e87b5039SStanislaw Gruszka } 45e87b5039SStanislaw Gruszka cnt_free = end - start + 1; 46e87b5039SStanislaw Gruszka 47e87b5039SStanislaw Gruszka if (MT_EFUSE_USAGE_MAP_SIZE - cnt_free < 5) { 48bd724b8fSLorenzo Bianconi dev_err(dev->mt76.dev, 49bd724b8fSLorenzo Bianconi "driver does not support default EEPROM\n"); 50e87b5039SStanislaw Gruszka return -EINVAL; 51e87b5039SStanislaw Gruszka } 52e87b5039SStanislaw Gruszka 53e87b5039SStanislaw Gruszka return 0; 54e87b5039SStanislaw Gruszka } 55e87b5039SStanislaw Gruszka 563d66939aSLorenzo Bianconi static void mt76x0_set_chip_cap(struct mt76x0_dev *dev) 57e87b5039SStanislaw Gruszka { 583d66939aSLorenzo Bianconi u16 nic_conf0 = mt76x02_eeprom_get(&dev->mt76, MT_EE_NIC_CONF_0); 593d66939aSLorenzo Bianconi u16 nic_conf1 = mt76x02_eeprom_get(&dev->mt76, MT_EE_NIC_CONF_1); 60e87b5039SStanislaw Gruszka 613d66939aSLorenzo Bianconi mt76x02_eeprom_parse_hw_cap(&dev->mt76); 623d66939aSLorenzo Bianconi dev_dbg(dev->mt76.dev, "2GHz %d 5GHz %d\n", 63540399d5SLorenzo Bianconi dev->mt76.cap.has_2ghz, dev->mt76.cap.has_5ghz); 64e87b5039SStanislaw Gruszka 6586c71d3dSLorenzo Bianconi if (!mt76x02_field_valid(nic_conf1 & 0xff)) 66e87b5039SStanislaw Gruszka nic_conf1 &= 0xff00; 67e87b5039SStanislaw Gruszka 68e87b5039SStanislaw Gruszka if (nic_conf1 & MT_EE_NIC_CONF_1_HW_RF_CTRL) 69e87b5039SStanislaw Gruszka dev_err(dev->mt76.dev, 703d66939aSLorenzo Bianconi "driver does not support HW RF ctrl\n"); 71e87b5039SStanislaw Gruszka 7286c71d3dSLorenzo Bianconi if (!mt76x02_field_valid(nic_conf0 >> 8)) 73e87b5039SStanislaw Gruszka return; 74e87b5039SStanislaw Gruszka 75e87b5039SStanislaw Gruszka if (FIELD_GET(MT_EE_NIC_CONF_0_RX_PATH, nic_conf0) > 1 || 76e87b5039SStanislaw Gruszka FIELD_GET(MT_EE_NIC_CONF_0_TX_PATH, nic_conf0) > 1) 773d66939aSLorenzo Bianconi dev_err(dev->mt76.dev, "invalid tx-rx stream\n"); 78e87b5039SStanislaw Gruszka } 79e87b5039SStanislaw Gruszka 802c0db839SLorenzo Bianconi static void mt76x0_set_temp_offset(struct mt76x0_dev *dev) 81e87b5039SStanislaw Gruszka { 822c0db839SLorenzo Bianconi u8 val; 83e87b5039SStanislaw Gruszka 842c0db839SLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, MT_EE_2G_TARGET_POWER) >> 8; 852c0db839SLorenzo Bianconi if (mt76x02_field_valid(val)) 862c0db839SLorenzo Bianconi dev->caldata.temp_offset = mt76x02_sign_extend(val, 8); 87e87b5039SStanislaw Gruszka else 882c0db839SLorenzo Bianconi dev->caldata.temp_offset = -10; 89e87b5039SStanislaw Gruszka } 90e87b5039SStanislaw Gruszka 9177d0f465SLorenzo Bianconi static void mt76x0_set_freq_offset(struct mt76x0_dev *dev) 92e87b5039SStanislaw Gruszka { 9377d0f465SLorenzo Bianconi struct mt76x0_caldata *caldata = &dev->caldata; 9477d0f465SLorenzo Bianconi u8 val; 95e87b5039SStanislaw Gruszka 9677d0f465SLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, MT_EE_FREQ_OFFSET); 9777d0f465SLorenzo Bianconi if (!mt76x02_field_valid(val)) 9877d0f465SLorenzo Bianconi val = 0; 9977d0f465SLorenzo Bianconi caldata->freq_offset = val; 10086c71d3dSLorenzo Bianconi 10177d0f465SLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, MT_EE_TSSI_BOUND4) >> 8; 10277d0f465SLorenzo Bianconi if (!mt76x02_field_valid(val)) 10377d0f465SLorenzo Bianconi val = 0; 104e87b5039SStanislaw Gruszka 10577d0f465SLorenzo Bianconi caldata->freq_offset -= mt76x02_sign_extend(val, 8); 106e87b5039SStanislaw Gruszka } 107e87b5039SStanislaw Gruszka 1082daa6758SLorenzo Bianconi void mt76x0_read_rx_gain(struct mt76x0_dev *dev) 109e87b5039SStanislaw Gruszka { 1102daa6758SLorenzo Bianconi struct ieee80211_channel *chan = dev->mt76.chandef.chan; 1112daa6758SLorenzo Bianconi struct mt76x0_caldata *caldata = &dev->caldata; 112564d7f0aSLorenzo Bianconi s8 val, lna_5g[3], lna_2g; 1132daa6758SLorenzo Bianconi u16 rssi_offset; 114564d7f0aSLorenzo Bianconi int i; 115e87b5039SStanislaw Gruszka 1162daa6758SLorenzo Bianconi mt76x02_get_rx_gain(&dev->mt76, chan->band, &rssi_offset, 1172daa6758SLorenzo Bianconi &lna_2g, lna_5g); 1182daa6758SLorenzo Bianconi caldata->lna_gain = mt76x02_get_lna_gain(&dev->mt76, &lna_2g, 1192daa6758SLorenzo Bianconi lna_5g, chan); 120e87b5039SStanislaw Gruszka 121564d7f0aSLorenzo Bianconi for (i = 0; i < ARRAY_SIZE(caldata->rssi_offset); i++) { 122564d7f0aSLorenzo Bianconi val = rssi_offset >> (8 * i); 123564d7f0aSLorenzo Bianconi if (val < -10 || val > 10) 124564d7f0aSLorenzo Bianconi val = 0; 125e87b5039SStanislaw Gruszka 126564d7f0aSLorenzo Bianconi caldata->rssi_offset[i] = val; 127e87b5039SStanislaw Gruszka } 128e87b5039SStanislaw Gruszka } 129e87b5039SStanislaw Gruszka 130b37bbc8cSLorenzo Bianconi static s8 mt76x0_get_delta(struct mt76_dev *dev) 131e87b5039SStanislaw Gruszka { 132b37bbc8cSLorenzo Bianconi struct cfg80211_chan_def *chandef = &dev->chandef; 133b37bbc8cSLorenzo Bianconi u8 val; 134e87b5039SStanislaw Gruszka 135b37bbc8cSLorenzo Bianconi if (mt76x02_tssi_enabled(dev)) 136e87b5039SStanislaw Gruszka return 0; 137e87b5039SStanislaw Gruszka 138b37bbc8cSLorenzo Bianconi if (chandef->width == NL80211_CHAN_WIDTH_80) { 139b37bbc8cSLorenzo Bianconi val = mt76x02_eeprom_get(dev, MT_EE_5G_TARGET_POWER) >> 8; 140b37bbc8cSLorenzo Bianconi } else if (chandef->width == NL80211_CHAN_WIDTH_40) { 141b37bbc8cSLorenzo Bianconi u16 data; 142e87b5039SStanislaw Gruszka 143b37bbc8cSLorenzo Bianconi data = mt76x02_eeprom_get(dev, MT_EE_TX_POWER_DELTA_BW40); 144b37bbc8cSLorenzo Bianconi if (chandef->chan->band == NL80211_BAND_5GHZ) 145b37bbc8cSLorenzo Bianconi val = data >> 8; 146b37bbc8cSLorenzo Bianconi else 147b37bbc8cSLorenzo Bianconi val = data; 148b37bbc8cSLorenzo Bianconi } else { 149b37bbc8cSLorenzo Bianconi return 0; 150e87b5039SStanislaw Gruszka } 151e87b5039SStanislaw Gruszka 152b37bbc8cSLorenzo Bianconi return mt76x02_rate_power_val(val); 153b37bbc8cSLorenzo Bianconi } 154b37bbc8cSLorenzo Bianconi 155b37bbc8cSLorenzo Bianconi void mt76x0_get_tx_power_per_rate(struct mt76x0_dev *dev) 156e87b5039SStanislaw Gruszka { 157b37bbc8cSLorenzo Bianconi struct ieee80211_channel *chan = dev->mt76.chandef.chan; 158b37bbc8cSLorenzo Bianconi bool is_2ghz = chan->band == NL80211_BAND_2GHZ; 159b37bbc8cSLorenzo Bianconi struct mt76_rate_power *t = &dev->mt76.rate_power; 160b37bbc8cSLorenzo Bianconi s8 delta = mt76x0_get_delta(&dev->mt76); 161b37bbc8cSLorenzo Bianconi u16 val, addr; 162e87b5039SStanislaw Gruszka 163b37bbc8cSLorenzo Bianconi memset(t, 0, sizeof(*t)); 164e87b5039SStanislaw Gruszka 165b37bbc8cSLorenzo Bianconi /* cck 1M, 2M, 5.5M, 11M */ 166b37bbc8cSLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, MT_EE_TX_POWER_BYRATE_BASE); 167b37bbc8cSLorenzo Bianconi t->cck[0] = t->cck[1] = s6_to_s8(val); 168b37bbc8cSLorenzo Bianconi t->cck[2] = t->cck[3] = s6_to_s8(val >> 8); 169e87b5039SStanislaw Gruszka 170b37bbc8cSLorenzo Bianconi /* ofdm 6M, 9M, 12M, 18M */ 171b37bbc8cSLorenzo Bianconi addr = is_2ghz ? MT_EE_TX_POWER_BYRATE_BASE + 2 : 0x120; 172b37bbc8cSLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, addr); 173b37bbc8cSLorenzo Bianconi t->ofdm[0] = t->ofdm[1] = s6_to_s8(val); 174b37bbc8cSLorenzo Bianconi t->ofdm[2] = t->ofdm[3] = s6_to_s8(val >> 8); 175e87b5039SStanislaw Gruszka 176b37bbc8cSLorenzo Bianconi /* ofdm 24M, 36M, 48M, 54M */ 177b37bbc8cSLorenzo Bianconi addr = is_2ghz ? MT_EE_TX_POWER_BYRATE_BASE + 4 : 0x122; 178b37bbc8cSLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, addr); 179b37bbc8cSLorenzo Bianconi t->ofdm[4] = t->ofdm[5] = s6_to_s8(val); 180b37bbc8cSLorenzo Bianconi t->ofdm[6] = t->ofdm[7] = s6_to_s8(val >> 8); 181e87b5039SStanislaw Gruszka 182b37bbc8cSLorenzo Bianconi /* ht-vht mcs 1ss 0, 1, 2, 3 */ 183b37bbc8cSLorenzo Bianconi addr = is_2ghz ? MT_EE_TX_POWER_BYRATE_BASE + 6 : 0x124; 184b37bbc8cSLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, addr); 185b37bbc8cSLorenzo Bianconi t->ht[0] = t->ht[1] = t->vht[0] = t->vht[1] = s6_to_s8(val); 186b37bbc8cSLorenzo Bianconi t->ht[2] = t->ht[3] = t->vht[2] = t->vht[3] = s6_to_s8(val >> 8); 187e87b5039SStanislaw Gruszka 188b37bbc8cSLorenzo Bianconi /* ht-vht mcs 1ss 4, 5, 6 */ 189b37bbc8cSLorenzo Bianconi addr = is_2ghz ? MT_EE_TX_POWER_BYRATE_BASE + 8 : 0x126; 190b37bbc8cSLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, addr); 191b37bbc8cSLorenzo Bianconi t->ht[4] = t->ht[5] = t->vht[4] = t->vht[5] = s6_to_s8(val); 192b37bbc8cSLorenzo Bianconi t->ht[6] = t->vht[6] = s6_to_s8(val >> 8); 193e87b5039SStanislaw Gruszka 194b37bbc8cSLorenzo Bianconi /* ht-vht mcs 1ss 0, 1, 2, 3 stbc */ 195b37bbc8cSLorenzo Bianconi addr = is_2ghz ? MT_EE_TX_POWER_BYRATE_BASE + 14 : 0xec; 196b37bbc8cSLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, addr); 197b37bbc8cSLorenzo Bianconi t->stbc[0] = t->stbc[1] = s6_to_s8(val); 198b37bbc8cSLorenzo Bianconi t->stbc[2] = t->stbc[3] = s6_to_s8(val >> 8); 199e87b5039SStanislaw Gruszka 200b37bbc8cSLorenzo Bianconi /* ht-vht mcs 1ss 4, 5, 6 stbc */ 201b37bbc8cSLorenzo Bianconi addr = is_2ghz ? MT_EE_TX_POWER_BYRATE_BASE + 16 : 0xee; 202b37bbc8cSLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, addr); 203b37bbc8cSLorenzo Bianconi t->stbc[4] = t->stbc[5] = s6_to_s8(val); 204b37bbc8cSLorenzo Bianconi t->stbc[6] = t->stbc[7] = s6_to_s8(val >> 8); 205e87b5039SStanislaw Gruszka 206b37bbc8cSLorenzo Bianconi /* vht mcs 8, 9 5GHz */ 207b37bbc8cSLorenzo Bianconi val = mt76x02_eeprom_get(&dev->mt76, 0x132); 208b37bbc8cSLorenzo Bianconi t->vht[7] = s6_to_s8(val); 209b37bbc8cSLorenzo Bianconi t->vht[8] = s6_to_s8(val >> 8); 210b37bbc8cSLorenzo Bianconi 211b37bbc8cSLorenzo Bianconi mt76x02_add_rate_power_offset(t, delta); 212e87b5039SStanislaw Gruszka } 213e87b5039SStanislaw Gruszka 214f2a2e819SLorenzo Bianconi void mt76x0_get_power_info(struct mt76x0_dev *dev, u8 *info) 215e87b5039SStanislaw Gruszka { 216f2a2e819SLorenzo Bianconi struct mt76x0_chan_map { 217f2a2e819SLorenzo Bianconi u8 chan; 218f2a2e819SLorenzo Bianconi u8 offset; 219f2a2e819SLorenzo Bianconi } chan_map[] = { 220f2a2e819SLorenzo Bianconi { 2, 0 }, { 4, 1 }, { 6, 2 }, { 8, 3 }, 221f2a2e819SLorenzo Bianconi { 10, 4 }, { 12, 5 }, { 14, 6 }, { 38, 0 }, 222f2a2e819SLorenzo Bianconi { 44, 1 }, { 48, 2 }, { 54, 3 }, { 60, 4 }, 223f2a2e819SLorenzo Bianconi { 64, 5 }, { 102, 6 }, { 108, 7 }, { 112, 8 }, 224f2a2e819SLorenzo Bianconi { 118, 9 }, { 124, 10 }, { 128, 11 }, { 134, 12 }, 225f2a2e819SLorenzo Bianconi { 140, 13 }, { 151, 14 }, { 157, 15 }, { 161, 16 }, 226f2a2e819SLorenzo Bianconi { 167, 17 }, { 171, 18 }, { 173, 19 }, 227f2a2e819SLorenzo Bianconi }; 228f2a2e819SLorenzo Bianconi struct ieee80211_channel *chan = dev->mt76.chandef.chan; 229f2a2e819SLorenzo Bianconi u8 offset, addr; 230f2a2e819SLorenzo Bianconi u16 data; 231e87b5039SStanislaw Gruszka int i; 232e87b5039SStanislaw Gruszka 233f2a2e819SLorenzo Bianconi for (i = 0; i < ARRAY_SIZE(chan_map); i++) { 234f2a2e819SLorenzo Bianconi if (chan_map[i].chan <= chan->hw_value) { 235f2a2e819SLorenzo Bianconi offset = chan_map[i].offset; 236f2a2e819SLorenzo Bianconi break; 237f2a2e819SLorenzo Bianconi } 238f2a2e819SLorenzo Bianconi } 239f2a2e819SLorenzo Bianconi if (i == ARRAY_SIZE(chan_map)) 240f2a2e819SLorenzo Bianconi offset = chan_map[0].offset; 241f2a2e819SLorenzo Bianconi 242f2a2e819SLorenzo Bianconi if (chan->band == NL80211_BAND_2GHZ) { 243f2a2e819SLorenzo Bianconi addr = MT_EE_TX_POWER_DELTA_BW80 + offset; 244f2a2e819SLorenzo Bianconi } else { 245f2a2e819SLorenzo Bianconi switch (chan->hw_value) { 246f2a2e819SLorenzo Bianconi case 58: 247f2a2e819SLorenzo Bianconi offset = 8; 248f2a2e819SLorenzo Bianconi break; 249f2a2e819SLorenzo Bianconi case 106: 250f2a2e819SLorenzo Bianconi offset = 14; 251f2a2e819SLorenzo Bianconi break; 252f2a2e819SLorenzo Bianconi case 112: 253f2a2e819SLorenzo Bianconi offset = 20; 254f2a2e819SLorenzo Bianconi break; 255f2a2e819SLorenzo Bianconi case 155: 256f2a2e819SLorenzo Bianconi offset = 30; 257f2a2e819SLorenzo Bianconi break; 258f2a2e819SLorenzo Bianconi default: 259f2a2e819SLorenzo Bianconi break; 260f2a2e819SLorenzo Bianconi } 261f2a2e819SLorenzo Bianconi addr = MT_EE_TX_POWER_0_GRP4_TSSI_SLOPE + 2 + offset; 262e87b5039SStanislaw Gruszka } 263e87b5039SStanislaw Gruszka 264f2a2e819SLorenzo Bianconi data = mt76x02_eeprom_get(&dev->mt76, addr); 265f2a2e819SLorenzo Bianconi 266f2a2e819SLorenzo Bianconi info[0] = data; 267f2a2e819SLorenzo Bianconi if (!info[0] || info[0] > 0x3f) 268f2a2e819SLorenzo Bianconi info[0] = 5; 269f2a2e819SLorenzo Bianconi 270f2a2e819SLorenzo Bianconi info[1] = data >> 8; 271f2a2e819SLorenzo Bianconi if (!info[1] || info[1] > 0x3f) 272f2a2e819SLorenzo Bianconi info[1] = 5; 273e87b5039SStanislaw Gruszka } 274e87b5039SStanislaw Gruszka 275f2a2e819SLorenzo Bianconi int mt76x0_eeprom_init(struct mt76x0_dev *dev) 276e87b5039SStanislaw Gruszka { 277f2a2e819SLorenzo Bianconi u8 version, fae; 278f2a2e819SLorenzo Bianconi u16 data; 279bd724b8fSLorenzo Bianconi int ret; 280e87b5039SStanislaw Gruszka 281e87b5039SStanislaw Gruszka ret = mt76x0_efuse_physical_size_check(dev); 282e87b5039SStanislaw Gruszka if (ret) 283e87b5039SStanislaw Gruszka return ret; 284e87b5039SStanislaw Gruszka 285443569a5SLorenzo Bianconi ret = mt76_eeprom_init(&dev->mt76, MT76X0_EEPROM_SIZE); 286443569a5SLorenzo Bianconi if (ret < 0) 287443569a5SLorenzo Bianconi return ret; 288443569a5SLorenzo Bianconi 289f2a2e819SLorenzo Bianconi ret = mt76x02_get_efuse_data(&dev->mt76, 0, dev->mt76.eeprom.data, 290bd724b8fSLorenzo Bianconi MT76X0_EEPROM_SIZE, MT_EE_READ); 291e87b5039SStanislaw Gruszka if (ret) 292f2a2e819SLorenzo Bianconi return ret; 293e87b5039SStanislaw Gruszka 294f2a2e819SLorenzo Bianconi data = mt76x02_eeprom_get(&dev->mt76, MT_EE_VERSION); 295f2a2e819SLorenzo Bianconi version = data >> 8; 296f2a2e819SLorenzo Bianconi fae = data; 297f2a2e819SLorenzo Bianconi 298f2a2e819SLorenzo Bianconi if (version > MT76X0U_EE_MAX_VER) 299e87b5039SStanislaw Gruszka dev_warn(dev->mt76.dev, 300e87b5039SStanislaw Gruszka "Warning: unsupported EEPROM version %02hhx\n", 301f2a2e819SLorenzo Bianconi version); 302e87b5039SStanislaw Gruszka dev_info(dev->mt76.dev, "EEPROM ver:%02hhx fae:%02hhx\n", 303f2a2e819SLorenzo Bianconi version, fae); 304e87b5039SStanislaw Gruszka 305f2a2e819SLorenzo Bianconi mt76x02_mac_setaddr(&dev->mt76, 306f2a2e819SLorenzo Bianconi dev->mt76.eeprom.data + MT_EE_MAC_ADDR); 3073d66939aSLorenzo Bianconi mt76x0_set_chip_cap(dev); 30877d0f465SLorenzo Bianconi mt76x0_set_freq_offset(dev); 3092c0db839SLorenzo Bianconi mt76x0_set_temp_offset(dev); 310f2a2e819SLorenzo Bianconi 311e87b5039SStanislaw Gruszka dev->chainmask = 0x0101; 312e87b5039SStanislaw Gruszka 313f2a2e819SLorenzo Bianconi return 0; 314e87b5039SStanislaw Gruszka } 315c2a4d9fbSStanislaw Gruszka 316c2a4d9fbSStanislaw Gruszka MODULE_LICENSE("Dual BSD/GPL"); 317