mirror of
https://github.com/torvalds/linux.git
synced 2024-11-13 15:41:39 +00:00
mt76: mt7615: read {tx,rx} mask from eeprom
Parse configured {tx,rx} mask from eeprom data instead of just setting it to four tx-rx streams Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
e49c76d455
commit
acf5457fd9
@ -93,6 +93,7 @@ static int mt7615_check_eeprom(struct mt76_dev *dev)
|
|||||||
static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
|
static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
|
||||||
{
|
{
|
||||||
u8 val, *eeprom = dev->mt76.eeprom.data;
|
u8 val, *eeprom = dev->mt76.eeprom.data;
|
||||||
|
u8 tx_mask, rx_mask, max_nss;
|
||||||
|
|
||||||
val = FIELD_GET(MT_EE_NIC_WIFI_CONF_BAND_SEL,
|
val = FIELD_GET(MT_EE_NIC_WIFI_CONF_BAND_SEL,
|
||||||
eeprom[MT_EE_WIFI_CONF]);
|
eeprom[MT_EE_WIFI_CONF]);
|
||||||
@ -108,6 +109,23 @@ static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
|
|||||||
dev->mt76.cap.has_5ghz = true;
|
dev->mt76.cap.has_5ghz = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* read tx-rx mask from eeprom */
|
||||||
|
val = mt76_rr(dev, MT_TOP_STRAP_STA);
|
||||||
|
max_nss = val & MT_TOP_3NSS ? 3 : 4;
|
||||||
|
|
||||||
|
rx_mask = FIELD_GET(MT_EE_NIC_CONF_RX_MASK,
|
||||||
|
eeprom[MT_EE_NIC_CONF_0]);
|
||||||
|
if (!rx_mask || rx_mask > max_nss)
|
||||||
|
rx_mask = max_nss;
|
||||||
|
|
||||||
|
tx_mask = FIELD_GET(MT_EE_NIC_CONF_TX_MASK,
|
||||||
|
eeprom[MT_EE_NIC_CONF_0]);
|
||||||
|
if (!tx_mask || tx_mask > max_nss)
|
||||||
|
tx_mask = max_nss;
|
||||||
|
|
||||||
|
dev->mt76.chainmask = tx_mask << 8 | rx_mask;
|
||||||
|
dev->mt76.antenna_mask = BIT(tx_mask) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mt7615_eeprom_get_power_index(struct mt7615_dev *dev,
|
int mt7615_eeprom_get_power_index(struct mt7615_dev *dev,
|
||||||
|
@ -24,6 +24,9 @@ enum mt7615_eeprom_field {
|
|||||||
__MT_EE_MAX = 0x3bf
|
__MT_EE_MAX = 0x3bf
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MT_EE_NIC_CONF_TX_MASK GENMASK(7, 4)
|
||||||
|
#define MT_EE_NIC_CONF_RX_MASK GENMASK(3, 0)
|
||||||
|
|
||||||
#define MT_EE_NIC_CONF_TSSI_2G BIT(5)
|
#define MT_EE_NIC_CONF_TSSI_2G BIT(5)
|
||||||
#define MT_EE_NIC_CONF_TSSI_5G BIT(6)
|
#define MT_EE_NIC_CONF_TSSI_5G BIT(6)
|
||||||
|
|
||||||
|
@ -303,8 +303,6 @@ int mt7615_register_device(struct mt7615_dev *dev)
|
|||||||
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
|
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
|
||||||
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
|
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
|
||||||
IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
|
IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
|
||||||
dev->mt76.chainmask = 0x404;
|
|
||||||
dev->mt76.antenna_mask = 0xf;
|
|
||||||
dev->dfs_state = -1;
|
dev->dfs_state = -1;
|
||||||
|
|
||||||
ret = mt76_register_device(&dev->mt76, true, mt7615_rates,
|
ret = mt76_register_device(&dev->mt76, true, mt7615_rates,
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#define MT_HW_REV 0x1000
|
#define MT_HW_REV 0x1000
|
||||||
#define MT_HW_CHIPID 0x1008
|
#define MT_HW_CHIPID 0x1008
|
||||||
|
#define MT_TOP_STRAP_STA 0x1010
|
||||||
|
#define MT_TOP_3NSS BIT(24)
|
||||||
#define MT_TOP_MISC2 0x1134
|
#define MT_TOP_MISC2 0x1134
|
||||||
#define MT_TOP_MISC2_FW_STATE GENMASK(2, 0)
|
#define MT_TOP_MISC2_FW_STATE GENMASK(2, 0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user