aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c29
-rw-r--r--arch/powerpc/sysdev/fsl_pci.h11
2 files changed, 37 insertions, 3 deletions
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 682084dba19b..3271177239b9 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -54,13 +54,35 @@ static void quirk_fsl_pcie_header(struct pci_dev *dev)
54 return; 54 return;
55} 55}
56 56
57static int __init fsl_pcie_check_link(struct pci_controller *hose) 57static int __init fsl_pcie_check_link(struct pci_controller *hose,
58 struct resource *rsrc)
58{ 59{
60 struct ccsr_pci __iomem *pci = NULL;
59 u32 val; 61 u32 val;
60 62
63 /* for PCIe IP rev 3.0 or greater use CSR0 for link state */
64 if (rsrc) {
65 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n",
66 (u64)rsrc->start, (u64)rsrc->end - (u64)rsrc->start + 1);
67 pci = ioremap(rsrc->start, rsrc->end - rsrc->start + 1);
68 if (!pci) {
69 dev_err(hose->parent, "Unable to map PCIe registers\n");
70 return -ENOMEM;
71 }
72 if (in_be32(&pci->block_rev1) >= PCIE_IP_REV_3_0) {
73 val = (in_be32(&pci->pex_csr0) & PEX_CSR0_LTSSM_MASK)
74 >> PEX_CSR0_LTSSM_SHIFT;
75 if (val != PEX_CSR0_LTSSM_L0)
76 return 1;
77 iounmap(pci);
78 return 0;
79 }
80 iounmap(pci);
81 }
61 early_read_config_dword(hose, 0, 0, PCIE_LTSSM, &val); 82 early_read_config_dword(hose, 0, 0, PCIE_LTSSM, &val);
62 if (val < PCIE_LTSSM_L0) 83 if (val < PCIE_LTSSM_L0)
63 return 1; 84 return 1;
85
64 return 0; 86 return 0;
65} 87}
66 88
@@ -483,7 +505,7 @@ int __init fsl_add_bridge(struct platform_device *pdev, int is_primary)
483 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) { 505 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) {
484 hose->indirect_type |= PPC_INDIRECT_TYPE_EXT_REG | 506 hose->indirect_type |= PPC_INDIRECT_TYPE_EXT_REG |
485 PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS; 507 PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS;
486 if (fsl_pcie_check_link(hose)) 508 if (fsl_pcie_check_link(hose, &rsrc))
487 hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK; 509 hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK;
488 } 510 }
489 511
@@ -685,7 +707,7 @@ static int __init mpc83xx_pcie_setup(struct pci_controller *hose,
685 out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAH, 0); 707 out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAH, 0);
686 out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAL, 0); 708 out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAL, 0);
687 709
688 if (fsl_pcie_check_link(hose)) 710 if (fsl_pcie_check_link(hose, NULL))
689 hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK; 711 hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK;
690 712
691 return 0; 713 return 0;
@@ -836,6 +858,7 @@ static const struct of_device_id pci_ids[] = {
836 { .compatible = "fsl,qoriq-pcie-v2.2", }, 858 { .compatible = "fsl,qoriq-pcie-v2.2", },
837 { .compatible = "fsl,qoriq-pcie-v2.3", }, 859 { .compatible = "fsl,qoriq-pcie-v2.3", },
838 { .compatible = "fsl,qoriq-pcie-v2.4", }, 860 { .compatible = "fsl,qoriq-pcie-v2.4", },
861 { .compatible = "fsl,qoriq-pcie-v3.0", },
839 862
840 /* 863 /*
841 * The following entries are for compatibility with older device 864 * The following entries are for compatibility with older device
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index c495c00c8740..c81bf4407b5e 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -17,6 +17,7 @@
17#define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */ 17#define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */
18#define PCIE_LTSSM_L0 0x16 /* L0 state */ 18#define PCIE_LTSSM_L0 0x16 /* L0 state */
19#define PCIE_IP_REV_2_2 0x02080202 /* PCIE IP block version Rev2.2 */ 19#define PCIE_IP_REV_2_2 0x02080202 /* PCIE IP block version Rev2.2 */
20#define PCIE_IP_REV_3_0 0x02080300 /* PCIE IP block version Rev3.0 */
20#define PIWAR_EN 0x80000000 /* Enable */ 21#define PIWAR_EN 0x80000000 /* Enable */
21#define PIWAR_PF 0x20000000 /* prefetch */ 22#define PIWAR_PF 0x20000000 /* prefetch */
22#define PIWAR_TGI_LOCAL 0x00f00000 /* target - local memory */ 23#define PIWAR_TGI_LOCAL 0x00f00000 /* target - local memory */
@@ -89,6 +90,16 @@ struct ccsr_pci {
89 __be32 pex_err_cap_r1; /* 0x.e2c - PCIE error capture register 0 */ 90 __be32 pex_err_cap_r1; /* 0x.e2c - PCIE error capture register 0 */
90 __be32 pex_err_cap_r2; /* 0x.e30 - PCIE error capture register 0 */ 91 __be32 pex_err_cap_r2; /* 0x.e30 - PCIE error capture register 0 */
91 __be32 pex_err_cap_r3; /* 0x.e34 - PCIE error capture register 0 */ 92 __be32 pex_err_cap_r3; /* 0x.e34 - PCIE error capture register 0 */
93 u8 res_e38[200];
94 __be32 pdb_stat; /* 0x.f00 - PCIE Debug Status */
95 u8 res_f04[16];
96 __be32 pex_csr0; /* 0x.f14 - PEX Control/Status register 0*/
97#define PEX_CSR0_LTSSM_MASK 0xFC
98#define PEX_CSR0_LTSSM_SHIFT 2
99#define PEX_CSR0_LTSSM_L0 0x11
100 __be32 pex_csr1; /* 0x.f18 - PEX Control/Status register 1*/
101 u8 res_f1c[228];
102
92}; 103};
93 104
94extern int fsl_add_bridge(struct platform_device *pdev, int is_primary); 105extern int fsl_add_bridge(struct platform_device *pdev, int is_primary);