summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2015-06-03 00:24:25 +0300
committerBjorn Helgaas <bhelgaas@google.com>2015-06-10 21:52:46 +0300
commit1d3f9bac716a09af2d5d6e8601336ec9efcdccda (patch)
tree5de555733dd49bdb638b5b3fe393dad3670f8442 /drivers/pci
parent1200edcbdd0434646fa8c8c99ab17e714ac4fa9d (diff)
downloadlinux-1d3f9bac716a09af2d5d6e8601336ec9efcdccda.tar.xz
PCI: layerscape: Factor out ls_pcie_establish_link()
All other DesignWare-based drivers have a *_establish_link() function. This functionality is trivial for Layerscape, but factor out a ls_pcie_establish_link() for consistency with the other 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')
-rw-r--r--drivers/pci/host/pci-layerscape.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c
index bb5894fb81d6..434b116f1a7e 100644
--- a/drivers/pci/host/pci-layerscape.c
+++ b/drivers/pci/host/pci-layerscape.c
@@ -62,23 +62,30 @@ static int ls_pcie_link_up(struct pcie_port *pp)
return 1;
}
-static void ls_pcie_host_init(struct pcie_port *pp)
+static int ls_pcie_establish_link(struct pcie_port *pp)
{
- struct ls_pcie *pcie = to_ls_pcie(pp);
int count = 0;
- u32 val;
-
- dw_pcie_setup_rc(pp);
while (!dw_pcie_link_up(pp)) {
usleep_range(100, 1000);
count++;
if (count >= 200) {
dev_err(pp->dev, "phy link never came up\n");
- return;
+ return -EINVAL;
}
}
+ return 0;
+}
+
+static void ls_pcie_host_init(struct pcie_port *pp)
+{
+ struct ls_pcie *pcie = to_ls_pcie(pp);
+ u32 val;
+
+ dw_pcie_setup_rc(pp);
+ ls_pcie_establish_link(pp);
+
/*
* LS1021A Workaround for internal TKT228622
* to fix the INTx hang issue