Commit ffc2198d authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: connac: rely on MCU_CMD macro

Similar to mt7915 driver, rely on MCU_CMD macro and do not command
definitions directly
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 680a2ead
...@@ -106,7 +106,7 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, ...@@ -106,7 +106,7 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb,
txd_len = cmd & __MCU_CMD_FIELD_UNI ? sizeof(*uni_txd) : sizeof(*mcu_txd); txd_len = cmd & __MCU_CMD_FIELD_UNI ? sizeof(*uni_txd) : sizeof(*mcu_txd);
txd = (__le32 *)skb_push(skb, txd_len); txd = (__le32 *)skb_push(skb, txd_len);
if (cmd != MCU_CMD_FW_SCATTER) { if (cmd != MCU_CMD(FW_SCATTER)) {
q_idx = MT_TX_MCU_PORT_RX_Q0; q_idx = MT_TX_MCU_PORT_RX_Q0;
pkt_fmt = MT_TX_TYPE_CMD; pkt_fmt = MT_TX_TYPE_CMD;
} else { } else {
...@@ -173,7 +173,7 @@ int mt7615_mcu_parse_response(struct mt76_dev *mdev, int cmd, ...@@ -173,7 +173,7 @@ int mt7615_mcu_parse_response(struct mt76_dev *mdev, int cmd,
if (seq != rxd->seq) if (seq != rxd->seq)
return -EAGAIN; return -EAGAIN;
if (cmd == MCU_CMD_PATCH_SEM_CONTROL) { if (cmd == MCU_CMD(PATCH_SEM_CONTROL)) {
skb_pull(skb, sizeof(*rxd) - 4); skb_pull(skb, sizeof(*rxd) - 4);
ret = *skb->data; ret = *skb->data;
} else if (cmd == MCU_EXT_CMD(THERMAL_CTRL)) { } else if (cmd == MCU_EXT_CMD(THERMAL_CTRL)) {
...@@ -1377,7 +1377,7 @@ static const struct mt7615_mcu_ops uni_update_ops = { ...@@ -1377,7 +1377,7 @@ static const struct mt7615_mcu_ops uni_update_ops = {
int mt7615_mcu_restart(struct mt76_dev *dev) int mt7615_mcu_restart(struct mt76_dev *dev)
{ {
return mt76_mcu_send_msg(dev, MCU_CMD_RESTART_DL_REQ, NULL, 0, true); return mt76_mcu_send_msg(dev, MCU_CMD(RESTART_DL_REQ), NULL, 0, true);
} }
EXPORT_SYMBOL_GPL(mt7615_mcu_restart); EXPORT_SYMBOL_GPL(mt7615_mcu_restart);
...@@ -1423,7 +1423,7 @@ static int mt7615_load_patch(struct mt7615_dev *dev, u32 addr, const char *name) ...@@ -1423,7 +1423,7 @@ static int mt7615_load_patch(struct mt7615_dev *dev, u32 addr, const char *name)
goto out; goto out;
} }
ret = mt76_mcu_send_firmware(&dev->mt76, MCU_CMD_FW_SCATTER, ret = mt76_mcu_send_firmware(&dev->mt76, MCU_CMD(FW_SCATTER),
fw->data + sizeof(*hdr), len); fw->data + sizeof(*hdr), len);
if (ret) { if (ret) {
dev_err(dev->mt76.dev, "Failed to send firmware to device\n"); dev_err(dev->mt76.dev, "Failed to send firmware to device\n");
...@@ -1486,7 +1486,7 @@ mt7615_mcu_send_ram_firmware(struct mt7615_dev *dev, ...@@ -1486,7 +1486,7 @@ mt7615_mcu_send_ram_firmware(struct mt7615_dev *dev,
return err; return err;
} }
err = mt76_mcu_send_firmware(&dev->mt76, MCU_CMD_FW_SCATTER, err = mt76_mcu_send_firmware(&dev->mt76, MCU_CMD(FW_SCATTER),
data + offset, len); data + offset, len);
if (err) { if (err) {
dev_err(dev->mt76.dev, "Failed to send firmware to device\n"); dev_err(dev->mt76.dev, "Failed to send firmware to device\n");
...@@ -1734,7 +1734,7 @@ static int mt7663_load_n9(struct mt7615_dev *dev, const char *name) ...@@ -1734,7 +1734,7 @@ static int mt7663_load_n9(struct mt7615_dev *dev, const char *name)
goto out; goto out;
} }
ret = mt76_mcu_send_firmware(&dev->mt76, MCU_CMD_FW_SCATTER, ret = mt76_mcu_send_firmware(&dev->mt76, MCU_CMD(FW_SCATTER),
fw->data + offset, len); fw->data + offset, len);
if (ret) { if (ret) {
dev_err(dev->mt76.dev, "Failed to send firmware\n"); dev_err(dev->mt76.dev, "Failed to send firmware\n");
......
...@@ -21,7 +21,7 @@ mt7663u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, ...@@ -21,7 +21,7 @@ mt7663u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
int ret, ep, len, pad; int ret, ep, len, pad;
mt7615_mcu_fill_msg(dev, skb, cmd, seq); mt7615_mcu_fill_msg(dev, skb, cmd, seq);
if (cmd != MCU_CMD_FW_SCATTER) if (cmd != MCU_CMD(FW_SCATTER))
ep = MT_EP_OUT_INBAND_CMD; ep = MT_EP_OUT_INBAND_CMD;
else else
ep = MT_EP_OUT_AC_BE; ep = MT_EP_OUT_AC_BE;
......
...@@ -13,8 +13,8 @@ int mt76_connac_mcu_start_firmware(struct mt76_dev *dev, u32 addr, u32 option) ...@@ -13,8 +13,8 @@ int mt76_connac_mcu_start_firmware(struct mt76_dev *dev, u32 addr, u32 option)
.addr = cpu_to_le32(addr), .addr = cpu_to_le32(addr),
}; };
return mt76_mcu_send_msg(dev, MCU_CMD_FW_START_REQ, &req, sizeof(req), return mt76_mcu_send_msg(dev, MCU_CMD(FW_START_REQ), &req,
true); sizeof(req), true);
} }
EXPORT_SYMBOL_GPL(mt76_connac_mcu_start_firmware); EXPORT_SYMBOL_GPL(mt76_connac_mcu_start_firmware);
...@@ -27,8 +27,8 @@ int mt76_connac_mcu_patch_sem_ctrl(struct mt76_dev *dev, bool get) ...@@ -27,8 +27,8 @@ int mt76_connac_mcu_patch_sem_ctrl(struct mt76_dev *dev, bool get)
.op = cpu_to_le32(op), .op = cpu_to_le32(op),
}; };
return mt76_mcu_send_msg(dev, MCU_CMD_PATCH_SEM_CONTROL, &req, return mt76_mcu_send_msg(dev, MCU_CMD(PATCH_SEM_CONTROL),
sizeof(req), true); &req, sizeof(req), true);
} }
EXPORT_SYMBOL_GPL(mt76_connac_mcu_patch_sem_ctrl); EXPORT_SYMBOL_GPL(mt76_connac_mcu_patch_sem_ctrl);
...@@ -41,8 +41,8 @@ int mt76_connac_mcu_start_patch(struct mt76_dev *dev) ...@@ -41,8 +41,8 @@ int mt76_connac_mcu_start_patch(struct mt76_dev *dev)
.check_crc = 0, .check_crc = 0,
}; };
return mt76_mcu_send_msg(dev, MCU_CMD_PATCH_FINISH_REQ, &req, return mt76_mcu_send_msg(dev, MCU_CMD(PATCH_FINISH_REQ),
sizeof(req), true); &req, sizeof(req), true);
} }
EXPORT_SYMBOL_GPL(mt76_connac_mcu_start_patch); EXPORT_SYMBOL_GPL(mt76_connac_mcu_start_patch);
...@@ -64,9 +64,9 @@ int mt76_connac_mcu_init_download(struct mt76_dev *dev, u32 addr, u32 len, ...@@ -64,9 +64,9 @@ int mt76_connac_mcu_init_download(struct mt76_dev *dev, u32 addr, u32 len,
if (is_mt7921(dev) && if (is_mt7921(dev) &&
(req.addr == cpu_to_le32(MCU_PATCH_ADDRESS) || addr == 0x900000)) (req.addr == cpu_to_le32(MCU_PATCH_ADDRESS) || addr == 0x900000))
cmd = MCU_CMD_PATCH_START_REQ; cmd = MCU_CMD(PATCH_START_REQ);
else else
cmd = MCU_CMD_TARGET_ADDRESS_LEN_REQ; cmd = MCU_CMD(TARGET_ADDRESS_LEN_REQ);
return mt76_mcu_send_msg(dev, cmd, &req, sizeof(req), true); return mt76_mcu_send_msg(dev, cmd, &req, sizeof(req), true);
} }
......
...@@ -179,7 +179,7 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd, ...@@ -179,7 +179,7 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd,
if (seq != rxd->seq) if (seq != rxd->seq)
return -EAGAIN; return -EAGAIN;
if (cmd == MCU_CMD_PATCH_SEM_CONTROL) { if (cmd == MCU_CMD(PATCH_SEM_CONTROL)) {
skb_pull(skb, sizeof(*rxd) - 4); skb_pull(skb, sizeof(*rxd) - 4);
ret = *skb->data; ret = *skb->data;
} else if (cmd == MCU_EXT_CMD(THERMAL_CTRL)) { } else if (cmd == MCU_EXT_CMD(THERMAL_CTRL)) {
...@@ -237,7 +237,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb, ...@@ -237,7 +237,7 @@ int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb,
if (!seq) if (!seq)
seq = ++dev->mt76.mcu.msg_seq & 0xf; seq = ++dev->mt76.mcu.msg_seq & 0xf;
if (cmd == MCU_CMD_FW_SCATTER) if (cmd == MCU_CMD(FW_SCATTER))
goto exit; goto exit;
txd_len = cmd & __MCU_CMD_FIELD_UNI ? sizeof(*uni_txd) : sizeof(*mcu_txd); txd_len = cmd & __MCU_CMD_FIELD_UNI ? sizeof(*uni_txd) : sizeof(*mcu_txd);
...@@ -589,7 +589,7 @@ int mt7921_mcu_restart(struct mt76_dev *dev) ...@@ -589,7 +589,7 @@ int mt7921_mcu_restart(struct mt76_dev *dev)
.power_mode = 1, .power_mode = 1,
}; };
return mt76_mcu_send_msg(dev, MCU_CMD_NIC_POWER_CTRL, &req, return mt76_mcu_send_msg(dev, MCU_CMD(NIC_POWER_CTRL), &req,
sizeof(req), false); sizeof(req), false);
} }
EXPORT_SYMBOL_GPL(mt7921_mcu_restart); EXPORT_SYMBOL_GPL(mt7921_mcu_restart);
...@@ -695,7 +695,7 @@ static int mt7921_load_patch(struct mt7921_dev *dev) ...@@ -695,7 +695,7 @@ static int mt7921_load_patch(struct mt7921_dev *dev)
goto out; goto out;
} }
ret = __mt76_mcu_send_firmware(&dev->mt76, MCU_CMD_FW_SCATTER, ret = __mt76_mcu_send_firmware(&dev->mt76, MCU_CMD(FW_SCATTER),
dl, len, max_len); dl, len, max_len);
if (ret) { if (ret) {
dev_err(dev->mt76.dev, "Failed to send patch\n"); dev_err(dev->mt76.dev, "Failed to send patch\n");
...@@ -780,7 +780,7 @@ mt7921_mcu_send_ram_firmware(struct mt7921_dev *dev, ...@@ -780,7 +780,7 @@ mt7921_mcu_send_ram_firmware(struct mt7921_dev *dev,
return err; return err;
} }
err = __mt76_mcu_send_firmware(&dev->mt76, MCU_CMD_FW_SCATTER, err = __mt76_mcu_send_firmware(&dev->mt76, MCU_CMD(FW_SCATTER),
data + offset, len, max_len); data + offset, len, max_len);
if (err) { if (err) {
dev_err(dev->mt76.dev, "Failed to send firmware.\n"); dev_err(dev->mt76.dev, "Failed to send firmware.\n");
......
...@@ -30,7 +30,7 @@ mt7921_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, ...@@ -30,7 +30,7 @@ mt7921_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
if (ret) if (ret)
return ret; return ret;
if (cmd == MCU_CMD_FW_SCATTER) if (cmd == MCU_CMD(FW_SCATTER))
txq = MT_MCUQ_FWDL; txq = MT_MCUQ_FWDL;
return mt76_tx_queue_skb_raw(dev, mdev->q_mcu[txq], skb, 0); return mt76_tx_queue_skb_raw(dev, mdev->q_mcu[txq], skb, 0);
......
...@@ -33,7 +33,7 @@ mt7921s_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, ...@@ -33,7 +33,7 @@ mt7921s_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
if (ret) if (ret)
return ret; return ret;
if (cmd == MCU_CMD_FW_SCATTER) if (cmd == MCU_CMD(FW_SCATTER))
type = MT7921_SDIO_FWDL; type = MT7921_SDIO_FWDL;
mt7921_skb_add_sdio_hdr(skb, type); mt7921_skb_add_sdio_hdr(skb, type);
......
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