]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mt76: move wait_for_wpdma in mt76x02_dma.h
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Fri, 28 Sep 2018 11:38:45 +0000 (13:38 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 1 Oct 2018 10:34:18 +0000 (12:34 +0200)
Move wait_for_wpdma utility routine in mt76x02_dma.h
in order to be reused by mt76x0 driver. Moreover add
the possibility to specify the timeout value in
wait_for_wpdma signature

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x02_dma.h
drivers/net/wireless/mediatek/mt76/mt76x2.h
drivers/net/wireless/mediatek/mt76/mt76x2_init.c
drivers/net/wireless/mediatek/mt76/mt76x2u_mac.c

index 32a323ebc6a76a96e4ae7d2078f7806b1e3a1e30..2396d49a84dde4d1a749ae5cf8f5a9080d73d858 100644 (file)
@@ -18,6 +18,7 @@
 #define __MT76x02_DMA_H
 
 #include "dma.h"
+#include "mt76x02_regs.h"
 
 #define MT_TXD_INFO_LEN                        GENMASK(15, 0)
 #define MT_TXD_INFO_NEXT_VLD           BIT(16)
@@ -57,4 +58,13 @@ enum dma_msg_port {
        DISCARD,
 };
 
+static inline bool
+mt76x02_wait_for_wpdma(struct mt76_dev *dev, int timeout)
+{
+       return __mt76_poll(dev, MT_WPDMA_GLO_CFG,
+                          MT_WPDMA_GLO_CFG_TX_DMA_BUSY |
+                          MT_WPDMA_GLO_CFG_RX_DMA_BUSY,
+                          0, timeout);
+}
+
 #endif /* __MT76x02_DMA_H */
index a6dd35d00968ea14f4dfb956122d54478b1d4615..b950361e5f87d4c2d4fa173416929ec9a52b1ef8 100644 (file)
@@ -151,14 +151,6 @@ static inline bool mt76x2_wait_for_bbp(struct mt76x2_dev *dev)
                              0, 100);
 }
 
-static inline bool wait_for_wpdma(struct mt76x2_dev *dev)
-{
-       return mt76_poll(dev, MT_WPDMA_GLO_CFG,
-                        MT_WPDMA_GLO_CFG_TX_DMA_BUSY |
-                        MT_WPDMA_GLO_CFG_RX_DMA_BUSY,
-                        0, 1000);
-}
-
 extern const struct ieee80211_ops mt76x2_ops;
 
 struct mt76x2_dev *mt76x2_alloc_device(struct device *pdev);
index 72005faee00ea1c4b081bb7cbd420df49a6970e7..68244b47312a8706549d20bb6ef4c95f69721146 100644 (file)
@@ -19,6 +19,7 @@
 #include "mt76x2_eeprom.h"
 #include "mt76x2_mcu.h"
 #include "mt76x02_util.h"
+#include "mt76x02_dma.h"
 
 static void
 mt76x2_mac_pbf_init(struct mt76x2_dev *dev)
@@ -206,7 +207,7 @@ int mt76x2_mac_start(struct mt76x2_dev *dev)
        memset(dev->aggr_stats, 0, sizeof(dev->aggr_stats));
 
        mt76_wr(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_ENABLE_TX);
-       wait_for_wpdma(dev);
+       mt76x02_wait_for_wpdma(&dev->mt76, 1000);
        usleep_range(50, 100);
 
        mt76_set(dev, MT_WPDMA_GLO_CFG,
index 0f5d781b13dc6038e991b50d1673d2cd914d54c5..f28c6fbcc305eabc37d10ddf4f055917fffa72f3 100644 (file)
@@ -119,7 +119,7 @@ int mt76x2u_mac_start(struct mt76x2_dev *dev)
        mt76x2u_mac_reset_counters(dev);
 
        mt76_wr(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_ENABLE_TX);
-       wait_for_wpdma(dev);
+       mt76x02_wait_for_wpdma(&dev->mt76, 1000);
        usleep_range(50, 100);
 
        mt76_wr(dev, MT_RX_FILTR_CFG, dev->mt76.rxfilter);