net: wwan: t7xx: PCIe reset rescan
PATCH v2 3/5 net: wwan: t7xx: PCIe reset rescan
From: M Chetan Kumar <[email protected]>
PCI rescan module implements "rescan work queue". In firmware flashing or coredump collection procedure WWAN device is programmed to boot in fastboot mode and a work item is scheduled for removal & detection.
The WWAN device is reset using APCI call as part driver removal flow. Work queue rescans pci bus at fixed interval for device detection, later when device is detect work queue exits.
--
v2:
* Drop empty line inside critical sections.
* Correct log message.
* Correct logic inside t7xx_always_match().
* Drop hp_enable changes.
* Drop g_ prefix from t7xx_rescan_ctx.
* Use tab before comment in struct decl.
* Remove extra white space.
* Drop modem exception state check.
* Crit section newlines.
* Remove unnecessary header files inclusion.
* Drop spinlock around reset and rescan flow.
--- drivers/net/wwan/t7xx/Makefile | 3 +- drivers/net/wwan/t7xx/t7xx_modem_ops.c | 3 + drivers/net/wwan/t7xx/t7xx_pci.c | 56 ++++++++++++++- drivers/net/wwan/t7xx/t7xx_pci_rescan.c | 96 +++++++++++++++++++++++++ drivers/net/wwan/t7xx/t7xx_pci_rescan.h | 28 ++++++++ 5 files changed, 184 insertions(+), 2 deletions(-) create mode 100644 drivers/net/wwan/t7xx/t7xx_pci_rescan.c create mode 100644 drivers/net/wwan/t7xx/t7xx_pci_rescan.h
drivers/net/wwan/t7xx/Makefile +2 -1
@@ -17,7 +17,8 @@ mtk_t7xx-y:= t7xx_pci.o \ t7xx_hif_dpmaif_tx.o \ t7xx_hif_dpmaif_rx.o \ t7xx_dpmaif.o \ - t7xx_netdev.o + t7xx_netdev.o \ + t7xx_pci_rescan.o mtk_t7xx-$(CONFIG_WWAN_DEBUGFS) += \ t7xx_port_trace.o \
drivers/net/wwan/t7xx/t7xx_modem_ops.c +3 -0
@@ -37,6 +37,7 @@#include "t7xx_modem_ops.h" #include "t7xx_netdev.h" #include "t7xx_pci.h" +#include "t7xx_pci_rescan.h" #include "t7xx_pcie_mac.h" #include "t7xx_port.h" #include "t7xx_port_proxy.h"
@@ -194,6 +195,8 @@ static irqreturn_t t7xx_rgu_isr_thread(int irq, void *data)msleep (RGU_RESET_DELAY_MS );t7xx_reset_device_via_pmic (t7xx_dev); +t7xx_rescan_queue_work (t7xx_dev->pdev); +return IRQ_HANDLED ; }
drivers/net/wwan/t7xx/t7xx_pci.c +55 -1
74 lines not on this page · raw message
drivers/net/wwan/t7xx/t7xx_pci_rescan.c new file +96 -0
96 lines not on this page · raw message
drivers/net/wwan/t7xx/t7xx_pci_rescan.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only +* +* Copyright (c) 2021, MediaTek Inc. +* Copyright (c) 2021-2023, Intel Corporation. +*/ + +#ifndef __T7XX_PCI_RESCAN_H__ +#define __T7XX_PCI_RESCAN_H__ + +#define MTK_RESCAN_WQ "mtk_rescan_wq" + +#define DELAY_RESCAN_MTIME 1000 +#define RESCAN_RETRIES 35 + +struct remove_rescan_context { +struct work_struct service_task; +struct workqueue_struct *pcie_rescan_wq; +struct pci_dev *dev; +atomic_t rescan_done; +}; + +void t7xx_pci_dev_rescan (void ); +void t7xx_rescan_queue_work (struct pci_dev *pdev); +int t7xx_rescan_init (void ); +void t7xx_rescan_deinit (void ); +void t7xx_rescan_done (void ); + +#endif /* __T7XX_PCI_RESCAN_H__ */
Signature · 1 line
2.34.1