diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2015-06-02 17:24:25 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-06-10 14:52:46 -0400 |
commit | 1d3f9bac716a09af2d5d6e8601336ec9efcdccda (patch) | |
tree | 5de555733dd49bdb638b5b3fe393dad3670f8442 | |
parent | 1200edcbdd0434646fa8c8c99ab17e714ac4fa9d (diff) |
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>
-rw-r--r-- | drivers/pci/host/pci-layerscape.c | 19 |
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) | |||
62 | return 1; | 62 | return 1; |
63 | } | 63 | } |
64 | 64 | ||
65 | static void ls_pcie_host_init(struct pcie_port *pp) | 65 | static int ls_pcie_establish_link(struct pcie_port *pp) |
66 | { | 66 | { |
67 | struct ls_pcie *pcie = to_ls_pcie(pp); | ||
68 | int count = 0; | 67 | int count = 0; |
69 | u32 val; | ||
70 | |||
71 | dw_pcie_setup_rc(pp); | ||
72 | 68 | ||
73 | while (!dw_pcie_link_up(pp)) { | 69 | while (!dw_pcie_link_up(pp)) { |
74 | usleep_range(100, 1000); | 70 | usleep_range(100, 1000); |
75 | count++; | 71 | count++; |
76 | if (count >= 200) { | 72 | if (count >= 200) { |
77 | dev_err(pp->dev, "phy link never came up\n"); | 73 | dev_err(pp->dev, "phy link never came up\n"); |
78 | return; | 74 | return -EINVAL; |
79 | } | 75 | } |
80 | } | 76 | } |
81 | 77 | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static void ls_pcie_host_init(struct pcie_port *pp) | ||
82 | { | ||
83 | struct ls_pcie *pcie = to_ls_pcie(pp); | ||
84 | u32 val; | ||
85 | |||
86 | dw_pcie_setup_rc(pp); | ||
87 | ls_pcie_establish_link(pp); | ||
88 | |||
82 | /* | 89 | /* |
83 | * LS1021A Workaround for internal TKT228622 | 90 | * LS1021A Workaround for internal TKT228622 |
84 | * to fix the INTx hang issue | 91 | * to fix the INTx hang issue |