[PATCH v2 3/3] PCI: tegra194: Notify Endpoint functions on PERST# assert
From: Manikanta Maddireddy
Date: Wed Oct 21 2026 - 02:20:44 EST
Tegra powers down the Endpoint controller when the host asserts PERST#.
Notify EPF drivers of link down before disabling the controller so their
link_down callbacks can quiesce outstanding work. For example,
pci_epf_test_link_down() synchronously cancels its command worker.
Without this notification, the worker can remain active after the
controller is powered down and while EPC resources are later removed.
Call pci_epc_linkdown() directly instead of dw_pcie_ep_linkdown(), which
also reinitializes non-sticky DWC registers through DBI when the host
may already have withdrawn REFCLK. The direct notification avoids that
common DWC register reinitialization. It does not guarantee that EPF
callbacks are register-free: they can access MMIO and must tolerate the
hardware state at PERST# assertion, including unavailable DBI access.
Signed-off-by: Manikanta Maddireddy <mmaddireddy@xxxxxxxxxx>
---
Changes V1 -> V2:
- Clarify that the direct notification avoids common DWC DBI register
reinitialization, but EPF callbacks may still access hardware.
- Add a comment explaining why dw_pcie_ep_linkdown() is not used.
- Drop the unrelated pci_epc_deinit_notify() pointer cleanup.
- Remove unrelated teardown and deferred-deinit discussion from the
commit message.
drivers/pci/controller/dwc/pcie-tegra194.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index 47a83a69533d..1eaefbbdd67a 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -1745,6 +1745,9 @@ static void pex_ep_event_pex_rst_assert(struct tegra_pcie_dw *pcie)
if (ret)
dev_info(pcie->dev, "LTSSM state: 0x%x detect timeout: %d\n", val, ret);
+ /* Avoid the DBI register reinitialization in dw_pcie_ep_linkdown(). */
+ pci_epc_linkdown(pcie->pci.ep.epc);
+
/*
* Deassert LTSSM state to stop the state toggling between
* Polling and Detect.
--
2.34.1