Re: [PATCH v7 09/13] PCI: tegra194: Allow system suspend when the Endpoint link is not up

From: Manivannan Sadhasivam

Date: Thu Mar 05 2026 - 05:29:46 EST


On Tue, Mar 03, 2026 at 12:24:44PM +0530, Manikanta Maddireddy wrote:
> From: Vidya Sagar <vidyas@xxxxxxxxxx>
>
> Only a Root Port initiates the L2 sequence. PCIe link is kept in L2 state

It is not Root Port, it is the host software which initiates the L2 entry
sequence.

And L2 is only guaranteed if the Vaux is available.

> during suspend. If Endpoint mode is enabled and the link is up, the
> software cannot proceed with suspend. However, when the PCIe Endpoint
> driver is probed, but the PCIe link is not up, Tegra can go into suspend
> state. So, allow system to suspend in this case.
>
> Fixes: de2bbf2b71bb ("PCI: tegra194: Don't allow suspend when Tegra PCIe is in EP mode")
> Reviewed-by: Jon Hunter <jonathanh@xxxxxxxxxx>
> Tested-by: Jon Hunter <jonathanh@xxxxxxxxxx>
> Signed-off-by: Vidya Sagar <vidyas@xxxxxxxxxx>
> Signed-off-by: Manikanta Maddireddy <mmaddireddy@xxxxxxxxxx>
> ---
> Changes V1 -> V7: None
>
> drivers/pci/controller/dwc/pcie-tegra194.c | 31 +++++++++++++++++-----
> 1 file changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
> index 5b79d3c28ba6..b2794be35cfe 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -2267,16 +2267,28 @@ static void tegra_pcie_dw_remove(struct platform_device *pdev)
> gpiod_set_value(pcie->pex_refclk_sel_gpiod, 0);
> }
>
> -static int tegra_pcie_dw_suspend_late(struct device *dev)
> +static int tegra_pcie_dw_suspend(struct device *dev)
> {
> struct tegra_pcie_dw *pcie = dev_get_drvdata(dev);
> - u32 val;
>
> if (pcie->of_data->mode == DW_PCIE_EP_TYPE) {
> - dev_err(dev, "Failed to Suspend as Tegra PCIe is in EP mode\n");
> - return -EPERM;
> + if (pcie->ep_state == EP_STATE_ENABLED) {
> + dev_err(dev, "Tegra PCIe is in EP mode, suspend not allowed\n");
> + return -EPERM;
> + }
> +
> + disable_irq(pcie->pex_rst_irq);

So you just disable PERST# IRQ during suspend? And even if the host deasserts
PERST#, EP is not going to wakeup?

Technically it is possible that whenever the EP wakes up, it will see PERST# IRQ
since PERST# is level triggered, but it just sounds dumb to let the endpoint
sleep after host deasserting PERST#.

- Mani

--
மணிவண்ணன் சதாசிவம்