diff mbox series

[3/9] mt76: connac: fw_own rely on all packet memory all being free

Message ID 1620659697-12048-3-git-send-email-sean.wang@mediatek.com (mailing list archive)
State New
Headers show
Series [1/9] mt76: mt7921: fix mt7921_wfsys_reset sequence | expand

Commit Message

Sean Wang May 10, 2021, 3:14 p.m. UTC
From: Sean Wang <sean.wang@mediatek.com>

If the device is MMIO-based, we must ensure all TxD/TxP on the host
memory all being consumed by the device prior to safely switching to
fw_own state.

Fixes: ec7bd7b4a9c0 ("mt76: connac: check wake refcount in mcu_fw_pmctrl")
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
 drivers/net/wireless/mediatek/mt76/mt76_connac.h | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series


diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac.h b/drivers/net/wireless/mediatek/mt76/mt76_connac.h
index 2b1150bf8d3d..a588d2c39870 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac.h
@@ -133,8 +133,12 @@  mt76_connac_pm_unref(struct mt76_connac_pm *pm)
 static inline bool
 mt76_connac_skip_fw_pmctrl(struct mt76_phy *phy, struct mt76_connac_pm *pm)
+	struct mt76_dev *dev = phy->dev;
 	bool ret;
+	if (dev->token_count)
+		return true;
 	ret = pm->wake.count || test_and_set_bit(MT76_STATE_PM, &phy->state);