summaryrefslogtreecommitdiff
path: root/drivers/pci/pcie_layerscape.c
diff options
context:
space:
mode:
authorBao Xiaowei <xiaowei.bao@nxp.com>2017-08-02 03:11:02 (GMT)
committerPrabhakar Kushwaha <prabhakar.kushwaha@nxp.com>2017-08-25 07:19:55 (GMT)
commita1ab389325578eb759ab0bcf4913d15c8b8ef0de (patch)
treedda3e7b399d3ecde54b5706890c8e7cd9421f691 /drivers/pci/pcie_layerscape.c
parent01d6e92f6d6e97c4e6412f4166cdec18c7da75dc (diff)
downloadu-boot-a1ab389325578eb759ab0bcf4913d15c8b8ef0de.tar.xz
PCI: layerscape: Make the pcie link up status judgement more specific
For some special reset times for longer pcie devices, in this case, the pcie device may on polling compliance state, the RC considers the pcie device is link up, but the pcie device is not link up, only the L0 state is link up state. So add the link up status judgement mechanisms. Signed-off-by: Bao Xiaowei <xiaowei.bao@nxp.com>
Diffstat (limited to 'drivers/pci/pcie_layerscape.c')
-rw-r--r--drivers/pci/pcie_layerscape.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c
index 610f85c..9a69107 100644
--- a/drivers/pci/pcie_layerscape.c
+++ b/drivers/pci/pcie_layerscape.c
@@ -69,13 +69,30 @@ static int ls_pcie_ltssm(struct ls_pcie *pcie)
static int ls_pcie_link_up(struct ls_pcie *pcie)
{
- int ltssm;
+ int ltssm, i;
ltssm = ls_pcie_ltssm(pcie);
- if (ltssm < LTSSM_PCIE_L0)
- return 0;
- return 1;
+ /*
+ * For some special reset times for longer pcie devices,
+ * the pcie device may on polling compliance state,
+ * on this state, if the device can restored to the L0 state
+ * within 100ms considers the pcie device is link up
+ */
+ if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
+ ltssm == LTSSM_PCIE_DETECT_ACTIVE) {
+ return 0;
+ } else if (ltssm == LTSSM_PCIE_L0) {
+ return 1;
+ } else {
+ for (i = 0; i < 100; i++) {
+ udelay(1000);
+ ltssm = ls_pcie_ltssm(pcie);
+ if (ltssm == LTSSM_PCIE_L0)
+ return 1;
+ }
+ return 0;
+ }
}
static void ls_pcie_cfg0_set_busdev(struct ls_pcie *pcie, u32 busdev)