diff mbox series

[2/5] mt76: mt7921: move fw toggle in mt7921_load_firmware

Message ID 8d3f5d937138d5bb1694235cf71aeef7a28f7cd1.1654248715.git.lorenzo@kernel.org (mailing list archive)
State Accepted
Delegated to: Felix Fietkau
Headers show
Series mt76: connac: move shared connac2 fw loading in connac module | expand

Commit Message

Lorenzo Bianconi June 3, 2022, 9:36 a.m. UTC
Move drv_own/fw_own toggle in mt7921_load_firmware. This change allow to
reuse connac code to load patch for mt7921 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Deren Wu June 7, 2022, 9:49 a.m. UTC | #1
Thie series work fine in mt7921[e/u/s]

Tested-by: Deren Wu <deren.wu@mediatek.com>
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
index 1f1c270a4d81..bf1648b02ab5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
@@ -537,13 +537,6 @@  static int mt7921_load_patch(struct mt7921_dev *dev)
 		break;
 	}
 
-	if (!ret && mt76_is_sdio(&dev->mt76)) {
-		/* activate again */
-		ret = __mt7921_mcu_fw_pmctrl(dev);
-		if (!ret)
-			ret = __mt7921_mcu_drv_pmctrl(dev);
-	}
-
 	release_firmware(fw);
 
 	return ret;
@@ -662,6 +655,13 @@  static int mt7921_load_firmware(struct mt7921_dev *dev)
 	if (ret)
 		return ret;
 
+	if (mt76_is_sdio(&dev->mt76)) {
+		/* activate again */
+		ret = __mt7921_mcu_fw_pmctrl(dev);
+		if (!ret)
+			ret = __mt7921_mcu_drv_pmctrl(dev);
+	}
+
 	ret = mt7921_load_ram(dev);
 	if (ret)
 		return ret;