Re: [PATCH v6 13/13] PCI: tegra194: Free resources during controller deinitialization

From: Vidya Sagar

Date: Fri Feb 27 2026 - 07:41:47 EST


On 24/02/26 00:11, Manikanta Maddireddy wrote:
> From: Vidya Sagar <vidyas@xxxxxxxxxx>
>
> Call pci_epc_deinit_notify() during controller deinitialization to free the
> resources allocated by Endpoint function driver. This is safe to call
> during PCIe assert sequence because we don't expect Endpoint function
> driver to touch hardware in deinit function.
>
> Fixes: 40e2125381dc ("PCI: tegra194: Move controller cleanups to pex_ep_event_pex_rst_deassert()")
> Signed-off-by: Vidya Sagar <vidyas@xxxxxxxxxx>
> Signed-off-by: Manikanta Maddireddy <mmaddireddy@xxxxxxxxxx>
> ---
> Changes V5 -> V6: None
> Changes V4 -> V5: Remove pci_epc_deinit_notify() call from pex_ep_event_pex_rst_deassert()
> Changes V1 -> V4: None
>
> drivers/pci/controller/dwc/pcie-tegra194.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
> index 256a5d1eba16..9883d14f7f97 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -1627,12 +1627,16 @@ static int tegra_pcie_config_rp(struct tegra_pcie_dw *pcie)
>
> static void pex_ep_event_pex_rst_assert(struct tegra_pcie_dw *pcie)
> {
> + struct dw_pcie *pci = &pcie->pci;
> + struct dw_pcie_ep *ep = &pci->ep;
> u32 val;
> int ret;
>
> if (pcie->ep_state == EP_STATE_DISABLED)
> return;
>
> + pci_epc_deinit_notify(ep->epc);
> +
> ret = readl_poll_timeout(pcie->appl_base + APPL_DEBUG, val,
> ((val & APPL_DEBUG_LTSSM_STATE_MASK) == LTSSM_STATE_DETECT_QUIET) ||
> ((val & APPL_DEBUG_LTSSM_STATE_MASK) == LTSSM_STATE_DETECT_ACT) ||
> @@ -1795,7 +1799,6 @@ static void pex_ep_event_pex_rst_deassert(struct tegra_pcie_dw *pcie)
> reset_control_deassert(pcie->core_rst);
>
> /* Perform cleanup that requires refclk and core reset deasserted */
> - pci_epc_deinit_notify(pcie->pci.ep.epc);
> dw_pcie_ep_cleanup(&pcie->pci.ep);
>
> val = dw_pcie_readl_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL);

Reviewed-by: Vidya Sagar <vidyas@xxxxxxxxxx>