* [PATCH mt76 2/6] wifi: mt76: mt7996: support critical packet mode for MT7990 chipsets
2026-03-12 9:57 [PATCH mt76 1/6] wifi: mt76: mt7996: fix RRO EMU configuration Shayne Chen
@ 2026-03-12 9:57 ` Shayne Chen
2026-03-12 10:42 ` Lorenzo Bianconi
2026-03-12 9:57 ` [PATCH mt76 3/6] wifi: mt76: mt7996: update WFSYS reset flow " Shayne Chen
` (4 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Shayne Chen @ 2026-03-12 9:57 UTC (permalink / raw)
To: Felix Fietkau
Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, Evelyn Tsai,
Money Wang, linux-mediatek, Howard Hsu, Shayne Chen
From: Howard Hsu <howard-yh.hsu@mediatek.com>
For MT7990 chipsets, critical packet mode must be enabled. Without this,
some higher priority packets may be placed in the wrong AC queue.
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7996/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index e1e51c9a0767..d286dedddd9b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -56,7 +56,7 @@ static int mt7996_start(struct ieee80211_hw *hw)
mutex_lock(&dev->mt76.mutex);
ret = mt7996_mcu_set_hdr_trans(dev, true);
- if (!ret && is_mt7992(&dev->mt76)) {
+ if (!ret && !is_mt7996(&dev->mt76)) {
u8 queue = mt76_connac_lmac_mapping(IEEE80211_AC_VI);
ret = mt7996_mcu_cp_support(dev, queue);
--
2.51.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH mt76 2/6] wifi: mt76: mt7996: support critical packet mode for MT7990 chipsets
2026-03-12 9:57 ` [PATCH mt76 2/6] wifi: mt76: mt7996: support critical packet mode for MT7990 chipsets Shayne Chen
@ 2026-03-12 10:42 ` Lorenzo Bianconi
0 siblings, 0 replies; 14+ messages in thread
From: Lorenzo Bianconi @ 2026-03-12 10:42 UTC (permalink / raw)
To: Shayne Chen
Cc: Felix Fietkau, linux-wireless, Ryder Lee, Evelyn Tsai, Money Wang,
linux-mediatek, Howard Hsu
[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]
> From: Howard Hsu <howard-yh.hsu@mediatek.com>
>
> For MT7990 chipsets, critical packet mode must be enabled. Without this,
> some higher priority packets may be placed in the wrong AC queue.
>
> Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
I guess we are missing a Fixes tag here.
Regards,
Lorenzo
> ---
> drivers/net/wireless/mediatek/mt76/mt7996/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
> index e1e51c9a0767..d286dedddd9b 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
> @@ -56,7 +56,7 @@ static int mt7996_start(struct ieee80211_hw *hw)
>
> mutex_lock(&dev->mt76.mutex);
> ret = mt7996_mcu_set_hdr_trans(dev, true);
> - if (!ret && is_mt7992(&dev->mt76)) {
> + if (!ret && !is_mt7996(&dev->mt76)) {
> u8 queue = mt76_connac_lmac_mapping(IEEE80211_AC_VI);
>
> ret = mt7996_mcu_cp_support(dev, queue);
> --
> 2.51.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH mt76 3/6] wifi: mt76: mt7996: update WFSYS reset flow for MT7990 chipsets
2026-03-12 9:57 [PATCH mt76 1/6] wifi: mt76: mt7996: fix RRO EMU configuration Shayne Chen
2026-03-12 9:57 ` [PATCH mt76 2/6] wifi: mt76: mt7996: support critical packet mode for MT7990 chipsets Shayne Chen
@ 2026-03-12 9:57 ` Shayne Chen
2026-03-12 10:42 ` Lorenzo Bianconi
2026-03-12 9:57 ` [PATCH mt76 4/6] wifi: mt76: mt7996: adjust timeout value for boot-up calibration commands Shayne Chen
` (3 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Shayne Chen @ 2026-03-12 9:57 UTC (permalink / raw)
To: Felix Fietkau
Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, Evelyn Tsai,
Money Wang, linux-mediatek, Peter Chiu, Shayne Chen
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Skip WFSYS reset during bootup for MT7990 chipsets; only reset if L0.5
recovery is triggered.
Without this fix, the following kernel error may occur:
Internal error: synchronous external abort.
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7996/init.c | 29 +++++++++++++++++--
.../net/wireless/mediatek/mt76/mt7996/regs.h | 8 +++++
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c
index f3239f530aea..8dfb81eabc9a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c
@@ -791,11 +791,34 @@ static void mt7996_init_work(struct work_struct *work)
void mt7996_wfsys_reset(struct mt7996_dev *dev)
{
- mt76_set(dev, MT_WF_SUBSYS_RST, 0x1);
- msleep(20);
+ if (!is_mt7990(&dev->mt76)) {
+ mt76_set(dev, MT_WF_SUBSYS_RST, 0x1);
+ msleep(20);
+
+ mt76_clear(dev, MT_WF_SUBSYS_RST, 0x1);
+ msleep(20);
+
+ return;
+ }
- mt76_clear(dev, MT_WF_SUBSYS_RST, 0x1);
+ if (!dev->recovery.hw_full_reset)
+ return;
+
+ mt76_set(dev, MT_WF_SUBSYS_RST,
+ MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT |
+ MT_WF_SUBSYS_RST_BYPASS_WFDMA_SLP_PROT |
+ MT_WF_SUBSYS_RST_BYPASS_WFDMA2_SLP_PROT);
+ mt76_rmw(dev, MT_WF_SUBSYS_RST,
+ MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE,
+ u32_encode_bits(0x20, MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE));
+ mt76_clear(dev, MT_WF_L05_RST, MT_WF_L05_RST_WF_RST_MASK);
+ mt76_set(dev, MT_WF_SUBSYS_RST, MT_WF_SUBSYS_RST_WHOLE_PATH_RST);
msleep(20);
+
+ if (mt76_poll(dev, MT_WF_L05_RST, MT_WF_L05_RST_WF_RST_MASK, 0x1a, 1000))
+ return;
+
+ dev_err(dev->mt76.dev, "wfsys reset fail\n");
}
static void mt7996_rro_hw_init_v3(struct mt7996_dev *dev)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/regs.h b/drivers/net/wireless/mediatek/mt76/mt7996/regs.h
index 393faae2d52b..c6379933b6c3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/regs.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/regs.h
@@ -736,7 +736,15 @@ enum offs_rev {
#define MT_HW_REV 0x70010204
#define MT_HW_REV1 0x8a00
+#define MT_WF_L05_RST 0x70028550
+#define MT_WF_L05_RST_WF_RST_MASK GENMASK(4, 0)
+
#define MT_WF_SUBSYS_RST 0x70028600
+#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST BIT(0)
+#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT BIT(5)
+#define MT_WF_SUBSYS_RST_BYPASS_WFDMA_SLP_PROT BIT(6)
+#define MT_WF_SUBSYS_RST_BYPASS_WFDMA2_SLP_PROT BIT(16)
+#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE GENMASK(15, 8)
/* PCIE MAC */
#define MT_PCIE_MAC_BASE 0x74030000
--
2.51.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH mt76 3/6] wifi: mt76: mt7996: update WFSYS reset flow for MT7990 chipsets
2026-03-12 9:57 ` [PATCH mt76 3/6] wifi: mt76: mt7996: update WFSYS reset flow " Shayne Chen
@ 2026-03-12 10:42 ` Lorenzo Bianconi
0 siblings, 0 replies; 14+ messages in thread
From: Lorenzo Bianconi @ 2026-03-12 10:42 UTC (permalink / raw)
To: Shayne Chen
Cc: Felix Fietkau, linux-wireless, Ryder Lee, Evelyn Tsai, Money Wang,
linux-mediatek, Peter Chiu
[-- Attachment #1: Type: text/plain, Size: 3068 bytes --]
> From: Peter Chiu <chui-hao.chiu@mediatek.com>
>
> Skip WFSYS reset during bootup for MT7990 chipsets; only reset if L0.5
> recovery is triggered.
> Without this fix, the following kernel error may occur:
> Internal error: synchronous external abort.
I guess we are missing a Fixes tag here.
Regards,
Lorenzo
>
> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
> ---
> .../net/wireless/mediatek/mt76/mt7996/init.c | 29 +++++++++++++++++--
> .../net/wireless/mediatek/mt76/mt7996/regs.h | 8 +++++
> 2 files changed, 34 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c
> index f3239f530aea..8dfb81eabc9a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c
> @@ -791,11 +791,34 @@ static void mt7996_init_work(struct work_struct *work)
>
> void mt7996_wfsys_reset(struct mt7996_dev *dev)
> {
> - mt76_set(dev, MT_WF_SUBSYS_RST, 0x1);
> - msleep(20);
> + if (!is_mt7990(&dev->mt76)) {
> + mt76_set(dev, MT_WF_SUBSYS_RST, 0x1);
> + msleep(20);
> +
> + mt76_clear(dev, MT_WF_SUBSYS_RST, 0x1);
> + msleep(20);
> +
> + return;
> + }
>
> - mt76_clear(dev, MT_WF_SUBSYS_RST, 0x1);
> + if (!dev->recovery.hw_full_reset)
> + return;
> +
> + mt76_set(dev, MT_WF_SUBSYS_RST,
> + MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT |
> + MT_WF_SUBSYS_RST_BYPASS_WFDMA_SLP_PROT |
> + MT_WF_SUBSYS_RST_BYPASS_WFDMA2_SLP_PROT);
> + mt76_rmw(dev, MT_WF_SUBSYS_RST,
> + MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE,
> + u32_encode_bits(0x20, MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE));
> + mt76_clear(dev, MT_WF_L05_RST, MT_WF_L05_RST_WF_RST_MASK);
> + mt76_set(dev, MT_WF_SUBSYS_RST, MT_WF_SUBSYS_RST_WHOLE_PATH_RST);
> msleep(20);
> +
> + if (mt76_poll(dev, MT_WF_L05_RST, MT_WF_L05_RST_WF_RST_MASK, 0x1a, 1000))
> + return;
> +
> + dev_err(dev->mt76.dev, "wfsys reset fail\n");
> }
>
> static void mt7996_rro_hw_init_v3(struct mt7996_dev *dev)
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/regs.h b/drivers/net/wireless/mediatek/mt76/mt7996/regs.h
> index 393faae2d52b..c6379933b6c3 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/regs.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/regs.h
> @@ -736,7 +736,15 @@ enum offs_rev {
> #define MT_HW_REV 0x70010204
> #define MT_HW_REV1 0x8a00
>
> +#define MT_WF_L05_RST 0x70028550
> +#define MT_WF_L05_RST_WF_RST_MASK GENMASK(4, 0)
> +
> #define MT_WF_SUBSYS_RST 0x70028600
> +#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST BIT(0)
> +#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT BIT(5)
> +#define MT_WF_SUBSYS_RST_BYPASS_WFDMA_SLP_PROT BIT(6)
> +#define MT_WF_SUBSYS_RST_BYPASS_WFDMA2_SLP_PROT BIT(16)
> +#define MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE GENMASK(15, 8)
>
> /* PCIE MAC */
> #define MT_PCIE_MAC_BASE 0x74030000
> --
> 2.51.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH mt76 4/6] wifi: mt76: mt7996: adjust timeout value for boot-up calibration commands
2026-03-12 9:57 [PATCH mt76 1/6] wifi: mt76: mt7996: fix RRO EMU configuration Shayne Chen
2026-03-12 9:57 ` [PATCH mt76 2/6] wifi: mt76: mt7996: support critical packet mode for MT7990 chipsets Shayne Chen
2026-03-12 9:57 ` [PATCH mt76 3/6] wifi: mt76: mt7996: update WFSYS reset flow " Shayne Chen
@ 2026-03-12 9:57 ` Shayne Chen
2026-03-12 10:43 ` Lorenzo Bianconi
2026-03-12 9:57 ` [PATCH mt76 5/6] wifi: mt76: mt7996: fix the temporary buffer for calibration-free data Shayne Chen
` (2 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Shayne Chen @ 2026-03-12 9:57 UTC (permalink / raw)
To: Felix Fietkau
Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, Evelyn Tsai,
Money Wang, linux-mediatek, Rex Lu, Shayne Chen
From: Rex Lu <rex.lu@mediatek.com>
Align the vendor driver by adjusting the timeout values for the
MCU_UNI_CMD_EFUSE_CTRL and MCU_UNI_CMD_EXT_EEPROM_CTRL commands.
Without this adjustment, false positive command timeout errors may occur,
especially on some iPA variants.
Signed-off-by: Rex Lu <rex.lu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
index bdb9e30c54c1..2a9c59d15894 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
@@ -271,7 +271,8 @@ mt7996_mcu_set_timeout(struct mt76_dev *mdev, int cmd)
mdev->mcu.timeout = 2 * HZ;
return;
case MCU_UNI_CMD_EFUSE_CTRL:
- mdev->mcu.timeout = 20 * HZ;
+ case MCU_UNI_CMD_EXT_EEPROM_CTRL:
+ mdev->mcu.timeout = 30 * HZ;
return;
default:
break;
--
2.51.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH mt76 4/6] wifi: mt76: mt7996: adjust timeout value for boot-up calibration commands
2026-03-12 9:57 ` [PATCH mt76 4/6] wifi: mt76: mt7996: adjust timeout value for boot-up calibration commands Shayne Chen
@ 2026-03-12 10:43 ` Lorenzo Bianconi
0 siblings, 0 replies; 14+ messages in thread
From: Lorenzo Bianconi @ 2026-03-12 10:43 UTC (permalink / raw)
To: Shayne Chen
Cc: Felix Fietkau, linux-wireless, Ryder Lee, Evelyn Tsai, Money Wang,
linux-mediatek, Rex Lu
[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]
> From: Rex Lu <rex.lu@mediatek.com>
>
> Align the vendor driver by adjusting the timeout values for the
> MCU_UNI_CMD_EFUSE_CTRL and MCU_UNI_CMD_EXT_EEPROM_CTRL commands.
> Without this adjustment, false positive command timeout errors may occur,
> especially on some iPA variants.
I guess we are missing a Fixes tag here.
Regards,
Lorenzo
>
> Signed-off-by: Rex Lu <rex.lu@mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
> ---
> drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> index bdb9e30c54c1..2a9c59d15894 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> @@ -271,7 +271,8 @@ mt7996_mcu_set_timeout(struct mt76_dev *mdev, int cmd)
> mdev->mcu.timeout = 2 * HZ;
> return;
> case MCU_UNI_CMD_EFUSE_CTRL:
> - mdev->mcu.timeout = 20 * HZ;
> + case MCU_UNI_CMD_EXT_EEPROM_CTRL:
> + mdev->mcu.timeout = 30 * HZ;
> return;
> default:
> break;
> --
> 2.51.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH mt76 5/6] wifi: mt76: mt7996: fix the temporary buffer for calibration-free data
2026-03-12 9:57 [PATCH mt76 1/6] wifi: mt76: mt7996: fix RRO EMU configuration Shayne Chen
` (2 preceding siblings ...)
2026-03-12 9:57 ` [PATCH mt76 4/6] wifi: mt76: mt7996: adjust timeout value for boot-up calibration commands Shayne Chen
@ 2026-03-12 9:57 ` Shayne Chen
2026-03-12 10:49 ` Lorenzo Bianconi
2026-03-12 9:57 ` [PATCH mt76 6/6] wifi: mt76: mt7996: fix issues with manually triggered radar detection Shayne Chen
2026-03-12 10:39 ` [PATCH mt76 1/6] wifi: mt76: mt7996: fix RRO EMU configuration Lorenzo Bianconi
5 siblings, 1 reply; 14+ messages in thread
From: Shayne Chen @ 2026-03-12 9:57 UTC (permalink / raw)
To: Felix Fietkau
Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, Evelyn Tsai,
Money Wang, linux-mediatek, StanleyYP Wang, Shayne Chen
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Move the declaration of buf[] outside the for loop.
Fixes: 224c7c2be578 ("wifi: mt76: mt7996: apply calibration-free data from OTP")
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
index 2a9c59d15894..4c733f51a03e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
@@ -4104,6 +4104,7 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev)
}
for (band = 0; band < __MT_MAX_BAND; band++) {
+ u8 buf[MT7996_EEPROM_BLOCK_SIZE];
const struct cal_free_data *cal;
u16 prev_block_idx = -1;
u16 adie_base;
@@ -4126,13 +4127,13 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev)
u16 eep_offset = cal[i].eep_offs;
u16 block_idx = adie_offset / MT7996_EEPROM_BLOCK_SIZE;
u16 offset = adie_offset % MT7996_EEPROM_BLOCK_SIZE;
- u8 buf[MT7996_EEPROM_BLOCK_SIZE];
if (is_mt7996(&dev->mt76) && band == MT_BAND1 &&
dev->var.type == MT7996_VAR_TYPE_444)
eep_offset -= MT_EE_7977BN_OFFSET;
if (prev_block_idx != block_idx) {
+ memset(buf, 0, sizeof(buf));
ret = mt7996_mcu_get_eeprom(dev, adie_offset, buf,
MT7996_EEPROM_BLOCK_SIZE,
EEPROM_MODE_EFUSE);
--
2.51.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH mt76 5/6] wifi: mt76: mt7996: fix the temporary buffer for calibration-free data
2026-03-12 9:57 ` [PATCH mt76 5/6] wifi: mt76: mt7996: fix the temporary buffer for calibration-free data Shayne Chen
@ 2026-03-12 10:49 ` Lorenzo Bianconi
2026-03-13 5:55 ` Shayne Chen (陳軒丞)
0 siblings, 1 reply; 14+ messages in thread
From: Lorenzo Bianconi @ 2026-03-12 10:49 UTC (permalink / raw)
To: Shayne Chen
Cc: Felix Fietkau, linux-wireless, Ryder Lee, Evelyn Tsai, Money Wang,
linux-mediatek, StanleyYP Wang
[-- Attachment #1: Type: text/plain, Size: 1939 bytes --]
> From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
>
> Move the declaration of buf[] outside the for loop.
>
> Fixes: 224c7c2be578 ("wifi: mt76: mt7996: apply calibration-free data from OTP")
> Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
> ---
> drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> index 2a9c59d15894..4c733f51a03e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> @@ -4104,6 +4104,7 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev)
> }
>
> for (band = 0; band < __MT_MAX_BAND; band++) {
> + u8 buf[MT7996_EEPROM_BLOCK_SIZE];
why are you moving buf here? It is only used in the inner block.
> const struct cal_free_data *cal;
> u16 prev_block_idx = -1;
> u16 adie_base;
> @@ -4126,13 +4127,13 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev)
> u16 eep_offset = cal[i].eep_offs;
> u16 block_idx = adie_offset / MT7996_EEPROM_BLOCK_SIZE;
> u16 offset = adie_offset % MT7996_EEPROM_BLOCK_SIZE;
> - u8 buf[MT7996_EEPROM_BLOCK_SIZE];
I think we should always define and initialize buf array here, otherwise we
could use it with uninitialized values. Something like:
u8 buf[MT7996_EEPROM_BLOCK_SIZE] = {};
Regards,
Lorenzo
>
> if (is_mt7996(&dev->mt76) && band == MT_BAND1 &&
> dev->var.type == MT7996_VAR_TYPE_444)
> eep_offset -= MT_EE_7977BN_OFFSET;
>
> if (prev_block_idx != block_idx) {
> + memset(buf, 0, sizeof(buf));
> ret = mt7996_mcu_get_eeprom(dev, adie_offset, buf,
> MT7996_EEPROM_BLOCK_SIZE,
> EEPROM_MODE_EFUSE);
> --
> 2.51.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH mt76 5/6] wifi: mt76: mt7996: fix the temporary buffer for calibration-free data
2026-03-12 10:49 ` Lorenzo Bianconi
@ 2026-03-13 5:55 ` Shayne Chen (陳軒丞)
0 siblings, 0 replies; 14+ messages in thread
From: Shayne Chen (陳軒丞) @ 2026-03-13 5:55 UTC (permalink / raw)
To: lorenzo@kernel.org
Cc: linux-wireless@vger.kernel.org, nbd@nbd.name, Ryder Lee,
Money Wang (王信安),
linux-mediatek@lists.infradead.org,
Evelyn Tsai (蔡珊鈺),
StanleyYP Wang (王侑邦)
On Thu, 2026-03-12 at 11:49 +0100, Lorenzo Bianconi wrote:
> > From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
> >
> > Move the declaration of buf[] outside the for loop.
> >
> > Fixes: 224c7c2be578 ("wifi: mt76: mt7996: apply calibration-free
> > data from OTP")
> > Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
> > Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
> > ---
> > drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> > b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> > index 2a9c59d15894..4c733f51a03e 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> > @@ -4104,6 +4104,7 @@ mt7996_mcu_get_cal_free_data(struct
> > mt7996_dev *dev)
> > }
> >
> > for (band = 0; band < __MT_MAX_BAND; band++) {
> > + u8 buf[MT7996_EEPROM_BLOCK_SIZE];
>
> why are you moving buf here? It is only used in the inner block.
>
> > const struct cal_free_data *cal;
> > u16 prev_block_idx = -1;
> > u16 adie_base;
> > @@ -4126,13 +4127,13 @@ mt7996_mcu_get_cal_free_data(struct
> > mt7996_dev *dev)
> > u16 eep_offset = cal[i].eep_offs;
> > u16 block_idx = adie_offset /
> > MT7996_EEPROM_BLOCK_SIZE;
> > u16 offset = adie_offset %
> > MT7996_EEPROM_BLOCK_SIZE;
> > - u8 buf[MT7996_EEPROM_BLOCK_SIZE];
>
> I think we should always define and initialize buf array here,
> otherwise we
> could use it with uninitialized values. Something like:
>
> u8 buf[MT7996_EEPROM_BLOCK_SIZE] = {};
>
Hi Lorenzo,
The buf array is updated only if the next offset is in a different
block. For example, offsets 0x4c and 0x4d have the same block index, so
0x4d will use the same buf data read by 0x4c, instead of reading it via
MCU command again.
So we need to preserve the values in the buf array, otherwise, it will
cause undefined behavior.
Thanks,
Shayne
> Regards,
> Lorenzo
>
> >
> > if (is_mt7996(&dev->mt76) && band ==
> > MT_BAND1 &&
> > dev->var.type == MT7996_VAR_TYPE_444)
> > eep_offset -= MT_EE_7977BN_OFFSET;
> >
> > if (prev_block_idx != block_idx) {
> > + memset(buf, 0, sizeof(buf));
> > ret = mt7996_mcu_get_eeprom(dev,
> > adie_offset, buf,
> >
> > MT7996_EEPROM_BLOCK_SIZE,
> >
> > EEPROM_MODE_EFUSE);
> > --
> > 2.51.0
> >
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH mt76 6/6] wifi: mt76: mt7996: fix issues with manually triggered radar detection
2026-03-12 9:57 [PATCH mt76 1/6] wifi: mt76: mt7996: fix RRO EMU configuration Shayne Chen
` (3 preceding siblings ...)
2026-03-12 9:57 ` [PATCH mt76 5/6] wifi: mt76: mt7996: fix the temporary buffer for calibration-free data Shayne Chen
@ 2026-03-12 9:57 ` Shayne Chen
2026-03-12 10:56 ` Lorenzo Bianconi
2026-03-12 10:39 ` [PATCH mt76 1/6] wifi: mt76: mt7996: fix RRO EMU configuration Lorenzo Bianconi
5 siblings, 1 reply; 14+ messages in thread
From: Shayne Chen @ 2026-03-12 9:57 UTC (permalink / raw)
To: Felix Fietkau
Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, Evelyn Tsai,
Money Wang, linux-mediatek, StanleyYP Wang, Shayne Chen
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Disallow triggering radar detection on non-DFS channels to prevent paused
TX queues from failing to resume, as a channel switch is not performed in
this case.
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
.../wireless/mediatek/mt76/mt7996/debugfs.c | 22 +++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
index 76d623b2cafb..e26bed6b97e7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
@@ -226,14 +226,23 @@ mt7996_radar_trigger(void *data, u64 val)
#define RADAR_BACKGROUND 2
struct mt7996_dev *dev = data;
struct mt7996_phy *phy = mt7996_band_phy(dev, NL80211_BAND_5GHZ);
- int rdd_idx;
+ struct cfg80211_chan_def *chandef;
+ int rdd_idx, ret;
if (!phy || !val || val > RADAR_BACKGROUND)
return -EINVAL;
- if (val == RADAR_BACKGROUND && !dev->rdd2_phy) {
- dev_err(dev->mt76.dev, "Background radar is not enabled\n");
- return -EINVAL;
+ if (test_bit(MT76_SCANNING, &phy->mt76->state))
+ return -EBUSY;
+
+ if (val == RADAR_BACKGROUND) {
+ if (!dev->rdd2_phy || !cfg80211_chandef_valid(&dev->rdd2_chandef)) {
+ dev_err(dev->mt76.dev, "Background radar is not enabled\n");
+ return -EINVAL;
+ }
+ chandef = &dev->rdd2_chandef;
+ } else {
+ chandef = &phy->mt76->chandef;
}
rdd_idx = mt7996_get_rdd_idx(phy, val == RADAR_BACKGROUND);
@@ -242,6 +251,11 @@ mt7996_radar_trigger(void *data, u64 val)
return -EINVAL;
}
+ ret = cfg80211_chandef_dfs_required(dev->mt76.hw->wiphy, chandef,
+ NL80211_IFTYPE_AP);
+ if (ret <= 0)
+ return ret;
+
return mt7996_mcu_rdd_cmd(dev, RDD_RADAR_EMULATE, rdd_idx, 0);
}
--
2.51.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH mt76 6/6] wifi: mt76: mt7996: fix issues with manually triggered radar detection
2026-03-12 9:57 ` [PATCH mt76 6/6] wifi: mt76: mt7996: fix issues with manually triggered radar detection Shayne Chen
@ 2026-03-12 10:56 ` Lorenzo Bianconi
2026-03-13 6:00 ` Shayne Chen
0 siblings, 1 reply; 14+ messages in thread
From: Lorenzo Bianconi @ 2026-03-12 10:56 UTC (permalink / raw)
To: Shayne Chen
Cc: Felix Fietkau, linux-wireless, Ryder Lee, Evelyn Tsai, Money Wang,
linux-mediatek, StanleyYP Wang
[-- Attachment #1: Type: text/plain, Size: 2250 bytes --]
> From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
>
> Disallow triggering radar detection on non-DFS channels to prevent paused
> TX queues from failing to resume, as a channel switch is not performed in
> this case.
I guess we are missing a Fixes tag here.
>
> Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
> ---
> .../wireless/mediatek/mt76/mt7996/debugfs.c | 22 +++++++++++++++----
> 1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
> index 76d623b2cafb..e26bed6b97e7 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
> @@ -226,14 +226,23 @@ mt7996_radar_trigger(void *data, u64 val)
> #define RADAR_BACKGROUND 2
> struct mt7996_dev *dev = data;
> struct mt7996_phy *phy = mt7996_band_phy(dev, NL80211_BAND_5GHZ);
> - int rdd_idx;
> + struct cfg80211_chan_def *chandef;
> + int rdd_idx, ret;
>
> if (!phy || !val || val > RADAR_BACKGROUND)
> return -EINVAL;
>
> - if (val == RADAR_BACKGROUND && !dev->rdd2_phy) {
> - dev_err(dev->mt76.dev, "Background radar is not enabled\n");
> - return -EINVAL;
> + if (test_bit(MT76_SCANNING, &phy->mt76->state))
> + return -EBUSY;
> +
> + if (val == RADAR_BACKGROUND) {
> + if (!dev->rdd2_phy || !cfg80211_chandef_valid(&dev->rdd2_chandef)) {
> + dev_err(dev->mt76.dev, "Background radar is not enabled\n");
nit: I guess it is better to specify a different error message if rdd2_chandef
is invalid.
Regards,
Lorenzo
> + return -EINVAL;
> + }
> + chandef = &dev->rdd2_chandef;
> + } else {
> + chandef = &phy->mt76->chandef;
> }
>
> rdd_idx = mt7996_get_rdd_idx(phy, val == RADAR_BACKGROUND);
> @@ -242,6 +251,11 @@ mt7996_radar_trigger(void *data, u64 val)
> return -EINVAL;
> }
>
> + ret = cfg80211_chandef_dfs_required(dev->mt76.hw->wiphy, chandef,
> + NL80211_IFTYPE_AP);
> + if (ret <= 0)
> + return ret;
> +
> return mt7996_mcu_rdd_cmd(dev, RDD_RADAR_EMULATE, rdd_idx, 0);
> }
>
> --
> 2.51.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH mt76 6/6] wifi: mt76: mt7996: fix issues with manually triggered radar detection
2026-03-12 10:56 ` Lorenzo Bianconi
@ 2026-03-13 6:00 ` Shayne Chen
0 siblings, 0 replies; 14+ messages in thread
From: Shayne Chen @ 2026-03-13 6:00 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Felix Fietkau, linux-wireless, Ryder Lee, Evelyn Tsai, Money Wang,
linux-mediatek, StanleyYP Wang
On Thu, 2026-03-12 at 11:56 +0100, Lorenzo Bianconi wrote:
> > From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
> >
> > Disallow triggering radar detection on non-DFS channels to prevent
> > paused
> > TX queues from failing to resume, as a channel switch is not
> > performed in
> > this case.
>
> I guess we are missing a Fixes tag here.
>
> >
> > Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
> > Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
> > ---
> > .../wireless/mediatek/mt76/mt7996/debugfs.c | 22
> > +++++++++++++++----
> > 1 file changed, 18 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
> > b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
> > index 76d623b2cafb..e26bed6b97e7 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
> > @@ -226,14 +226,23 @@ mt7996_radar_trigger(void *data, u64 val)
> > #define RADAR_BACKGROUND 2
> > struct mt7996_dev *dev = data;
> > struct mt7996_phy *phy = mt7996_band_phy(dev,
> > NL80211_BAND_5GHZ);
> > - int rdd_idx;
> > + struct cfg80211_chan_def *chandef;
> > + int rdd_idx, ret;
> >
> > if (!phy || !val || val > RADAR_BACKGROUND)
> > return -EINVAL;
> >
> > - if (val == RADAR_BACKGROUND && !dev->rdd2_phy) {
> > - dev_err(dev->mt76.dev, "Background radar is not
> > enabled\n");
> > - return -EINVAL;
> > + if (test_bit(MT76_SCANNING, &phy->mt76->state))
> > + return -EBUSY;
> > +
> > + if (val == RADAR_BACKGROUND) {
> > + if (!dev->rdd2_phy ||
> > !cfg80211_chandef_valid(&dev->rdd2_chandef)) {
> > + dev_err(dev->mt76.dev, "Background radar
> > is not enabled\n");
>
> nit: I guess it is better to specify a different error message if
> rdd2_chandef
> is invalid.
>
Will split the error message in v2.
Thanks,
Shayne
> Regards,
> Lorenzo
>
> > + return -EINVAL;
> > + }
> > + chandef = &dev->rdd2_chandef;
> > + } else {
> > + chandef = &phy->mt76->chandef;
> > }
> >
> > rdd_idx = mt7996_get_rdd_idx(phy, val ==
> > RADAR_BACKGROUND);
> > @@ -242,6 +251,11 @@ mt7996_radar_trigger(void *data, u64 val)
> > return -EINVAL;
> > }
> >
> > + ret = cfg80211_chandef_dfs_required(dev->mt76.hw->wiphy,
> > chandef,
> > + NL80211_IFTYPE_AP);
> > + if (ret <= 0)
> > + return ret;
> > +
> > return mt7996_mcu_rdd_cmd(dev, RDD_RADAR_EMULATE, rdd_idx,
> > 0);
> > }
> >
> > --
> > 2.51.0
> >
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH mt76 1/6] wifi: mt76: mt7996: fix RRO EMU configuration
2026-03-12 9:57 [PATCH mt76 1/6] wifi: mt76: mt7996: fix RRO EMU configuration Shayne Chen
` (4 preceding siblings ...)
2026-03-12 9:57 ` [PATCH mt76 6/6] wifi: mt76: mt7996: fix issues with manually triggered radar detection Shayne Chen
@ 2026-03-12 10:39 ` Lorenzo Bianconi
5 siblings, 0 replies; 14+ messages in thread
From: Lorenzo Bianconi @ 2026-03-12 10:39 UTC (permalink / raw)
To: Shayne Chen
Cc: Felix Fietkau, linux-wireless, Ryder Lee, Evelyn Tsai, Money Wang,
linux-mediatek, Peter Chiu
[-- Attachment #1: Type: text/plain, Size: 1983 bytes --]
> From: Peter Chiu <chui-hao.chiu@mediatek.com>
>
> Use the correct helper to update specific bitfields instead of
> overwriting the entire register.
>
> Fixes: eedb427eb260 ("wifi: mt76: mt7996: Enable HW RRO for MT7992 chipset")
> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> drivers/net/wireless/mediatek/mt76/mt7996/init.c | 3 +--
> drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 2 +-
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c
> index 5aaa93767109..f3239f530aea 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c
> @@ -873,8 +873,7 @@ void mt7996_rro_hw_init(struct mt7996_dev *dev)
> }
> } else {
> /* set emul 3.0 function */
> - mt76_wr(dev, MT_RRO_3_0_EMU_CONF,
> - MT_RRO_3_0_EMU_CONF_EN_MASK);
> + mt76_set(dev, MT_RRO_3_0_EMU_CONF, MT_RRO_3_0_EMU_CONF_EN_MASK);
>
> mt76_wr(dev, MT_RRO_ADDR_ARRAY_BASE0,
> dev->wed_rro.addr_elem[0].phy_addr);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> index a415cc610eee..86aaf0f29e28 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> @@ -2559,7 +2559,7 @@ void mt7996_mac_reset_work(struct work_struct *work)
> mt7996_dma_start(dev, false, false);
>
> if (!is_mt7996(&dev->mt76) && dev->mt76.hwrro_mode == MT76_HWRRO_V3)
> - mt76_wr(dev, MT_RRO_3_0_EMU_CONF, MT_RRO_3_0_EMU_CONF_EN_MASK);
> + mt76_set(dev, MT_RRO_3_0_EMU_CONF, MT_RRO_3_0_EMU_CONF_EN_MASK);
>
> if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
> u32 wed_irq_mask = MT_INT_TX_DONE_BAND2 |
> --
> 2.51.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread