[PATCH v1 2/2] PCI: dwc: Skip waiting for link up on probe

From: Sajid Dalvi
Date: Fri Feb 24 2023 - 14:58:31 EST


When the Root Complex is probed, the default behavior is to spin in a loop
waiting for the link to come up. In some systems the link is not brought up
during probe, but later in the context of an end-point turning on.

Call trace:
dw_pcie_wait_for_link << spins in a loop for 1 second
dw_pcie_host_init

Adding the snps,skip-wait-link-up property in the pcie device tree node
will skip this loop and save 1 second per interface on pcie probe for
systems that do not need to bring up the link this early in the boot
sequence.

Signed-off-by: Sajid Dalvi <sdalvi@xxxxxxxxxx>
Signed-off-by: Andrew Chant <achant@xxxxxxxxxx>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 3ab6ae3712c4..f5cba44ebf39 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -477,8 +477,9 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
goto err_free_msi;
}

- /* Ignore errors, the link may come up later */
- dw_pcie_wait_for_link(pci);
+ if (!of_property_read_bool(np, "snps,skip-wait-link-up"))
+ /* Ignore errors, the link may come up later */
+ dw_pcie_wait_for_link(pci);

bridge->sysdata = pp;

--
2.39.2.637.g21b0678d19-goog