Commit 4bfa2912 authored by Sean Wang's avatar Sean Wang Committed by Felix Fietkau

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: ec7bd7b4 ("mt76: connac: check wake refcount in mcu_fw_pmctrl")
Reviewed-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 2c80c02a
...@@ -127,8 +127,12 @@ mt76_connac_pm_unref(struct mt76_connac_pm *pm) ...@@ -127,8 +127,12 @@ mt76_connac_pm_unref(struct mt76_connac_pm *pm)
static inline bool static inline bool
mt76_connac_skip_fw_pmctrl(struct mt76_phy *phy, struct mt76_connac_pm *pm) mt76_connac_skip_fw_pmctrl(struct mt76_phy *phy, struct mt76_connac_pm *pm)
{ {
struct mt76_dev *dev = phy->dev;
bool ret; bool ret;
if (dev->token_count)
return true;
spin_lock_bh(&pm->wake.lock); spin_lock_bh(&pm->wake.lock);
ret = pm->wake.count || test_and_set_bit(MT76_STATE_PM, &phy->state); ret = pm->wake.count || test_and_set_bit(MT76_STATE_PM, &phy->state);
spin_unlock_bh(&pm->wake.lock); spin_unlock_bh(&pm->wake.lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment