wifi: mt76: mt7996: rework WA mcu command for mt7990

Since mt7990 lacks WA firmware, some WA commands are not supported or
need to be refactored to use the SDO command.
This is a preliminary patch to support mt7990 chipset.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250409140750.724437-4-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Peter Chiu 2025-04-09 22:07:43 +08:00 committed by Felix Fietkau
parent a4e32b306a
commit 76d13deb1a
3 changed files with 50 additions and 8 deletions

View File

@ -1065,6 +1065,7 @@ enum {
MCU_UNI_EVENT_WED_RRO = 0x57,
MCU_UNI_EVENT_PER_STA_INFO = 0x6d,
MCU_UNI_EVENT_ALL_STA_INFO = 0x6e,
MCU_UNI_EVENT_SDO = 0x83,
};
#define MCU_UNI_CMD_EVENT BIT(1)
@ -1297,6 +1298,7 @@ enum {
MCU_UNI_CMD_PER_STA_INFO = 0x6d,
MCU_UNI_CMD_ALL_STA_INFO = 0x6e,
MCU_UNI_CMD_ASSERT_DUMP = 0x6f,
MCU_UNI_CMD_SDO = 0x88,
};
enum {

View File

@ -338,8 +338,12 @@ mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
int mt7996_mcu_wa_cmd(struct mt7996_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
{
struct {
u8 _rsv[4];
__le16 tag;
__le16 len;
__le32 args[3];
} req = {
} __packed req = {
.args = {
cpu_to_le32(a1),
cpu_to_le32(a2),
@ -347,7 +351,16 @@ int mt7996_mcu_wa_cmd(struct mt7996_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
},
};
return mt76_mcu_send_msg(&dev->mt76, cmd, &req, sizeof(req), false);
if (mt7996_has_wa(dev))
return mt76_mcu_send_msg(&dev->mt76, cmd, &req.args,
sizeof(req.args), false);
req.tag = cpu_to_le16(cmd == MCU_WA_PARAM_CMD(QUERY) ? UNI_CMD_SDO_QUERY :
UNI_CMD_SDO_SET);
req.len = cpu_to_le16(sizeof(req) - 4);
return mt76_mcu_send_msg(&dev->mt76, MCU_WA_UNI_CMD(SDO), &req,
sizeof(req), false);
}
static void
@ -3223,13 +3236,15 @@ int mt7996_mcu_init_firmware(struct mt7996_dev *dev)
if (ret)
return ret;
ret = mt7996_mcu_fw_log_2_host(dev, MCU_FW_LOG_WA, 0);
if (ret)
return ret;
if (mt7996_has_wa(dev)) {
ret = mt7996_mcu_fw_log_2_host(dev, MCU_FW_LOG_WA, 0);
if (ret)
return ret;
ret = mt7996_mcu_set_mwds(dev, 1);
if (ret)
return ret;
ret = mt7996_mcu_set_mwds(dev, 1);
if (ret)
return ret;
}
ret = mt7996_mcu_init_rx_airtime(dev);
if (ret)
@ -4749,7 +4764,26 @@ int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode)
mode > mt76_connac_lmac_mapping(IEEE80211_AC_VO))
return -EINVAL;
if (!mt7996_has_wa(dev)) {
struct {
u8 _rsv[4];
__le16 tag;
__le16 len;
u8 cp_mode;
u8 rsv[3];
} __packed req = {
.tag = cpu_to_le16(UNI_CMD_SDO_CP_MODE),
.len = cpu_to_le16(sizeof(req) - 4),
.cp_mode = mode,
};
return mt76_mcu_send_msg(&dev->mt76, MCU_WA_UNI_CMD(SDO),
&req, sizeof(req), false);
}
cp_mode = cpu_to_le32(mode);
return mt76_mcu_send_msg(&dev->mt76, MCU_WA_EXT_CMD(CP_SUPPORT),
&cp_mode, sizeof(cp_mode), true);
}

View File

@ -937,6 +937,12 @@ enum {
UNI_CMD_SER_TRIGGER
};
enum {
UNI_CMD_SDO_SET = 1,
UNI_CMD_SDO_QUERY,
UNI_CMD_SDO_CP_MODE = 6,
};
enum {
MT7996_SEC_MODE_PLAIN,
MT7996_SEC_MODE_AES,