blob: 4a0e51b5e9796457e39fe9cb7f846d1d1a8e00c6 [file] [log] [blame]
developere35b8e42023-10-16 11:04:00 +08001From 9ea9f8159f6d14dd41c65bf437cde772efcbb8ea Mon Sep 17 00:00:00 2001
developer3262bf82022-07-12 11:37:54 +08002From: Sujuan Chen <sujuan.chen@mediatek.com>
developer3d5faf22022-11-29 18:07:22 +08003Date: Fri, 25 Nov 2022 10:38:53 +0800
developere35b8e42023-10-16 11:04:00 +08004Subject: [PATCH 2000/2011] wifi: mt76: mt7915: wed: add wed tx support
developer3262bf82022-07-12 11:37:54 +08005
6Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
7---
developer81e9eb72023-03-14 14:09:34 +08008 mt76_connac.h | 1 +
developer004e50c2023-06-29 20:33:22 +08009 mt7915/mac.c | 10 +++++++---
developer81e9eb72023-03-14 14:09:34 +080010 mt7915/main.c | 4 ++--
11 mt7915/mmio.c | 5 +++--
12 mt7915/mt7915.h | 2 +-
developer004e50c2023-06-29 20:33:22 +080013 5 files changed, 14 insertions(+), 8 deletions(-)
developer3262bf82022-07-12 11:37:54 +080014
15diff --git a/mt76_connac.h b/mt76_connac.h
developere35b8e42023-10-16 11:04:00 +080016index 6f5cf18..76f9555 100644
developer3262bf82022-07-12 11:37:54 +080017--- a/mt76_connac.h
18+++ b/mt76_connac.h
developerad9333b2023-05-22 15:16:16 +080019@@ -130,6 +130,7 @@ struct mt76_connac_sta_key_conf {
developer3262bf82022-07-12 11:37:54 +080020 };
21
22 #define MT_TXP_MAX_BUF_NUM 6
23+#define MT_TXD_TXP_BUF_SIZE 128
24
25 struct mt76_connac_fw_txp {
26 __le16 flags;
developer3262bf82022-07-12 11:37:54 +080027diff --git a/mt7915/mac.c b/mt7915/mac.c
developere35b8e42023-10-16 11:04:00 +080028index e51440d..3c6b308 100644
developer3262bf82022-07-12 11:37:54 +080029--- a/mt7915/mac.c
30+++ b/mt7915/mac.c
developerdfb50982023-09-11 13:34:36 +080031@@ -869,9 +869,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
developer3262bf82022-07-12 11:37:54 +080032
33 txp->token = cpu_to_le16(token_id);
34 txp->nbuf = 1;
35- txp->buf[0] = cpu_to_le32(phys + MT_TXD_SIZE + sizeof(*txp));
36+ txp->buf[0] = cpu_to_le32(phys + MT_TXD_TXP_BUF_SIZE);
37
38- return MT_TXD_SIZE + sizeof(*txp);
39+ return MT_TXD_TXP_BUF_SIZE;
40 }
41
42 static void
developerdfb50982023-09-11 13:34:36 +080043@@ -920,6 +920,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
developer36936c32022-09-30 12:55:06 +080044 LIST_HEAD(free_list);
45 void *end = data + len;
46 bool v3, wake = false;
47+ bool with_txwi = true;
48 u16 total, count = 0;
49 u32 txd = le32_to_cpu(free->txd);
50 __le32 *cur_info;
developerdfb50982023-09-11 13:34:36 +080051@@ -1001,6 +1002,8 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
developer36936c32022-09-30 12:55:06 +080052 txwi = mt76_token_release(mdev, msdu, &wake);
53 if (!txwi)
54 continue;
55+ else
56+ with_txwi = false;
developerf1313102022-10-11 11:02:55 +080057
developerdfb50982023-09-11 13:34:36 +080058 txwi->jiffies = 0;
59
60@@ -1008,7 +1011,8 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
developer36936c32022-09-30 12:55:06 +080061 }
62 }
developer004e50c2023-06-29 20:33:22 +080063
developer36936c32022-09-30 12:55:06 +080064- mt7915_mac_tx_free_done(dev, &free_list, wake);
65+ if (!with_txwi)
66+ mt7915_mac_tx_free_done(dev, &free_list, wake);
67 }
developerf1313102022-10-11 11:02:55 +080068
developer36936c32022-09-30 12:55:06 +080069 static void
developer3262bf82022-07-12 11:37:54 +080070diff --git a/mt7915/main.c b/mt7915/main.c
developere35b8e42023-10-16 11:04:00 +080071index 5b4581c..7274b5d 100644
developer3262bf82022-07-12 11:37:54 +080072--- a/mt7915/main.c
73+++ b/mt7915/main.c
developere35b8e42023-10-16 11:04:00 +080074@@ -1685,14 +1685,14 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
developer3262bf82022-07-12 11:37:54 +080075 if (!mtk_wed_device_active(wed))
76 return -ENODEV;
77
78- if (msta->wcid.idx > 0xff)
79+ if (msta->wcid.idx > MT7915_WTBL_STA)
80 return -EIO;
81
82 path->type = DEV_PATH_MTK_WDMA;
83 path->dev = ctx->dev;
84 path->mtk_wdma.wdma_idx = wed->wdma_idx;
85 path->mtk_wdma.bss = mvif->mt76.idx;
developerf1313102022-10-11 11:02:55 +080086- path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? msta->wcid.idx : 0x3ff;
87+ path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff;
developer3262bf82022-07-12 11:37:54 +080088 path->mtk_wdma.queue = phy != &dev->phy;
89
90 ctx->dev = NULL;
developer3262bf82022-07-12 11:37:54 +080091diff --git a/mt7915/mmio.c b/mt7915/mmio.c
developere35b8e42023-10-16 11:04:00 +080092index b47bfff..cae8b81 100644
developer3262bf82022-07-12 11:37:54 +080093--- a/mt7915/mmio.c
94+++ b/mt7915/mmio.c
developerf3f5d9b2023-02-07 15:24:34 +080095@@ -13,7 +13,7 @@
developer3262bf82022-07-12 11:37:54 +080096 #include "../trace.h"
developer3d5faf22022-11-29 18:07:22 +080097 #include "../dma.h"
developer3262bf82022-07-12 11:37:54 +080098
developerf1313102022-10-11 11:02:55 +080099-static bool wed_enable;
developer3262bf82022-07-12 11:37:54 +0800100+static bool wed_enable = true;
developerf1313102022-10-11 11:02:55 +0800101 module_param(wed_enable, bool, 0644);
developer3d5faf22022-11-29 18:07:22 +0800102 MODULE_PARM_DESC(wed_enable, "Enable Wireless Ethernet Dispatch support");
developer3262bf82022-07-12 11:37:54 +0800103
developerdfb50982023-09-11 13:34:36 +0800104@@ -607,7 +607,7 @@ static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed)
developercaeb1a02022-10-12 18:25:15 +0800105 dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
106
107 spin_lock_bh(&dev->mt76.token_lock);
108- dev->mt76.token_size = MT7915_TOKEN_SIZE;
109+ dev->mt76.token_size = wed->wlan.token_start;//MT7915_TOKEN_SIZE
110 spin_unlock_bh(&dev->mt76.token_lock);
developer004e50c2023-06-29 20:33:22 +0800111 }
developercaeb1a02022-10-12 18:25:15 +0800112
developerdfb50982023-09-11 13:34:36 +0800113@@ -855,6 +855,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
developer3262bf82022-07-12 11:37:54 +0800114
developerf1313102022-10-11 11:02:55 +0800115 *irq = wed->irq;
116 dev->mt76.dma_dev = wed->dev;
117+ dev->mt76.token_size = wed->wlan.token_start;
developer3262bf82022-07-12 11:37:54 +0800118
developerf1313102022-10-11 11:02:55 +0800119 ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32));
developer3262bf82022-07-12 11:37:54 +0800120 if (ret)
developer81e9eb72023-03-14 14:09:34 +0800121diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
developere35b8e42023-10-16 11:04:00 +0800122index 72d6cc0..af9e3ae 100644
developer81e9eb72023-03-14 14:09:34 +0800123--- a/mt7915/mt7915.h
124+++ b/mt7915/mt7915.h
developerad9333b2023-05-22 15:16:16 +0800125@@ -62,7 +62,7 @@
developer81e9eb72023-03-14 14:09:34 +0800126 #define MT7916_EEPROM_SIZE 4096
127
128 #define MT7915_EEPROM_BLOCK_SIZE 16
129-#define MT7915_HW_TOKEN_SIZE 4096
130+#define MT7915_HW_TOKEN_SIZE 7168
131 #define MT7915_TOKEN_SIZE 8192
132
133 #define MT7915_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
developer3262bf82022-07-12 11:37:54 +0800134--
developerdfb50982023-09-11 13:34:36 +08001352.18.0
developer3262bf82022-07-12 11:37:54 +0800136