Commit 6849e29e authored by Ryder Lee's avatar Ryder Lee Committed by Felix Fietkau

mt76: mt7615: add starec operating flow for firmware v2

Add fw_ver in mt7615_dev to check firmware version, and adjust
mt7615_mcu_send_sta_rec() to adapt firmware v2 changes.
Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarShayne Chen <shayne.chen@mediatek.com>
Tested-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 9190d90d
......@@ -551,6 +551,11 @@ static int mt7615_load_n9(struct mt7615_dev *dev, const char *name)
sizeof(dev->mt76.hw->wiphy->fw_version),
"%.10s-%.15s", hdr->fw_ver, hdr->build_date);
if (!strncmp(hdr->fw_ver, "2.0", sizeof(hdr->fw_ver)))
dev->fw_ver = MT7615_FIRMWARE_V2;
else
dev->fw_ver = MT7615_FIRMWARE_V1;
out:
release_firmware(fw);
return ret;
......@@ -1121,10 +1126,11 @@ static int
mt7615_mcu_send_sta_rec(struct mt7615_dev *dev, u8 *req, u8 *wreq,
u8 wlen, bool enable)
{
u32 slen = wreq - req;
bool is_v1 = (dev->fw_ver == MT7615_FIRMWARE_V1);
u32 slen = is_v1 ? wreq - req : wreq - req + wlen;
int ret;
if (!enable) {
if (is_v1 && !enable) {
ret = __mt76_mcu_send_msg(&dev->mt76,
MCU_EXT_CMD_STA_REC_UPDATE,
req, slen, true);
......@@ -1135,10 +1141,12 @@ mt7615_mcu_send_sta_rec(struct mt7615_dev *dev, u8 *req, u8 *wreq,
wreq, wlen, true);
}
ret = __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_WTBL_UPDATE, wreq,
wlen, true);
if (ret)
return ret;
if (is_v1) {
ret = __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_WTBL_UPDATE,
wreq, wlen, true);
if (ret)
return ret;
}
return __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_STA_REC_UPDATE,
req, slen, true);
......
......@@ -36,6 +36,9 @@
#define MT7622_FIRMWARE_N9 "mediatek/mt7622_n9.bin"
#define MT7622_ROM_PATCH "mediatek/mt7622_rom_patch.bin"
#define MT7615_FIRMWARE_V1 1
#define MT7615_FIRMWARE_V2 2
#define MT7615_EEPROM_SIZE 1024
#define MT7615_TOKEN_SIZE 4096
......@@ -178,6 +181,8 @@ struct mt7615_dev {
spinlock_t token_lock;
struct idr token;
u8 fw_ver;
};
enum {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment