Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wireless] wifi: mt76: mt7921: check drv_pmctrl return in the PCIe reset path
@ 2026-08-09  1:23 Devin Wittmayer
  2026-08-13 12:37 ` moosager
  0 siblings, 1 reply; 2+ messages in thread
From: Devin Wittmayer @ 2026-08-09  1:23 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi
  Cc: linux-wireless, linux-mediatek, Ryder Lee, Shayne Chen, Sean Wang,
	Deren Wu, moosager

mt7921e_mac_reset() ignores what mt792xe_mcu_drv_pmctrl() returns. The
probe, suspend and resume paths all check it. The only other caller that
does not is mt7921e_unregister_device(), where the device is going away.

If the driver-own handshake does not complete, __mt792xe_mcu_drv_pmctrl()
gives up after MT792x_DRV_OWN_RETRY_COUNT and returns -EIO without
reinitialising WPDMA or clearing MT76_STATE_PM. The reset continues anyway,
writing interrupt enable registers, cycling NAPI, resetting WPDMA and
downloading firmware to a chip the driver does not own.

On an MT7922 with MT_CONN_ON_LPCTL held asserted, a triggered reset gave 8
ownership failures, each followed by an MCU timeout and a failed firmware
download:

  mt7921e 0000:04:00.0: driver own failed
  mt7921e 0000:04:00.0: Message 00000010 (seq 7) timeout
  mt7921e 0000:04:00.0: Failed to get patch semaphore

With the return checked, 26 ownership failures produced no firmware
download, and mt7921_mac_reset_work() got as far as logging "chip reset
failed", which it never did otherwise.

The call sits before any teardown, so returning early leaves NAPI and the
TX worker alone. This does not fix why the handshake fails.

Reported-by: moosager <moosager90@gmail.com>
Link: https://lore.kernel.org/linux-wireless/anG46qbvCqCHGF-f@fedora.fritz.box/
Fixes: dfc7743de1eb ("mt76: mt7921: refactor mcu.c to be bus independent")
Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca>
---
 drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
index 0db7acb3a637..c4261f66f469 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
@@ -57,7 +57,9 @@ int mt7921e_mac_reset(struct mt792x_dev *dev)
 {
 	int i, err;
 
-	mt792xe_mcu_drv_pmctrl(dev);
+	err = mt792xe_mcu_drv_pmctrl(dev);
+	if (err)
+		return err;
 
 	mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
 
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-13 12:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-09  1:23 [PATCH wireless] wifi: mt76: mt7921: check drv_pmctrl return in the PCIe reset path Devin Wittmayer
2026-08-13 12:37 ` moosager

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox