[U-Boot] [PATCH 3/3] Powerpc: pcie: Make pcie link state judgement more specific
Bao Xiaowei
xiaowei.bao at nxp.com
Fri Oct 20 10:16:20 UTC 2017
For some special reset times for longer pcie devices, 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.
Signed-off-by: Bao Xiaowei <xiaowei.bao at nxp.com>
---
arch/powerpc/include/asm/fsl_pci.h | 2 ++
drivers/pci/fsl_pci_init.c | 10 ++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/include/asm/fsl_pci.h b/arch/powerpc/include/asm/fsl_pci.h
index 70a5461..323b182 100644
--- a/arch/powerpc/include/asm/fsl_pci.h
+++ b/arch/powerpc/include/asm/fsl_pci.h
@@ -25,6 +25,8 @@
#define PCI_LTSSM 0x404 /* PCIe Link Training, Status State Machine */
#define PCI_LTSSM_L0 0x16 /* L0 state */
#define PCI_LTSSM_L0_PEX_REV3 0x11 /* L0 state for pex rev3*/
+#define LTSSM_PCIE_DETECT_QUIET 0x00 /* Detect state */
+#define LTSSM_PCIE_DETECT_ACTIVE 0x01 /* Detect state */
int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);
int fsl_is_pci_agent(struct pci_controller *hose);
diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c
index be57e53..9b5f386 100644
--- a/drivers/pci/fsl_pci_init.c
+++ b/drivers/pci/fsl_pci_init.c
@@ -335,15 +335,17 @@ static int fsl_pci_link_up(struct pci_controller *hose,
pci_ltssm_l0 = PCI_LTSSM_L0;
ltssm = fsl_get_ltssm(hose, pci_info);
-
- if (ltssm == pci_ltssm_l0) {
+ if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
+ ltssm == LTSSM_PCIE_DETECT_ACTIVE) {
+ enabled = 0;
+ } else if (ltssm == pci_ltssm_l0) {
enabled = 1;
} else {
- for (i = 0; i < 100 && ltssm < pci_ltssm_l0; i++) {
+ for (i = 0; i < 100 && ltssm != pci_ltssm_l0; i++) {
ltssm = fsl_get_ltssm(hose, pci_info);
udelay(1000);
}
- enabled = ltssm >= pci_ltssm_l0;
+ enabled = (ltssm == pci_ltssm_l0) ? 1 : 0;
}
return enabled;
--
2.7.4
More information about the U-Boot
mailing list