mt76: mt7603: check for single-stream EEPROM configuration
Some devices using MT7628 or MT7603 have only one antenna chain connected. Detect these using the EEPROM rx/tx path settings Reported-by: Qin Wei <me@vonger.cn> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
2d68104742
commit
d407afcbd6
|
@ -147,8 +147,14 @@ static int mt7603_check_eeprom(struct mt76_dev *dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool is_mt7688(struct mt7603_dev *dev)
|
||||||
|
{
|
||||||
|
return mt76_rr(dev, MT_EFUSE_BASE + 0x64) & BIT(4);
|
||||||
|
}
|
||||||
|
|
||||||
int mt7603_eeprom_init(struct mt7603_dev *dev)
|
int mt7603_eeprom_init(struct mt7603_dev *dev)
|
||||||
{
|
{
|
||||||
|
u8 *eeprom;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = mt7603_eeprom_load(dev);
|
ret = mt7603_eeprom_load(dev);
|
||||||
|
@ -163,9 +169,16 @@ int mt7603_eeprom_init(struct mt7603_dev *dev)
|
||||||
MT7603_EEPROM_SIZE);
|
MT7603_EEPROM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eeprom = (u8 *)dev->mt76.eeprom.data;
|
||||||
dev->mt76.cap.has_2ghz = true;
|
dev->mt76.cap.has_2ghz = true;
|
||||||
memcpy(dev->mt76.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR,
|
memcpy(dev->mt76.macaddr, eeprom + MT_EE_MAC_ADDR, ETH_ALEN);
|
||||||
ETH_ALEN);
|
|
||||||
|
/* Check for 1SS devices */
|
||||||
|
dev->mphy.antenna_mask = 3;
|
||||||
|
if (FIELD_GET(MT_EE_NIC_CONF_0_RX_PATH, eeprom[MT_EE_NIC_CONF_0]) == 1 ||
|
||||||
|
FIELD_GET(MT_EE_NIC_CONF_0_TX_PATH, eeprom[MT_EE_NIC_CONF_0]) == 1 ||
|
||||||
|
is_mt7688(dev))
|
||||||
|
dev->mphy.antenna_mask = 1;
|
||||||
|
|
||||||
mt76_eeprom_override(&dev->mt76);
|
mt76_eeprom_override(&dev->mt76);
|
||||||
|
|
||||||
|
|
|
@ -85,4 +85,7 @@ enum mt7603_eeprom_source {
|
||||||
MT_EE_SRC_FLASH,
|
MT_EE_SRC_FLASH,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MT_EE_NIC_CONF_0_RX_PATH GENMASK(3, 0)
|
||||||
|
#define MT_EE_NIC_CONF_0_TX_PATH GENMASK(7, 4)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -536,11 +536,6 @@ int mt7603_register_device(struct mt7603_dev *dev)
|
||||||
tasklet_init(&dev->mt76.pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet,
|
tasklet_init(&dev->mt76.pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet,
|
||||||
(unsigned long)dev);
|
(unsigned long)dev);
|
||||||
|
|
||||||
/* Check for 7688, which only has 1SS */
|
|
||||||
dev->mphy.antenna_mask = 3;
|
|
||||||
if (mt76_rr(dev, MT_EFUSE_BASE + 0x64) & BIT(4))
|
|
||||||
dev->mphy.antenna_mask = 1;
|
|
||||||
|
|
||||||
dev->slottime = 9;
|
dev->slottime = 9;
|
||||||
dev->sensitivity_limit = 28;
|
dev->sensitivity_limit = 28;
|
||||||
dev->dynamic_sensitivity = true;
|
dev->dynamic_sensitivity = true;
|
||||||
|
|
Loading…
Reference in New Issue