diff mbox series

[RESEND,V1,4/5] PCI: tegra: Don't allow suspend when Tegra PCIe is in EP mode

Message ID 20210527115246.20509-5-omp@nvidia.com (mailing list archive)
State Superseded
Delegated to: Lorenzo Pieralisi
Headers show
Series Update pcie-tegra194 driver | expand

Commit Message

Om Prakash Singh May 27, 2021, 11:52 a.m. UTC
When Tegra PCIe is in endpoint mode it should be available for root port.
PCIe link up by root port fails if it is in suspend state. So, don't allow
Tegra to suspend when endpoint mode is enabled.

Signed-off-by: Om Prakash Singh <omp@nvidia.com>
---
 drivers/pci/controller/dwc/pcie-tegra194.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Krzysztof Wilczy��ski May 27, 2021, 12:05 p.m. UTC | #1
Hi Prakash

[...]
> @@ -2276,6 +2276,11 @@ static int tegra_pcie_dw_suspend_late(struct device *dev)
[...]
> +	if (pcie->mode == DW_PCIE_EP_TYPE) {
> +		dev_err(dev, "Tegra PCIe is in EP mode, suspend not allowed");
> +		return -EPERM;
> +	}

Would the -EINVAL be more appropriate here?  It seem more appropriate
when something is an invalid operation, rather than access to the
resource being denied (or something along these lines), what do you
think?

	Krzysztof
Krzysztof Wilczy��ski May 27, 2021, 9 p.m. UTC | #2
Hi,

> > +	if (pcie->mode == DW_PCIE_EP_TYPE) {
> > +		dev_err(dev, "Tegra PCIe is in EP mode, suspend not allowed");
> > +		return -EPERM;
> > +	}
> 
> Would the -EINVAL be more appropriate here?  It seem more appropriate
> when something is an invalid operation, rather than access to the
> resource being denied (or something along these lines), what do you
> think?

After looking at this again, perhaps -ENOTSUPP would be a better fit,
and then the message could say that the suspend is not supported.

	Krzysztof
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index ae62fdc840e6..93c89f2084a7 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -2276,6 +2276,11 @@  static int tegra_pcie_dw_suspend_late(struct device *dev)
 	struct tegra_pcie_dw *pcie = dev_get_drvdata(dev);
 	u32 val;
 
+	if (pcie->mode == DW_PCIE_EP_TYPE) {
+		dev_err(dev, "Tegra PCIe is in EP mode, suspend not allowed");
+		return -EPERM;
+	}
+
 	if (!pcie->link_state)
 		return 0;