diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2015-06-02 23:47:17 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-06-10 20:52:59 +0200 |
commit | 6cbb247e85eb4449d31a8dcb9b3f0464772b1395 (patch) | |
tree | 4a73b6883501b2ec7dba50fdc377c1fc60c961c2 /drivers/pci/host/pci-keystone.c | |
parent | PCI: layerscape: Factor out ls_pcie_establish_link() (diff) | |
download | linux-6cbb247e85eb4449d31a8dcb9b3f0464772b1395.tar.xz linux-6cbb247e85eb4449d31a8dcb9b3f0464772b1395.zip |
PCI: designware: Wait for link to come up with consistent style
All the DesignWare-based host drivers loop waiting for the link to come up,
but they do it several ways that are needlessly different.
Wait for the link to come up in a consistent style across all the
DesignWare drivers. No functional change.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Pratyush Anand <pratyush.anand@gmail.com>
Diffstat (limited to 'drivers/pci/host/pci-keystone.c')
-rw-r--r-- | drivers/pci/host/pci-keystone.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c index 75333b0c4f0a..b75d684aefcd 100644 --- a/drivers/pci/host/pci-keystone.c +++ b/drivers/pci/host/pci-keystone.c @@ -88,7 +88,7 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, quirk_limit_mrrs); static int ks_pcie_establish_link(struct keystone_pcie *ks_pcie) { struct pcie_port *pp = &ks_pcie->pp; - int count = 200; + unsigned int retries; dw_pcie_setup_rc(pp); @@ -99,17 +99,15 @@ static int ks_pcie_establish_link(struct keystone_pcie *ks_pcie) ks_dw_pcie_initiate_link_train(ks_pcie); /* check if the link is up or not */ - while (!dw_pcie_link_up(pp)) { + for (retries = 0; retries < 200; retries++) { + if (dw_pcie_link_up(pp)) + return 0; usleep_range(100, 1000); - if (--count) { - ks_dw_pcie_initiate_link_train(ks_pcie); - continue; - } - dev_err(pp->dev, "phy link never came up\n"); - return -EINVAL; + ks_dw_pcie_initiate_link_train(ks_pcie); } - return 0; + dev_err(pp->dev, "phy link never came up\n"); + return -EINVAL; } static void ks_pcie_msi_irq_handler(unsigned int irq, struct irq_desc *desc) |