blob: a6ffa601ff7514db727132fabca1c0b32d45b018 [file] [log] [blame]
From 52c4cb0df8974126a52d907070fcd3205eb21c28 Mon Sep 17 00:00:00 2001
From: mtk27745 <rex.lu@mediatek.com>
Date: Fri, 6 Oct 2023 20:59:42 +0800
Subject: [PATCH 79/98] wifi: mt76: mt7996: support backaward compatiable
---
mmio.c | 2 +-
mt7996/dma.c | 2 +-
mt7996/main.c | 2 +-
mt7996/mcu.c | 2 +-
mt7996/mmio.c | 20 +++++++++++---------
mt7996/mt7996.h | 1 +
6 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/mmio.c b/mmio.c
index 22629af..aa6fe45 100644
--- a/mmio.c
+++ b/mmio.c
@@ -134,7 +134,7 @@ EXPORT_SYMBOL_GPL(mt76_mmio_wed_release_rx_buf);
u32 mt76_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
{
struct mt76_dev *dev = container_of(wed, struct mt76_dev, mmio.wed);
- struct mtk_wed_bm_desc *desc = wed->rx_buf_ring.desc;
+ struct mtk_rxbm_desc *desc = wed->rx_buf_ring.desc;
u32 length;
int i;
diff --git a/mt7996/dma.c b/mt7996/dma.c
index 1163550..326fd4b 100644
--- a/mt7996/dma.c
+++ b/mt7996/dma.c
@@ -430,7 +430,7 @@ int mt7996_dma_rro_init(struct mt7996_dev *dev)
irq_mask = mdev->mmio.irqmask | MT_INT_RRO_RX_DONE |
MT_INT_TX_DONE_BAND2;
mt76_wr(dev, MT_INT_MASK_CSR, irq_mask);
- mtk_wed_device_start_hw_rro(&mdev->mmio.wed, irq_mask, false);
+ mtk_wed_device_start_hwrro(&mdev->mmio.wed, irq_mask, false);
mt7996_irq_enable(dev, irq_mask);
return 0;
diff --git a/mt7996/main.c b/mt7996/main.c
index 2e0b1f1..44612e9 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -1545,7 +1545,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
path->mtk_wdma.queue = 0;
path->mtk_wdma.wcid = msta->wcid.idx;
- path->mtk_wdma.amsdu = mtk_wed_is_amsdu_supported(wed);
+ path->mtk_wdma.amsdu_en = mtk_wed_device_support_pao(wed);
ctx->dev = NULL;
return 0;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
index 1915a22..ea52e09 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -3171,7 +3171,7 @@ static int mt7996_mcu_wa_red_config(struct mt7996_dev *dev)
if (!mtk_wed_device_active(&dev->mt76.mmio.wed))
req.token_per_src[RED_TOKEN_SRC_CNT - 1] =
- cpu_to_le16(MT7996_TOKEN_SIZE - MT7996_HW_TOKEN_SIZE);
+ cpu_to_le16(MT7996_SW_TOKEN_SIZE);
return mt76_mcu_send_msg(&dev->mt76, MCU_WA_PARAM_CMD(SET),
&req, sizeof(req), false);
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
index 38b8843..ab7e58e 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -14,7 +14,7 @@
#include "../trace.h"
#include "../dma.h"
-static bool wed_enable;
+static bool wed_enable = true;
module_param(wed_enable, bool, 0644);
static const struct __base mt7996_reg_base[] = {
@@ -360,14 +360,14 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
}
wed->wlan.wpdma_rx_glo = wed->wlan.phy_base + hif1_ofs + MT_WFDMA0_GLO_CFG;
- wed->wlan.wpdma_rx = wed->wlan.phy_base + hif1_ofs +
+ wed->wlan.wpdma_rx[0] = wed->wlan.phy_base + hif1_ofs +
MT_RXQ_RING_BASE(MT7996_RXQ_BAND0) +
MT7996_RXQ_BAND0 * MT_RING_SIZE;
- wed->wlan.id = 0x7991;
+ wed->wlan.chip_id = 0x7991;
wed->wlan.tx_tbit[0] = ffs(MT_INT_TX_DONE_BAND2) - 1;
} else {
- wed->wlan.hw_rro = dev->has_rro; /* default on */
+ wed->wlan.hwrro = dev->has_rro; /* default on */
wed->wlan.wpdma_int = wed->wlan.phy_base + MT_INT_SOURCE_CSR;
wed->wlan.wpdma_mask = wed->wlan.phy_base + MT_INT_MASK_CSR;
wed->wlan.wpdma_tx = wed->wlan.phy_base + MT_TXQ_RING_BASE(0) +
@@ -375,7 +375,7 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
wed->wlan.wpdma_rx_glo = wed->wlan.phy_base + MT_WFDMA0_GLO_CFG;
- wed->wlan.wpdma_rx = wed->wlan.phy_base +
+ wed->wlan.wpdma_rx[0] = wed->wlan.phy_base +
MT_RXQ_RING_BASE(MT7996_RXQ_BAND0) +
MT7996_RXQ_BAND0 * MT_RING_SIZE;
@@ -417,11 +417,11 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
dev->mt76.rx_token_size = MT7996_TOKEN_SIZE + wed->wlan.rx_npkt;
}
- wed->wlan.nbuf = MT7996_HW_TOKEN_SIZE;
- wed->wlan.token_start = MT7996_TOKEN_SIZE - wed->wlan.nbuf;
+ wed->wlan.nbuf = MT7996_TOKEN_SIZE;
+ wed->wlan.token_start = 0;
- wed->wlan.amsdu_max_subframes = 8;
- wed->wlan.amsdu_max_len = 1536;
+ wed->wlan.max_amsdu_nums = 8;
+ wed->wlan.max_amsdu_len = 1536;
wed->wlan.init_buf = mt7996_wed_init_buf;
wed->wlan.init_rx_buf = mt76_mmio_wed_init_rx_buf;
@@ -442,6 +442,8 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
*irq = wed->irq;
dev->mt76.dma_dev = wed->dev;
+ dev->mt76.token_size = MT7996_SW_TOKEN_SIZE;
+
return 1;
#else
return 0;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
index ba73520..55a4087 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -67,6 +67,7 @@
#define MT7996_EEPROM_BLOCK_SIZE 16
#define MT7996_TOKEN_SIZE 16384
#define MT7996_HW_TOKEN_SIZE 8192
+#define MT7996_SW_TOKEN_SIZE 1024
#define MT7996_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
#define MT7996_CFEND_RATE_11B 0x03 /* 11B LP, 11M */
--
2.18.0