Search Linux Wireless

Re: [PATCH v2 2/2] wifi: mt76: mt7921e: add reboot notifier support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il 29/11/22 10:16, Deren Wu ha scritto:
From: Leon Yen <Leon.Yen@xxxxxxxxxxxx>

cleanup/reset chip fw before reboot to avoid unstable problems in next run.

Co-developed-by: Deren Wu <deren.wu@xxxxxxxxxxxx>
Signed-off-by: Deren Wu <deren.wu@xxxxxxxxxxxx>
Signed-off-by: Leon Yen <Leon.Yen@xxxxxxxxxxxx>

Apart from the comment in patch [1/1] ....

I've noticed that this issue is present also on MT7915E: in my case, I have
two of these cards installed on a nVidia Xavier NX Developer Kit and one on
a Raspberry Pi 4 Compute Module mounted on an original CM4 IO Board.

The two on Xavier NX are not showing this issue, but the Pi CM4 cannot see
the card when rebooting the system... so that chip cleanup action should
actually be replicated on mt7915/pci.c as well, if possible.

Regards,
Angelo

---
  .../net/wireless/mediatek/mt76/mt7921/pci.c   | 21 +++++++++++++++++++
  1 file changed, 21 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
index 28342ec940f0..4e9021c349b9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
@@ -226,6 +226,25 @@ static u32 mt7921_rmw(struct mt76_dev *mdev, u32 offset, u32 mask, u32 val)
  	return dev->bus_ops->rmw(mdev, addr, mask, val);
  }
+static int mt7921e_reboot_notifier(struct notifier_block *nb,
+				   unsigned long code, void *unused)
+{
+	struct mt76_dev *mdev = container_of(nb, struct mt76_dev,
+					     reboot_nb);
+	struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
+	struct mt76_connac_pm *pm = &dev->pm;
+
+	cancel_delayed_work_sync(&pm->ps_work);
+	cancel_work_sync(&pm->wake_work);
+
+	/* chip cleanup before reboot */
+	mt7921_mcu_drv_pmctrl(dev);
+	mt7921_dma_cleanup(dev);
+	mt7921_wfsys_reset(dev);
+
+	return NOTIFY_DONE;
+}
+
  static int mt7921_pci_probe(struct pci_dev *pdev,
  			    const struct pci_device_id *id)
  {
@@ -357,6 +376,8 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
  	if (ret)
  		goto err_free_irq;
+ mdev->reboot_nb.notifier_call = mt7921e_reboot_notifier;
+
  	ret = mt7921_register_device(dev);
  	if (ret)
  		goto err_free_irq;





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux