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

mt76: mt7915: rely on mt76_connac_mcu_init_download

Rely on mt76_connac_mcu_init_download routine in mt7915 driver and
remove duplicated code.
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent ad1a2333
...@@ -62,8 +62,8 @@ int mt76_connac_mcu_init_download(struct mt76_dev *dev, u32 addr, u32 len, ...@@ -62,8 +62,8 @@ int mt76_connac_mcu_init_download(struct mt76_dev *dev, u32 addr, u32 len,
}; };
int cmd; int cmd;
if (is_mt7921(dev) && if ((!is_connac_v1(dev) && addr == MCU_PATCH_ADDRESS) ||
(req.addr == cpu_to_le32(MCU_PATCH_ADDRESS) || addr == 0x900000)) (is_mt7921(dev) && 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);
......
...@@ -1957,28 +1957,6 @@ static int mt7915_driver_own(struct mt7915_dev *dev, u8 band) ...@@ -1957,28 +1957,6 @@ static int mt7915_driver_own(struct mt7915_dev *dev, u8 band)
return 0; return 0;
} }
static int mt7915_mcu_init_download(struct mt7915_dev *dev, u32 addr,
u32 len, u32 mode)
{
struct {
__le32 addr;
__le32 len;
__le32 mode;
} req = {
.addr = cpu_to_le32(addr),
.len = cpu_to_le32(len),
.mode = cpu_to_le32(mode),
};
int attr;
if (req.addr == cpu_to_le32(MCU_PATCH_ADDRESS))
attr = MCU_CMD(PATCH_START_REQ);
else
attr = MCU_CMD(TARGET_ADDRESS_LEN_REQ);
return mt76_mcu_send_msg(&dev->mt76, attr, &req, sizeof(req), true);
}
static int mt7915_load_patch(struct mt7915_dev *dev) static int mt7915_load_patch(struct mt7915_dev *dev)
{ {
const struct mt7915_patch_hdr *hdr; const struct mt7915_patch_hdr *hdr;
...@@ -2030,7 +2008,7 @@ static int mt7915_load_patch(struct mt7915_dev *dev) ...@@ -2030,7 +2008,7 @@ static int mt7915_load_patch(struct mt7915_dev *dev)
len = be32_to_cpu(sec->info.len); len = be32_to_cpu(sec->info.len);
dl = fw->data + be32_to_cpu(sec->offs); dl = fw->data + be32_to_cpu(sec->offs);
ret = mt7915_mcu_init_download(dev, addr, len, ret = mt76_connac_mcu_init_download(&dev->mt76, addr, len,
DL_MODE_NEED_RSP); DL_MODE_NEED_RSP);
if (ret) { if (ret) {
dev_err(dev->mt76.dev, "Download request failed\n"); dev_err(dev->mt76.dev, "Download request failed\n");
...@@ -2100,7 +2078,8 @@ mt7915_mcu_send_ram_firmware(struct mt7915_dev *dev, ...@@ -2100,7 +2078,8 @@ mt7915_mcu_send_ram_firmware(struct mt7915_dev *dev,
if (region->feature_set & FW_FEATURE_OVERRIDE_ADDR) if (region->feature_set & FW_FEATURE_OVERRIDE_ADDR)
override = addr; override = addr;
err = mt7915_mcu_init_download(dev, addr, len, mode); err = mt76_connac_mcu_init_download(&dev->mt76, addr, len,
mode);
if (err) { if (err) {
dev_err(dev->mt76.dev, "Download request failed\n"); dev_err(dev->mt76.dev, "Download request failed\n");
return err; return err;
......
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