diff mbox series

[V2,16/28] PCI: tegra: Set target speed as Gen1 before starting LTSSM

Message ID 20190423092825.759-17-mmaddireddy@nvidia.com
State Superseded
Delegated to: Lorenzo Pieralisi
Headers show
Series Enable Tegra PCIe root port features | expand

Commit Message

Manikanta Maddireddy April 23, 2019, 9:28 a.m. UTC
PCIe link up fails with few legacy endpoints if root port advertises both
Gen-1 and Gen-2 speeds in Tegra. This is because link number negotiation
fails if both Gen1 & Gen2 are advertised. Tegra doesn't retry link up by
advertising only Gen1. Hence, the strategy followed here is to initially
advertise only Gen-1 and after link is up, retrain link to Gen-2 speed.

Tegra doesn't support HW autonomous speed change. Link comes up in Gen1
even if Gen2 is advertised, so there is no downside of this change.

This behavior is observed with following two PCIe devices on Tegra,
 - Fusion HDTV 5 Express card
 - IOGear SIL - PCIE - SATA card

Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
---
V2: Updated commit log to reflect why this issue is observed on Tegra with
these particular cards

 drivers/pci/controller/pci-tegra.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Thierry Reding May 9, 2019, 2:23 p.m. UTC | #1
On Tue, Apr 23, 2019 at 02:58:13PM +0530, Manikanta Maddireddy wrote:
> PCIe link up fails with few legacy endpoints if root port advertises both
> Gen-1 and Gen-2 speeds in Tegra. This is because link number negotiation
> fails if both Gen1 & Gen2 are advertised. Tegra doesn't retry link up by
> advertising only Gen1. Hence, the strategy followed here is to initially
> advertise only Gen-1 and after link is up, retrain link to Gen-2 speed.
> 
> Tegra doesn't support HW autonomous speed change. Link comes up in Gen1
> even if Gen2 is advertised, so there is no downside of this change.
> 
> This behavior is observed with following two PCIe devices on Tegra,
>  - Fusion HDTV 5 Express card
>  - IOGear SIL - PCIE - SATA card
> 
> Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
> ---
> V2: Updated commit log to reflect why this issue is observed on Tegra with
> these particular cards
> 
>  drivers/pci/controller/pci-tegra.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Acked-by: Thierry Reding <treding@nvidia.com>
diff mbox series

Patch

diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index 7ab7d1387357..0de24cb66a71 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -676,6 +676,17 @@  static void tegra_pcie_apply_sw_fixup(struct tegra_pcie_port *port)
 		value |= soc->update_fc_threshold;
 		writel(value, port->base + RP_VEND_XP);
 	}
+
+	/*
+	 * PCIe link doesn't come up with few legacy PCIe endpoints if
+	 * root port advertises both Gen-1 and Gen-2 speeds in Tegra.
+	 * Hence, the strategy followed here is to initially advertise
+	 * only Gen-1 and after link is up, retrain link to Gen-2 speed
+	 */
+	value = readl(port->base + RP_LINK_CONTROL_STATUS_2);
+	value &= ~PCI_EXP_LNKSTA_CLS;
+	value |= PCI_EXP_LNKSTA_CLS_2_5GB;
+	writel(value, port->base + RP_LINK_CONTROL_STATUS_2);
 }
 
 static void tegra_pcie_port_enable(struct tegra_pcie_port *port)