public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [net-next v2] net: wwan: t7xx: reset device if suspend fails
@ 2024-10-22  8:43 Jinjian Song
  2024-10-29  0:58 ` Sergey Ryazanov
  0 siblings, 1 reply; 8+ messages in thread
From: Jinjian Song @ 2024-10-22  8:43 UTC (permalink / raw)
  To: chandrashekar.devegowda, chiranjeevi.rapolu, haijun.liu,
	m.chetan.kumar, ricardo.martinez, loic.poulain, ryazanov.s.a,
	johannes, davem, edumazet, kuba, pabeni
  Cc: linux-kernel, netdev, linux-doc, angelogioacchino.delregno,
	linux-arm-kernel, matthias.bgg, corbet, linux-mediatek, helgaas,
	danielwinkler, korneld, Jinjian Song

If driver fails to set the device to suspend, it means that the
device is abnormal. In this case, reset the device to recover
when PCIe device is offline.

Signed-off-by: Jinjian Song <jinjian.song@fibocom.com>
---
V2:
 * Add judgment, reset when device is offline 
---
 drivers/net/wwan/t7xx/t7xx_pci.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wwan/t7xx/t7xx_pci.c b/drivers/net/wwan/t7xx/t7xx_pci.c
index e556e5bd49ab..4f89a353588b 100644
--- a/drivers/net/wwan/t7xx/t7xx_pci.c
+++ b/drivers/net/wwan/t7xx/t7xx_pci.c
@@ -427,6 +427,10 @@ static int __t7xx_pci_pm_suspend(struct pci_dev *pdev)
 	iowrite32(T7XX_L1_BIT(0), IREG_BASE(t7xx_dev) + ENABLE_ASPM_LOWPWR);
 	atomic_set(&t7xx_dev->md_pm_state, MTK_PM_RESUMED);
 	t7xx_pcie_mac_set_int(t7xx_dev, SAP_RGU_INT);
+	if (pci_channel_offline(pdev)) {
+		dev_err(&pdev->dev, "Device offline, reset to recover\n");
+		t7xx_reset_device(t7xx_dev, PLDR);
+	}
 	return ret;
 }
 
-- 
2.34.1



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

end of thread, other threads:[~2024-11-03 22:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22  8:43 [net-next v2] net: wwan: t7xx: reset device if suspend fails Jinjian Song
2024-10-29  0:58 ` Sergey Ryazanov
2024-10-29  3:46   ` Jinjian Song
2024-10-30 18:33     ` Sergey Ryazanov
2024-10-31 13:09       ` Jinjian Song
2024-10-31 17:04         ` Bjorn Helgaas
2024-11-03  1:24           ` Linas Vepstas
2024-11-03 22:02             ` Sergey Ryazanov

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