Re: [PATCH v6 09/13] PCI: tegra194: Allow system suspend when the Endpoint link is not up
From: Vidya Sagar
Date: Fri Feb 27 2026 - 07:39:47 EST
On 24/02/26 00:11, Manikanta Maddireddy wrote:
> From: Vidya Sagar <vidyas@xxxxxxxxxx>
>
> Only a Root port initiates the L2 sequence. PCIe link is kept in L2 state
> 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")
> Signed-off-by: Vidya Sagar <vidyas@xxxxxxxxxx>
> Signed-off-by: Manikanta Maddireddy <mmaddireddy@xxxxxxxxxx>
> ---
> Changes V1 -> V6: 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 61cbb4f230e1..58069b1615b8 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -2266,16 +2266,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);
> + return 0;
> }
>
> + return 0;
> +}
> +
> +static int tegra_pcie_dw_suspend_late(struct device *dev)
> +{
> + struct tegra_pcie_dw *pcie = dev_get_drvdata(dev);
> + u32 val;
> +
> if (!pcie->link_state)
> return 0;
>
> @@ -2295,6 +2307,9 @@ static int tegra_pcie_dw_suspend_noirq(struct device *dev)
> {
> struct tegra_pcie_dw *pcie = dev_get_drvdata(dev);
>
> + if (pcie->of_data->mode == DW_PCIE_EP_TYPE)
> + return 0;
> +
> if (!pcie->link_state)
> return 0;
>
> @@ -2309,6 +2324,9 @@ static int tegra_pcie_dw_resume_noirq(struct device *dev)
> struct tegra_pcie_dw *pcie = dev_get_drvdata(dev);
> int ret;
>
> + if (pcie->of_data->mode == DW_PCIE_EP_TYPE)
> + return 0;
> +
> if (!pcie->link_state)
> return 0;
>
> @@ -2341,8 +2359,8 @@ static int tegra_pcie_dw_resume_early(struct device *dev)
> u32 val;
>
> if (pcie->of_data->mode == DW_PCIE_EP_TYPE) {
> - dev_err(dev, "Suspend is not supported in EP mode");
> - return -ENOTSUPP;
> + enable_irq(pcie->pex_rst_irq);
> + return 0;
> }
>
> if (!pcie->link_state)
> @@ -2447,6 +2465,7 @@ static const struct of_device_id tegra_pcie_dw_of_match[] = {
> };
>
> static const struct dev_pm_ops tegra_pcie_dw_pm_ops = {
> + .suspend = tegra_pcie_dw_suspend,
> .suspend_late = tegra_pcie_dw_suspend_late,
> .suspend_noirq = tegra_pcie_dw_suspend_noirq,
> .resume_noirq = tegra_pcie_dw_resume_noirq,
Reviewed-by: Vidya Sagar <vidyas@xxxxxxxxxx>