[PATCH 11/18] wifi: mt76: mt7925: fix uninitialized is_mt7927_hw in probe
Javier Tia
floss at jetm.me
Fri Mar 6 16:33:30 PST 2026
is_mt7927_hw was declared at the top of mt7925_pci_probe() but only
assigned after its first use at the irq_map selection. The uninitialized
value (typically zero on x86_64) caused the mt7925 IRQ map to be selected
instead of mt7927_irq_map. With the wrong map the driver polls RX rings
0/2 instead of 4/6/7, so MCU responses are never received and every
command times out with "Failed to get patch semaphore".
Fix by initializing is_mt7927_hw at declaration from pdev->device.
Also remove a stale MT_WFDMA0_GLO_CFG_EXT1 define that pointed to the
wrong register address (MT_WFDMA0 base 0xd4000 instead of MT_UWFDMA0
base 0x24000). The correct BIT(28) write is already handled by
mt792x_dma_enable() via MT_UWFDMA0_GLO_CFG_EXT1.
Reported-by: 张旭涵 <Loong.0x00 at gmail.com>
Closes: https://github.com/jetm/mediatek-mt7927-dkms/issues/15
Tested-by: Marcin FM <marcin at lgic.pl>
Tested-by: Cristian-Florin Radoi <radoi.chris at gmail.com>
Tested-by: George Salukvadze <giosal90 at gmail.com>
Tested-by: Evgeny Kapusta <3193631 at gmail.com>
Tested-by: Samu Toljamo <samu.toljamo at gmail.com>
Tested-by: Ariel Rosenfeld <ariel.rosenfeld.750 at gmail.com>
Tested-by: Chapuis Dario <chapuisdario4 at gmail.com>
Tested-by: Thibaut François <tibo at humeurlibre.fr>
Tested-by: 张旭涵 <Loong.0x00 at gmail.com>
Signed-off-by: Javier Tia <floss at jetm.me>
---
drivers/net/wireless/mediatek/mt76/mt7925/pci.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
index 0f76d9197230..6275e78777b0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
@@ -418,7 +418,6 @@ static int mt7927_dma_init(struct mt792x_dev *dev)
/* MT7927-specific GLO_CFG bits before DMA enable */
mt76_set(dev, MT_WFDMA0_GLO_CFG, MT_WFDMA0_GLO_CFG_ADDR_EXT_EN);
mt76_clear(dev, MT_WFDMA0_GLO_CFG, MT_WFDMA0_GLO_CFG_CSR_LBK_RX_Q_SEL_EN);
- mt76_set(dev, MT_WFDMA0_GLO_CFG_EXT1, BIT(28));
mt76_set(dev, MT_WFDMA0_GLO_CFG,
MT_WFDMA0_GLO_CFG_FW_DWLD_BYPASS_DMASHDL);
@@ -489,7 +488,7 @@ static int mt7925_pci_probe(struct pci_dev *pdev,
struct mt76_bus_ops *bus_ops;
struct mt792x_dev *dev;
struct mt76_dev *mdev;
- bool is_mt7927_hw;
+ bool is_mt7927_hw = (pdev->device == 0x6639 || pdev->device == 0x7927);
u8 features;
int ret;
u16 cmd;
@@ -574,8 +573,6 @@ static int mt7925_pci_probe(struct pci_dev *pdev,
if (!mt7925_disable_aspm && mt76_pci_aspm_supported(pdev))
dev->aspm_supported = true;
- is_mt7927_hw = (pdev->device == 0x6639 || pdev->device == 0x7927);
-
ret = __mt792x_mcu_fw_pmctrl(dev);
if (ret)
goto err_free_dev;
--
2.53.0
More information about the Linux-mediatek
mailing list