ANDROID: PCI: dwc: Wait for the link only if it has been started

In dw_pcie_host_init() regardless of whether the link has been
started or not, the code waits for the link to come up. Even in
cases where start_link() is not defined the code ends up spinning
in a loop for 1 second. Since in some systems dw_pcie_host_init()
gets called during probe, this one second loop for each pcie
interface instance ends up extending the boot time.

Wait for the link up in only if the start_link() is defined.

The patch submitted to the upstream kernel (see link below) was not
accepted due to no upstream user.

The change here is a simplified version of that patch, which will wait
for a link only if start_link ops has been defined.

Bug: 315052790
Link: https://lore.kernel.org/all/20240112093006.2832105-1-ajayagarwal@google.com/
Change-Id: I4e8d00f6195062728417e41ddd51072880676920
Signed-off-by: Sajid Dalvi <sdalvi@google.com>
This commit is contained in:
Sajid Dalvi 2024-02-20 13:20:17 -06:00 committed by Treehugger Robot
parent a7f647f49d
commit d6b58cc171

View file

@ -483,10 +483,12 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
ret = dw_pcie_start_link(pci);
if (ret)
goto err_free_msi;
}
/* Ignore errors, the link may come up later */
dw_pcie_wait_for_link(pci);
if (pci->ops && pci->ops->start_link) {
/* Ignore errors, the link may come up later */
dw_pcie_wait_for_link(pci);
}
}
bridge->sysdata = pp;