mt76: introduce __mt76_mcu_send_firmware routine
Introduce __mt76_mcu_send_firmware routine to specify mcu message max length. This is a preliminary patch to support mt7921s driver. Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
a8315b2b94
commit
215a2efae3
|
@ -106,13 +106,13 @@ out:
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(mt76_mcu_skb_send_and_get_msg);
|
EXPORT_SYMBOL_GPL(mt76_mcu_skb_send_and_get_msg);
|
||||||
|
|
||||||
int mt76_mcu_send_firmware(struct mt76_dev *dev, int cmd, const void *data,
|
int __mt76_mcu_send_firmware(struct mt76_dev *dev, int cmd, const void *data,
|
||||||
int len)
|
int len, int max_len)
|
||||||
{
|
{
|
||||||
int err, cur_len;
|
int err, cur_len;
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
cur_len = min_t(int, 4096 - dev->mcu_ops->headroom, len);
|
cur_len = min_t(int, max_len - dev->mcu_ops->headroom, len);
|
||||||
|
|
||||||
err = mt76_mcu_send_msg(dev, cmd, data, cur_len, false);
|
err = mt76_mcu_send_msg(dev, cmd, data, cur_len, false);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -129,4 +129,4 @@ int mt76_mcu_send_firmware(struct mt76_dev *dev, int cmd, const void *data,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(mt76_mcu_send_firmware);
|
EXPORT_SYMBOL_GPL(__mt76_mcu_send_firmware);
|
||||||
|
|
|
@ -1258,8 +1258,15 @@ int mt76_mcu_send_and_get_msg(struct mt76_dev *dev, int cmd, const void *data,
|
||||||
int len, bool wait_resp, struct sk_buff **ret);
|
int len, bool wait_resp, struct sk_buff **ret);
|
||||||
int mt76_mcu_skb_send_and_get_msg(struct mt76_dev *dev, struct sk_buff *skb,
|
int mt76_mcu_skb_send_and_get_msg(struct mt76_dev *dev, struct sk_buff *skb,
|
||||||
int cmd, bool wait_resp, struct sk_buff **ret);
|
int cmd, bool wait_resp, struct sk_buff **ret);
|
||||||
int mt76_mcu_send_firmware(struct mt76_dev *dev, int cmd, const void *data,
|
int __mt76_mcu_send_firmware(struct mt76_dev *dev, int cmd, const void *data,
|
||||||
int len);
|
int len, int max_len);
|
||||||
|
static inline int
|
||||||
|
mt76_mcu_send_firmware(struct mt76_dev *dev, int cmd, const void *data,
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
return __mt76_mcu_send_firmware(dev, cmd, data, len, 4096);
|
||||||
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
mt76_mcu_send_msg(struct mt76_dev *dev, int cmd, const void *data, int len,
|
mt76_mcu_send_msg(struct mt76_dev *dev, int cmd, const void *data, int len,
|
||||||
bool wait_resp)
|
bool wait_resp)
|
||||||
|
|
|
@ -716,8 +716,8 @@ 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);
|
dl, len, 4096);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev->mt76.dev, "Failed to send patch\n");
|
dev_err(dev->mt76.dev, "Failed to send patch\n");
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -788,8 +788,8 @@ 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);
|
data + offset, len, 4096);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(dev->mt76.dev, "Failed to send firmware.\n");
|
dev_err(dev->mt76.dev, "Failed to send firmware.\n");
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in New Issue