mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: mt7996: Add __mt7996_npu_hw_init routine
Introduce __mt7996_npu_hw_init utility routine in order to run it holding mt76 mutex and move NPU hw re-initialization before restarting the NAPIs during device reset. Tested-by: Kang Yang <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
8a02211445
commit
56334c1c9b
+2
-2
@@ -2568,6 +2568,8 @@ void mt7996_mac_reset_work(struct work_struct *work)
|
||||
MT_INT_TX_RX_DONE_EXT);
|
||||
}
|
||||
|
||||
__mt7996_npu_hw_init(dev);
|
||||
|
||||
clear_bit(MT76_MCU_RESET, &dev->mphy.state);
|
||||
mt7996_for_each_phy(dev, phy)
|
||||
clear_bit(MT76_RESET, &phy->mt76->state);
|
||||
@@ -2597,8 +2599,6 @@ void mt7996_mac_reset_work(struct work_struct *work)
|
||||
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
|
||||
mt7996_npu_hw_init(dev);
|
||||
|
||||
mt7996_for_each_phy(dev, phy)
|
||||
ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
|
||||
MT7996_WATCHDOG_TIME);
|
||||
|
||||
@@ -889,10 +889,16 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir);
|
||||
int mt7996_dma_rro_init(struct mt7996_dev *dev);
|
||||
|
||||
#ifdef CONFIG_MT7996_NPU
|
||||
int __mt7996_npu_hw_init(struct mt7996_dev *dev);
|
||||
int mt7996_npu_hw_init(struct mt7996_dev *dev);
|
||||
int mt7996_npu_hw_stop(struct mt7996_dev *dev);
|
||||
int mt7996_npu_rx_queues_init(struct mt7996_dev *dev);
|
||||
#else
|
||||
static inline int __mt7996_npu_hw_init(struct mt7996_dev *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int mt7996_npu_hw_init(struct mt7996_dev *dev)
|
||||
{
|
||||
return 0;
|
||||
|
||||
+19
-12
@@ -525,20 +525,18 @@ int mt7996_npu_rx_queues_init(struct mt7996_dev *dev)
|
||||
&dev->mt76.q_rx[MT_RXQ_NPU1]);
|
||||
}
|
||||
|
||||
int mt7996_npu_hw_init(struct mt7996_dev *dev)
|
||||
int __mt7996_npu_hw_init(struct mt7996_dev *dev)
|
||||
{
|
||||
struct airoha_npu *npu;
|
||||
int i, err = 0;
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
int i, err;
|
||||
|
||||
npu = rcu_dereference_protected(dev->mt76.mmio.npu, &dev->mt76.mutex);
|
||||
if (!npu)
|
||||
goto unlock;
|
||||
return 0;
|
||||
|
||||
err = mt7996_npu_offload_init(dev, npu);
|
||||
if (err)
|
||||
goto unlock;
|
||||
return err;
|
||||
|
||||
if (is_mt7996(&dev->mt76))
|
||||
err = mt7996_npu_rxd_init(dev, npu);
|
||||
@@ -546,27 +544,36 @@ int mt7996_npu_hw_init(struct mt7996_dev *dev)
|
||||
err = mt7992_npu_rxd_init(dev, npu);
|
||||
|
||||
if (err)
|
||||
goto unlock;
|
||||
return err;
|
||||
|
||||
err = mt7996_npu_txd_init(dev, npu);
|
||||
if (err)
|
||||
goto unlock;
|
||||
return err;
|
||||
|
||||
err = mt7996_npu_rx_event_init(dev, npu);
|
||||
if (err)
|
||||
goto unlock;
|
||||
return err;
|
||||
|
||||
err = mt7996_npu_set_pcie_addr(dev, npu);
|
||||
if (err)
|
||||
goto unlock;
|
||||
return err;
|
||||
|
||||
err = mt7996_npu_tx_done_init(dev, npu);
|
||||
if (err)
|
||||
goto unlock;
|
||||
return err;
|
||||
|
||||
for (i = MT_RXQ_NPU0; i <= MT_RXQ_NPU1; i++)
|
||||
airoha_npu_wlan_enable_irq(npu, i - MT_RXQ_NPU0);
|
||||
unlock:
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mt7996_npu_hw_init(struct mt7996_dev *dev)
|
||||
{
|
||||
int err;
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
err = __mt7996_npu_hw_init(dev);
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user