modifiy the ls_pcie_link_up function, add the following three judging mechanisms:
detect state: return link down status; L0 state: return link up status; other state: delay about 100ms retrieve Status Returns the corresponding link status; Signed-off-by: Bao Xiaowei <xiaowei....@nxp.com> --- drivers/pci/pcie_layerscape.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c index 7565e2f..4446ac9 100644 --- a/drivers/pci/pcie_layerscape.c +++ b/drivers/pci/pcie_layerscape.c @@ -65,13 +65,22 @@ 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) + if ((ltssm == 0) || (ltssm == 1)) return 0; - - return 1; + 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) -- 2.1.0.27.g96db324 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot