diff options
author | Lorenzo Bianconi <lorenzo@kernel.org> | 2020-10-14 12:03:58 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2020-12-04 14:31:11 +0100 |
commit | 3cb43b66060a5620cb1878668740c799235ad463 (patch) | |
tree | 9bfdc3b96969e834adb7a5c0d37dd49f8a001813 /drivers/net/wireless/mediatek/mt76/mcu.c | |
parent | bf4a938ab2cf854ed17f134e89e8aeff27c027f3 (diff) |
mt76: move mt76_mcu_send_firmware in common module
Move mt76_mcu_send_firmware routine in common code since it is actually
shared between mt7615, mt7663, mt7603 and mt7915 devices
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mcu.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mcu.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mcu.c b/drivers/net/wireless/mediatek/mt76/mcu.c index 76dadef7ccfe..30a6515758a8 100644 --- a/drivers/net/wireless/mediatek/mt76/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mcu.c @@ -105,3 +105,26 @@ out: return ret; } 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 len) +{ + int err, cur_len; + + while (len > 0) { + cur_len = min_t(int, 4096 - dev->mcu_ops->headroom, len); + + err = mt76_mcu_send_msg(dev, cmd, data, cur_len, false); + if (err) + return err; + + data += cur_len; + len -= cur_len; + + if (dev->queue_ops->tx_cleanup) + dev->queue_ops->tx_cleanup(dev, MT_TXQ_FWDL, false); + } + + return 0; +} +EXPORT_SYMBOL_GPL(mt76_mcu_send_firmware); |