mt76: mt7921: refactor dma.c to be pcie specific
authorSean Wang <sean.wang@mediatek.com>
Mon, 18 Oct 2021 23:11:32 +0000 (07:11 +0800)
committerFelix Fietkau <nbd@nbd.name>
Wed, 20 Oct 2021 08:36:55 +0000 (10:36 +0200)
This is a preliminary patch to introduce mt7921s support.

make dma.c be used dedicately for mt7921e.

by moving out mt7921_tx_cleanup from dma.c to mcu.c and then renaming
mt7921_tx_cleanup to refect the exact thing the function actually does.

Finally, dma.c totally become pcie specific one, only needed to
be compiled only when CONFIG_MT7921E is enabled.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7921/dma.c
drivers/net/wireless/mediatek/mt76/mt7921/mac.c
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h

index 802e40e42040f471053cd2c50988b56358027a14..d3e2036a197432997675826ab92ea6246bacab1a 100644 (file)
@@ -19,12 +19,6 @@ int mt7921_init_tx_queues(struct mt7921_phy *phy, int idx, int n_desc)
        return 0;
 }
 
-void mt7921_tx_cleanup(struct mt7921_dev *dev)
-{
-       mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], false);
-       mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WA], false);
-}
-
 static int mt7921_poll_tx(struct napi_struct *napi, int budget)
 {
        struct mt7921_dev *dev;
@@ -37,7 +31,7 @@ static int mt7921_poll_tx(struct napi_struct *napi, int budget)
                return 0;
        }
 
-       mt7921_tx_cleanup(dev);
+       mt7921_mcu_tx_cleanup(dev);
        if (napi_complete(napi))
                mt7921_irq_enable(dev, MT_INT_TX_DONE_ALL);
        mt76_connac_pm_unref(&dev->mphy, &dev->pm);
index 0857d523bb065783489b15e84d25b697da72a231..eb27d8ab4a8b3ea0a4d92dc6e5b1237f2c857963 100644 (file)
@@ -1386,7 +1386,7 @@ void mt7921_pm_wake_work(struct work_struct *work)
                mt76_for_each_q_rx(&dev->mt76, i)
                        napi_schedule(&dev->mt76.napi[i]);
                mt76_connac_pm_dequeue_skbs(mphy, &dev->pm);
-               mt7921_tx_cleanup(dev);
+               mt7921_mcu_tx_cleanup(dev);
                if (test_bit(MT76_STATE_RUNNING, &mphy->state))
                        ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
                                                     MT7921_WATCHDOG_TIME);
index 70c0f41180a1e86ae80d68447c4888188235492d..a6c3661b2bddcd26d02a7f4041f8d47b6c874c93 100644 (file)
@@ -316,6 +316,12 @@ static inline bool mt7921_dma_need_reinit(struct mt7921_dev *dev)
        return !mt76_get_field(dev, MT_WFDMA_DUMMY_CR, MT_WFDMA_NEED_REINIT);
 }
 
+static inline void mt7921_mcu_tx_cleanup(struct mt7921_dev *dev)
+{
+       mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], false);
+       mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WA], false);
+}
+
 int mt7921_mac_init(struct mt7921_dev *dev);
 bool mt7921_mac_wtbl_update(struct mt7921_dev *dev, int idx, u32 mask);
 void mt7921_mac_reset_counters(struct mt7921_phy *phy);
@@ -330,7 +336,6 @@ void mt7921_mac_work(struct work_struct *work);
 void mt7921_mac_reset_work(struct work_struct *work);
 void mt7921_mac_update_mib_stats(struct mt7921_phy *phy);
 void mt7921_reset(struct mt76_dev *mdev);
-void mt7921_tx_cleanup(struct mt7921_dev *dev);
 int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
                           enum mt76_txq_id qid, struct mt76_wcid *wcid,
                           struct ieee80211_sta *sta,