PCI: cadence: Fix Gen2 Link Retraining process
authorSiddharth Vadapalli <s-vadapalli@ti.com>
Wed, 15 Mar 2023 07:08:00 +0000 (12:38 +0530)
committerLorenzo Pieralisi <lpieralisi@kernel.org>
Mon, 8 May 2023 07:16:57 +0000 (09:16 +0200)
commit0e12f830236928b6fadf40d917a7527f0a048d2f
tree366b90c75126434d7825bf28b0eb03e9f25c2fa0
parentac9a78681b921877518763ba0e89202254349d1b
PCI: cadence: Fix Gen2 Link Retraining process

The Link Retraining process is initiated to account for the Gen2 defect in
the Cadence PCIe controller in J721E SoC. The errata corresponding to this
is i2085, documented at:
https://www.ti.com/lit/er/sprz455c/sprz455c.pdf

The existing workaround implemented for the errata waits for the Data Link
initialization to complete and assumes that the link retraining process
at the Physical Layer has completed. However, it is possible that the
Physical Layer training might be ongoing as indicated by the
PCI_EXP_LNKSTA_LT bit in the PCI_EXP_LNKSTA register.

Fix the existing workaround, to ensure that the Physical Layer training
has also completed, in addition to the Data Link initialization.

Link: https://lore.kernel.org/r/20230315070800.1615527-1-s-vadapalli@ti.com
Fixes: 4740b969aaf5 ("PCI: cadence: Retrain Link to work around Gen2 training defect")
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
drivers/pci/controller/cadence/pcie-cadence-host.c