@@ -491,6 +491,11 @@ static int mt7615_load_ram(struct mt7615_dev *dev)
goto out;
}
+ if (!strncmp(hdr->fw_ver, "2.0", 6))
+ dev->fw_ver = MT7615_FIRMWARE_V2;
+ else
+ dev->fw_ver = MT7615_FIRMWARE_V1;
+
release_firmware(fw);
ret = request_firmware(&fw, MT7615_FIRMWARE_CR4, dev->mt76.dev);
@@ -992,10 +997,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);
@@ -1006,10 +1012,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);
@@ -30,6 +30,9 @@
#define MT7615_FIRMWARE_N9 "mediatek/mt7615_n9.bin"
#define MT7615_ROM_PATCH "mediatek/mt7615_rom_patch.bin"
+#define MT7615_FIRMWARE_V1 1
+#define MT7615_FIRMWARE_V2 2
+
#define MT7615_EEPROM_SIZE 1024
#define MT7615_TOKEN_SIZE 4096
@@ -144,6 +147,8 @@ struct mt7615_dev {
spinlock_t token_lock;
struct idr token;
+
+ u8 fw_ver;
};
enum {