From: Sean Wang Date: Mon, 10 May 2021 15:14:51 +0000 (+0800) Subject: mt76: connac: fw_own rely on all packet memory all being free X-Git-Tag: accepted/tizen/unified/20230118.172025~6942^2~30^2~25^2~72 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4bfa291251623486711693a69d9eaa539478d340;p=platform%2Fkernel%2Flinux-rpi.git mt76: connac: fw_own rely on all packet memory all being free 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 Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau --- diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac.h b/drivers/net/wireless/mediatek/mt76/mt76_connac.h index 6c889b9..337c5ec 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac.h @@ -127,8 +127,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; + spin_lock_bh(&pm->wake.lock); ret = pm->wake.count || test_and_set_bit(MT76_STATE_PM, &phy->state); spin_unlock_bh(&pm->wake.lock);