]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76: mt792x: add PSE handling barrier for the large MCU cmd
authorSean Wang <sean.wang@mediatek.com>
Thu, 19 Feb 2026 00:40:02 +0000 (18:40 -0600)
committerFelix Fietkau <nbd@nbd.name>
Tue, 24 Mar 2026 15:49:29 +0000 (15:49 +0000)
Add a dummy register read in mt76_connac_mcu_rate_txpower_band() to act as
a PSE barrier. This would release PSE pages and prevents buffer underflow
issues when handling MCU commands with larger payloads without the response
in mt76_connac_mcu_set_rate_txpower().

This is a prerequisite patch before enabling MT7902 PCIe and SDIO support.

Co-developed-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-6-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
drivers/net/wireless/mediatek/mt76/mt792x_regs.h

index d7fbf3454bb8755d2e583e2617a5446de577ea78..89bd52ea8bf70424f94f7fd23616e22f02e47ae2 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/firmware.h>
 #include "mt76_connac2_mac.h"
 #include "mt76_connac_mcu.h"
+#include "mt792x_regs.h"
 
 int mt76_connac_mcu_start_firmware(struct mt76_dev *dev, u32 addr, u32 option)
 {
@@ -2246,6 +2247,9 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
                                            false);
                if (err < 0)
                        goto out;
+
+               /* read a CR to avoid PSE buffer underflow */
+               mt76_connac_mcu_reg_rr(dev, MT_PSE_BASE);
        }
 
 out:
index acf627aed609d614da189e4fcb7988aea5b30770..7ddde92868611ad059575b8fcf27b528c0ea4268 100644 (file)
@@ -25,6 +25,8 @@
 #define MT_PLE_AC_QEMPTY(_n)           MT_PLE(0x500 + 0x40 * (_n))
 #define MT_PLE_AMSDU_PACK_MSDU_CNT(n)  MT_PLE(0x10e0 + ((n) << 2))
 
+#define MT_PSE_BASE                    0x820c8000
+
 /* TMAC: band 0(0x21000), band 1(0xa1000) */
 #define MT_WF_TMAC_BASE(_band)         ((_band) ? 0x820f4000 : 0x820e4000)
 #define MT_WF_TMAC(_band, ofs)         (MT_WF_TMAC_BASE(_band) + (ofs))