[][Fix mt7622 wed crash issue]
[Description]
Fix mt7622 wed crash issue
1. init res
2. init rx when wed version > V1
[Release-log]
N/A
Change-Id: I56a1a5a6e9ee99d2a0a00cfbf16d0a2425c95efc
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6209417
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/3002-mt76-add-wed-rx-support.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/3002-mt76-add-wed-rx-support.patch
index 3313dc7..c895f33 100755
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/3002-mt76-add-wed-rx-support.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/3002-mt76-add-wed-rx-support.patch
@@ -1,47 +1,37 @@
-From bcc5b5f90672a1afef292f0cdf96cca62367e541 Mon Sep 17 00:00:00 2001
+From 1abac441c94f3f32bd074b8b01c439263129102d Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
-Date: Wed, 15 Jun 2022 14:48:25 +0800
+Date: Tue, 5 Jul 2022 19:42:55 +0800
Subject: [PATCH 2/3] mt76 add wed rx support
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
- dma.c | 219 +++++++++++++++++++++++++++++++++++++---------
- dma.h | 10 +++
+ dma.c | 219 +++++++++++++++++++++++++++++++++--------
+ dma.h | 10 ++
mac80211.c | 8 +-
mt76.h | 24 ++++-
mt7603/dma.c | 2 +-
mt7603/mt7603.h | 2 +-
mt7615/mac.c | 2 +-
mt7615/mt7615.h | 2 +-
- mt76_connac_mcu.c | 7 ++
+ mt76_connac_mcu.c | 9 ++
mt76x02.h | 2 +-
mt76x02_txrx.c | 2 +-
- mt7915/dma.c | 8 ++
- mt7915/mac.c | 89 ++++++++++++++++++-
- mt7915/mcu.c | 2 +
- mt7915/mmio.c | 22 +++++
+ mt7915/dma.c | 10 ++
+ mt7915/mac.c | 89 ++++++++++++++++-
+ mt7915/mcu.c | 3 +
+ mt7915/mmio.c | 26 ++++-
mt7915/mt7915.h | 7 +-
mt7915/regs.h | 14 ++-
mt7921/mac.c | 2 +-
mt7921/mt7921.h | 4 +-
mt7921/pci_mac.c | 4 +-
tx.c | 34 +++++++
- 21 files changed, 404 insertions(+), 62 deletions(-)
- mode change 100644 => 100755 dma.c
- mode change 100644 => 100755 mt7603/dma.c
- mode change 100644 => 100755 mt7603/mt7603.h
- mode change 100644 => 100755 mt7615/mac.c
- mode change 100644 => 100755 mt7615/mt7615.h
- mode change 100644 => 100755 mt76x02.h
- mode change 100644 => 100755 mt76x02_txrx.c
- mode change 100644 => 100755 mt7921/mac.c
- mode change 100644 => 100755 mt7921/mt7921.h
- mode change 100644 => 100755 mt7921/pci_mac.c
+ 21 files changed, 410 insertions(+), 65 deletions(-)
+ mode change 100755 => 100644 mt7915/mac.c
+ mode change 100755 => 100644 mt7915/mmio.c
diff --git a/dma.c b/dma.c
-old mode 100644
-new mode 100755
-index f6f5f129..7ef4bcbc
+index 03ee910..094aede 100644
--- a/dma.c
+++ b/dma.c
@@ -98,6 +98,63 @@ mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t)
@@ -436,7 +426,7 @@
free_frag:
diff --git a/dma.h b/dma.h
-index fdf786f9..90370d12 100644
+index fdf786f..90370d1 100644
--- a/dma.h
+++ b/dma.h
@@ -16,6 +16,16 @@
@@ -457,7 +447,7 @@
#define MT_RX_INFO_LEN 4
#define MT_FCE_INFO_LEN 4
diff --git a/mac80211.c b/mac80211.c
-index af2c09ad..fa5ce6ec 100644
+index af2c09a..fa5ce6e 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -594,11 +594,14 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
@@ -488,7 +478,7 @@
mt76_rx_complete(dev, &frames, napi);
diff --git a/mt76.h b/mt76.h
-index 062c5ce4..3ca480cc 100644
+index 4c8a671..24e4741 100644
--- a/mt76.h
+++ b/mt76.h
@@ -20,6 +20,8 @@
@@ -586,9 +576,7 @@
static inline void mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
{
diff --git a/mt7603/dma.c b/mt7603/dma.c
-old mode 100644
-new mode 100755
-index 590cff9d..2ff71c53
+index 590cff9..2ff71c5 100644
--- a/mt7603/dma.c
+++ b/mt7603/dma.c
@@ -69,7 +69,7 @@ free:
@@ -601,9 +589,7 @@
struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76);
__le32 *rxd = (__le32 *)skb->data;
diff --git a/mt7603/mt7603.h b/mt7603/mt7603.h
-old mode 100644
-new mode 100755
-index 0fd46d90..f2ce22ae
+index 0fd46d9..f2ce22a 100644
--- a/mt7603/mt7603.h
+++ b/mt7603/mt7603.h
@@ -244,7 +244,7 @@ int mt7603_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -616,12 +602,10 @@
void mt7603_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
int mt7603_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
diff --git a/mt7615/mac.c b/mt7615/mac.c
-old mode 100644
-new mode 100755
-index 038774b3..ed72245b
+index 3728627..14cdd9a 100644
--- a/mt7615/mac.c
+++ b/mt7615/mac.c
-@@ -1647,7 +1647,7 @@ bool mt7615_rx_check(struct mt76_dev *mdev, void *data, int len)
+@@ -1648,7 +1648,7 @@ bool mt7615_rx_check(struct mt76_dev *mdev, void *data, int len)
EXPORT_SYMBOL_GPL(mt7615_rx_check);
void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
@@ -631,12 +615,10 @@
struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
__le32 *rxd = (__le32 *)skb->data;
diff --git a/mt7615/mt7615.h b/mt7615/mt7615.h
-old mode 100644
-new mode 100755
-index 93a9e8f4..06ccaa52
+index 25880d1..983469c 100644
--- a/mt7615/mt7615.h
+++ b/mt7615/mt7615.h
-@@ -510,7 +510,7 @@ void mt7615_tx_worker(struct mt76_worker *w);
+@@ -511,7 +511,7 @@ void mt7615_tx_worker(struct mt76_worker *w);
void mt7615_tx_token_put(struct mt7615_dev *dev);
bool mt7615_rx_check(struct mt76_dev *mdev, void *data, int len);
void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
@@ -646,7 +628,7 @@
int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta);
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index cd350689..e4d0a791 100644
+index cd35068..f90a08f 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -1190,6 +1190,7 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
@@ -657,23 +639,27 @@
struct wtbl_req_hdr *wtbl_hdr;
struct tlv *sta_wtbl;
struct sk_buff *skb;
-@@ -1210,6 +1211,7 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
+@@ -1210,6 +1211,8 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
mt76_connac_mcu_wtbl_ba_tlv(dev, skb, params, enable, tx, sta_wtbl,
wtbl_hdr);
-+ mtk_wed_device_update_msg(wed, WED_WO_STA_REC, skb->data, skb->len);
++ if (mtk_wed_device_active(wed) && wed->ver > MTK_WED_V1)
++
+
+(wed, WED_WO_STA_REC, skb->data, skb->len);
ret = mt76_mcu_skb_send_msg(dev, skb, cmd, true);
if (ret)
return ret;
-@@ -1220,6 +1222,7 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
+@@ -1220,6 +1223,8 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
mt76_connac_mcu_sta_ba_tlv(skb, params, enable, tx);
-+ mtk_wed_device_update_msg(wed, WED_WO_STA_REC, skb->data, skb->len);
++ if (mtk_wed_device_active(wed) && wed->ver > MTK_WED_V1)
++ mtk_wed_device_update_msg(wed, WED_WO_STA_REC, skb->data, skb->len);
return mt76_mcu_skb_send_msg(dev, skb, cmd, true);
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_ba);
-@@ -2634,6 +2637,7 @@ int mt76_connac_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
+@@ -2634,6 +2639,7 @@ int mt76_connac_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
struct mt76_wcid *wcid, enum set_key_cmd cmd)
{
struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
@@ -681,20 +667,18 @@
struct sk_buff *skb;
int ret;
-@@ -2645,6 +2649,9 @@ int mt76_connac_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
+@@ -2645,6 +2651,9 @@ int mt76_connac_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
if (ret)
return ret;
-+ if (mtk_wed_device_active(wed))
++ if (mtk_wed_device_active(wed) && wed->ver > MTK_WED_V1)
+ mtk_wed_device_update_msg(wed, WED_WO_STA_REC, skb->data, skb->len);
+
return mt76_mcu_skb_send_msg(dev, skb, mcu_cmd, true);
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_add_key);
diff --git a/mt76x02.h b/mt76x02.h
-old mode 100644
-new mode 100755
-index f76fd22e..0b872af1
+index f76fd22..0b872af 100644
--- a/mt76x02.h
+++ b/mt76x02.h
@@ -173,7 +173,7 @@ int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val);
@@ -707,9 +691,7 @@
irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance);
void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
diff --git a/mt76x02_txrx.c b/mt76x02_txrx.c
-old mode 100644
-new mode 100755
-index 96fdf423..bf24d3e0
+index 96fdf42..bf24d3e 100644
--- a/mt76x02_txrx.c
+++ b/mt76x02_txrx.c
@@ -33,7 +33,7 @@ void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
@@ -722,7 +704,7 @@
struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
void *rxwi = skb->data;
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 71223221..722727c4 100644
+index 7122322..ac98e01 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
@@ -376,6 +376,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
@@ -734,28 +716,32 @@
} else {
mt76_wr(dev, MT_WFDMA_WED_RING_CONTROL,
FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX0, 18) |
-@@ -451,6 +453,9 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+@@ -451,6 +453,10 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
/* rx data queue for band0 */
if (!dev->phy.band_idx) {
-+ if (mtk_wed_device_active(&dev->mt76.mmio.wed))
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
++ dev->mt76.mmio.wed.ver > MTK_WED_V1)
+ dev->mt76.q_rx[MT_RXQ_MAIN].flags = MT_WED_Q_RX(MT7915_RXQ_BAND0);
+
ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MAIN],
MT_RXQ_ID(MT_RXQ_MAIN),
MT7915_RX_RING_SIZE,
-@@ -482,6 +487,9 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+@@ -482,6 +488,10 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
if (dev->dbdc_support || dev->phy.band_idx) {
/* rx data queue for band1 */
-+ if (mtk_wed_device_active(&dev->mt76.mmio.wed))
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
++ dev->mt76.mmio.wed.ver > MTK_WED_V1)
+ dev->mt76.q_rx[MT_RXQ_EXT].flags = MT_WED_Q_RX(MT7915_RXQ_BAND1);
+
ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_EXT],
MT_RXQ_ID(MT_RXQ_EXT),
MT7915_RX_RING_SIZE,
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 3f059bed..2d3b9d6a 100644
+old mode 100755
+new mode 100644
+index bc8da4d..79b7d01
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -217,7 +217,7 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
@@ -795,7 +781,7 @@
}
if (rxv && mode >= MT_PHY_TYPE_HE_SU && !(status->flag & RX_FLAG_8023))
-@@ -838,6 +859,68 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
+@@ -840,6 +861,68 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
return MT_TXD_TXP_BUF_SIZE;
}
@@ -864,7 +850,7 @@
static void
mt7915_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
{
-@@ -1118,7 +1201,7 @@ bool mt7915_rx_check(struct mt76_dev *mdev, void *data, int len)
+@@ -1120,7 +1203,7 @@ bool mt7915_rx_check(struct mt76_dev *mdev, void *data, int len)
}
void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
@@ -873,7 +859,7 @@
{
struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76);
__le32 *rxd = (__le32 *)skb->data;
-@@ -1152,7 +1235,7 @@ void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
+@@ -1154,7 +1237,7 @@ void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
dev_kfree_skb(skb);
break;
case PKT_TYPE_NORMAL:
@@ -883,7 +869,7 @@
return;
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 9d2a7059..032eb1dd 100644
+index 1468c3c..4f64df4 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -1704,6 +1704,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
@@ -894,16 +880,19 @@
struct mt7915_sta *msta;
struct sk_buff *skb;
int ret;
-@@ -1756,6 +1757,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
+@@ -1756,6 +1757,8 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
return ret;
}
out:
-+ mtk_wed_device_update_msg(wed, WED_WO_STA_REC, skb->data, skb->len);
++ if (mtk_wed_device_active(wed) && wed->ver > MTK_WED_V1)
++ mtk_wed_device_update_msg(wed, WED_WO_STA_REC, skb->data, skb->len);
return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_EXT_CMD(STA_REC_UPDATE), true);
}
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index b4a3120d..36b61a14 100755
+old mode 100755
+new mode 100644
+index b4a3120..08ff556
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -28,6 +28,9 @@ static const u32 mt7915_reg[] = {
@@ -936,7 +925,15 @@
};
static const u32 mt7915_offs[] = {
-@@ -722,12 +731,19 @@ mt7915_pci_wed_init(struct mt7915_dev *dev, struct device *pdev, int *irq)
+@@ -710,6 +719,7 @@ mt7915_pci_wed_init(struct mt7915_dev *dev, struct device *pdev, int *irq)
+ wed->wlan.bus_type = MTK_BUS_TYPE_PCIE;
+ wed->wlan.wpdma_int = base + MT_INT_WED_SOURCE_CSR;
+ wed->wlan.wpdma_mask = base + MT_INT_WED_MASK_CSR;
++ wed->wlan.wpdma_phys = base + MT_WFDMA_EXT_CSR_BASE;
+ } else {
+ struct platform_device *plat_dev;
+ struct resource *res;
+@@ -722,12 +732,19 @@ mt7915_pci_wed_init(struct mt7915_dev *dev, struct device *pdev, int *irq)
wed->wlan.wpdma_int = base + MT_INT_SOURCE_CSR;
wed->wlan.wpdma_mask = base + MT_INT_MASK_CSR;
}
@@ -956,7 +953,7 @@
wed->wlan.nbuf = 7168;
wed->wlan.token_start = MT7915_TOKEN_SIZE - wed->wlan.nbuf;
wed->wlan.init_buf = mt7915_wed_init_buf;
-@@ -735,6 +751,12 @@ mt7915_pci_wed_init(struct mt7915_dev *dev, struct device *pdev, int *irq)
+@@ -735,12 +752,15 @@ mt7915_pci_wed_init(struct mt7915_dev *dev, struct device *pdev, int *irq)
wed->wlan.offload_enable = mt7915_wed_offload_enable;
wed->wlan.offload_disable = mt7915_wed_offload_disable;
@@ -969,11 +966,17 @@
if (mtk_wed_device_attach(wed) != 0)
return 0;
+- if (wed->ver == MTK_WED_V1)
+- wed->wlan.wpdma_phys = base + MT_WFDMA_EXT_CSR_BASE;
+-
+ *irq = wed->irq;
+ dev->mt76.dma_dev = wed->dev;
+ mdev->token_size = wed->wlan.token_start;
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index d7a2e594..e29d0cb6 100644
+index fe407c5..e2f0d41 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -68,6 +68,7 @@
+@@ -69,6 +69,7 @@
#define MT7915_MAX_STA_TWT_AGRT 8
#define MT7915_MIN_TWT_DUR 64
#define MT7915_MAX_QUEUE (__MT_RXQ_MAX + __MT_MCUQ_MAX + 2)
@@ -981,7 +984,7 @@
struct mt7915_vif;
struct mt7915_sta;
-@@ -530,7 +531,9 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
+@@ -531,7 +532,9 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
irqreturn_t mt7915_irq_handler(int irq, void *dev_instance);
u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif);
u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
@@ -992,7 +995,7 @@
int mt7915_register_device(struct mt7915_dev *dev);
void mt7915_unregister_device(struct mt7915_dev *dev);
int mt7915_eeprom_init(struct mt7915_dev *dev);
-@@ -681,7 +684,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+@@ -683,7 +686,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
struct mt76_tx_info *tx_info);
void mt7915_tx_token_put(struct mt7915_dev *dev);
void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
@@ -1002,7 +1005,7 @@
void mt7915_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
void mt7915_stats_work(struct work_struct *work);
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index ffda5f6b..08bf84ce 100644
+index ffda5f6..08bf84c 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -33,6 +33,9 @@ enum reg_rev {
@@ -1048,9 +1051,7 @@
#define MT_INT_SOURCE_CSR __REG(INT_SOURCE_CSR)
#define MT_INT_MASK_CSR __REG(INT_MASK_CSR)
diff --git a/mt7921/mac.c b/mt7921/mac.c
-old mode 100644
-new mode 100755
-index 247f5ebe..24cdd05f
+index 4fcadf8..4897940 100644
--- a/mt7921/mac.c
+++ b/mt7921/mac.c
@@ -555,7 +555,7 @@ out:
@@ -1063,9 +1064,7 @@
struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
__le32 *rxd = (__le32 *)skb->data;
diff --git a/mt7921/mt7921.h b/mt7921/mt7921.h
-old mode 100644
-new mode 100755
-index efeb82cb..4b2e974b
+index efeb82c..4b2e974 100644
--- a/mt7921/mt7921.h
+++ b/mt7921/mt7921.h
@@ -388,7 +388,7 @@ int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -1087,9 +1086,7 @@
int mt7921e_mac_reset(struct mt7921_dev *dev);
int mt7921e_mcu_init(struct mt7921_dev *dev);
diff --git a/mt7921/pci_mac.c b/mt7921/pci_mac.c
-old mode 100644
-new mode 100755
-index f6c605a5..71e21844
+index e180067..ca982eb 100644
--- a/mt7921/pci_mac.c
+++ b/mt7921/pci_mac.c
@@ -182,7 +182,7 @@ bool mt7921e_rx_check(struct mt76_dev *mdev, void *data, int len)
@@ -1111,10 +1108,10 @@
}
}
diff --git a/tx.c b/tx.c
-index 0457c3eb..9dae73b6 100644
+index ae44afe..bccd206 100644
--- a/tx.c
+++ b/tx.c
-@@ -768,3 +768,37 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake)
+@@ -767,3 +767,37 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake)
return txwi;
}
EXPORT_SYMBOL_GPL(mt76_token_release);
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9996-add-wed-tx-support-for-mt7986.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9996-add-wed-tx-support-for-mt7986.patch
index 8f3e2ca..1ba2c2b 100755
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9996-add-wed-tx-support-for-mt7986.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9996-add-wed-tx-support-for-mt7986.patch
@@ -63,7 +63,7 @@
{
struct device_node *mac_np;
struct mtk_eth *eth;
-+ struct resource *res;
++ struct resource *res = NULL;
int err, i;
eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL);
@@ -977,13 +977,17 @@
#define MTK_WDMA_DESC_CTRL_LEN0 GENMASK(29, 16)
#define MTK_WDMA_DESC_CTRL_LAST_SEG0 BIT(30)
#define MTK_WDMA_DESC_CTRL_DMA_DONE BIT(31)
-@@ -18,6 +24,10 @@ struct mtk_wdma_desc {
+@@ -18,6 +24,14 @@ struct mtk_wdma_desc {
__le32 info;
} __packed __aligned(4);
++#if defined(CONFIG_MEDIATEK_NETSYS_V2)
+#define MTK_WED_REV_ID 0x004
+#define MTK_WED_REV_ID_MAJOR GENMASK(31, 28)
-+#define MTK_WED_REV_ID_MINOR GENMASK(27, 16)
++#else
++#define MTK_WED_REV_ID 0x000
++#define MTK_WED_REV_ID_MAJOR GENMASK(7, 0)
++#endif
+
#define MTK_WED_RESET 0x008
#define MTK_WED_RESET_TX_BM BIT(0)
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9997-add-wed-rx-support-for-mt7896.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9997-add-wed-rx-support-for-mt7896.patch
index c435e05..bc87d67 100755
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9997-add-wed-rx-support-for-mt7896.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9997-add-wed-rx-support-for-mt7896.patch
@@ -492,11 +492,12 @@
wed_w32(dev, MTK_WED_WPDMA_INT_TRIGGER, 0);
wed_w32(dev, MTK_WED_WDMA_INT_TRIGGER, 0);
wdma_w32(dev, MTK_WDMA_INT_MASK, 0);
-@@ -416,9 +581,15 @@ mtk_wed_detach(struct mtk_wed_device *dev)
+@@ -416,9 +581,17 @@ mtk_wed_detach(struct mtk_wed_device *dev)
wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
mtk_wed_reset(dev, MTK_WED_RESET_WED);
-+ mtk_wed_wo_reset(dev);
++ if (dev->ver > MTK_WED_V1)
++ mtk_wed_wo_reset(dev);
+
+ wdma_clr(dev, MTK_WDMA_GLO_CFG, MTK_WDMA_GLO_CFG_TX_DMA_EN);
+ wdma_w32(dev, MTK_WDMA_RESET_IDX, MTK_WDMA_RESET_IDX_TX);
@@ -504,11 +505,12 @@
mtk_wed_free_buffer(dev);
mtk_wed_free_tx_rings(dev);
-+ mtk_wed_free_rx_rings(dev);
++ if (dev->ver > MTK_WED_V1)
++ mtk_wed_free_rx_rings(dev);
if (dev->wlan.bus_type == MTK_BUS_TYPE_PCIE) {
wlan_node = dev->wlan.pci_dev->dev.of_node;
-@@ -477,7 +648,6 @@ mtk_wed_bus_init(struct mtk_wed_device *dev)
+@@ -477,7 +650,6 @@ mtk_wed_bus_init(struct mtk_wed_device *dev)
value = wed_r32(dev, MTK_WED_PCIE_CFG_INTM);
value = wed_r32(dev, MTK_WED_PCIE_CFG_BASE);
@@ -516,7 +518,7 @@
wed_w32(dev, MTK_WED_PCIE_INT_TRIGGER, BIT(24));
wed_r32(dev, MTK_WED_PCIE_INT_TRIGGER);
-@@ -501,6 +671,9 @@ mtk_wed_set_wpdma(struct mtk_wed_device *dev)
+@@ -501,6 +673,9 @@ mtk_wed_set_wpdma(struct mtk_wed_device *dev)
wed_w32(dev, MTK_WED_WPDMA_CFG_INT_MASK, dev->wlan.wpdma_mask);
wed_w32(dev, MTK_WED_WPDMA_CFG_TX, dev->wlan.wpdma_tx);
wed_w32(dev, MTK_WED_WPDMA_CFG_TX_FREE, dev->wlan.wpdma_txfree);
@@ -627,7 +629,7 @@
rev_size = size;
thr = 0;
}
-@@ -609,13 +850,48 @@ mtk_wed_hw_init(struct mtk_wed_device *dev)
+@@ -609,13 +852,48 @@ mtk_wed_hw_init(struct mtk_wed_device *dev)
}
static void
@@ -678,7 +680,7 @@
desc->buf1 = 0;
desc->info = 0;
desc += scale;
-@@ -674,7 +950,7 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -674,7 +952,7 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
if (!desc)
continue;
@@ -687,7 +689,7 @@
}
if (mtk_wed_poll_busy(dev))
-@@ -729,9 +1005,24 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -729,9 +1007,24 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
}
@@ -713,7 +715,7 @@
{
ring->desc = dma_alloc_coherent(dev->hw->dev,
size * sizeof(*ring->desc) * scale,
-@@ -740,17 +1031,18 @@ mtk_wed_ring_alloc(struct mtk_wed_device *dev, struct mtk_wed_ring *ring,
+@@ -740,17 +1033,18 @@ mtk_wed_ring_alloc(struct mtk_wed_device *dev, struct mtk_wed_ring *ring,
return -ENOMEM;
ring->size = size;
@@ -735,7 +737,7 @@
return -ENOMEM;
wdma_w32(dev, MTK_WDMA_RING_RX(idx) + MTK_WED_RING_OFS_BASE,
-@@ -767,22 +1059,140 @@ mtk_wed_wdma_ring_setup(struct mtk_wed_device *dev, int idx, int size)
+@@ -767,22 +1061,143 @@ mtk_wed_wdma_ring_setup(struct mtk_wed_device *dev, int idx, int size)
return 0;
}
@@ -839,6 +841,9 @@
+{
+ struct mtk_wed_wo *wo = dev->hw->wed_wo;
+
++ if (dev->ver == MTK_WED_V1)
++ return 0;
++
+ return mtk_wed_mcu_send_msg(wo, MODULE_ID_WO, cmd_id, data, len, true);
+}
+
@@ -882,7 +887,7 @@
mtk_wed_set_ext_int(dev, true);
if (dev->ver == MTK_WED_V1) {
-@@ -797,6 +1207,19 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -797,6 +1212,19 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
val |= BIT(0);
regmap_write(dev->hw->mirror, dev->hw->index * 4, val);
} else {
@@ -902,7 +907,7 @@
mtk_wed_set_512_support(dev, true);
}
-@@ -841,9 +1264,17 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+@@ -841,9 +1269,17 @@ mtk_wed_attach(struct mtk_wed_device *dev)
wed_r32(dev, MTK_WED_REV_ID));
ret = mtk_wed_buffer_alloc(dev);
@@ -923,7 +928,7 @@
}
mtk_wed_hw_init_early(dev);
-@@ -851,7 +1282,12 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+@@ -851,7 +1287,12 @@ mtk_wed_attach(struct mtk_wed_device *dev)
if (dev->ver == MTK_WED_V1)
regmap_update_bits(hw->hifsys, HIFSYS_DMA_AG_MAP,
BIT(hw->index), 0);
@@ -936,7 +941,7 @@
out:
mutex_unlock(&hw_lock);
-@@ -877,10 +1313,10 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs)
+@@ -877,10 +1318,10 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs)
BUG_ON(idx > ARRAY_SIZE(dev->tx_ring));
@@ -949,7 +954,7 @@
return -ENOMEM;
ring->reg_base = MTK_WED_RING_TX(idx);
-@@ -927,6 +1363,35 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
+@@ -927,6 +1368,35 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
return 0;
}
@@ -985,7 +990,7 @@
static u32
mtk_wed_irq_get(struct mtk_wed_device *dev, u32 mask)
{
-@@ -1014,6 +1479,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1014,6 +1484,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
.attach = mtk_wed_attach,
.tx_ring_setup = mtk_wed_tx_ring_setup,
.txfree_ring_setup = mtk_wed_txfree_ring_setup,
@@ -994,7 +999,7 @@
.start = mtk_wed_start,
.stop = mtk_wed_stop,
.reset_dma = mtk_wed_reset_dma,
-@@ -1022,6 +1489,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1022,6 +1494,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
.irq_get = mtk_wed_irq_get,
.irq_set_mask = mtk_wed_irq_set_mask,
.detach = mtk_wed_detach,