aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/86xx
diff options
context:
space:
mode:
authorZhang Wei <wei.zhang@freescale.com>2007-06-25 16:21:10 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-06-29 02:58:22 -0400
commite4725c23eca47b5dc0d0d128b9af288c0cd878f6 (patch)
treef5241f5c26b85c458a6fe67df97c3fcaebc419ba /arch/powerpc/platforms/86xx
parentab0f9ad34d1eb31bb13cc4218d7717f8a85b12ed (diff)
[POWERPC] 86xx: Avoid system halt if link training isn't at least L0.
We check the Link Training and State Status register to make sure we are at least at the L0 state. Signed-off-by: Zhang Wei <wei.zhang@freescale.com> Acked-by: Roy Zang <tie-fei.zang@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/86xx')
-rw-r--r--arch/powerpc/platforms/86xx/pci.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/86xx/pci.c b/arch/powerpc/platforms/86xx/pci.c
index 0db51e8ab5d4..3825e1ac5312 100644
--- a/arch/powerpc/platforms/86xx/pci.c
+++ b/arch/powerpc/platforms/86xx/pci.c
@@ -122,7 +122,6 @@ static void __init
122mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size) 122mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size)
123{ 123{
124 u16 cmd; 124 u16 cmd;
125 unsigned int temps;
126 125
127 DBG("PCIE host controller register offset 0x%08x, size 0x%08x.\n", 126 DBG("PCIE host controller register offset 0x%08x, size 0x%08x.\n",
128 pcie_offset, pcie_size); 127 pcie_offset, pcie_size);
@@ -135,6 +134,9 @@ mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size)
135 early_write_config_byte(hose, 0, 0, PCI_LATENCY_TIMER, 0x80); 134 early_write_config_byte(hose, 0, 0, PCI_LATENCY_TIMER, 0x80);
136} 135}
137 136
137#define PCIE_LTSSM 0x404 /* PCIe Link Training and Status */
138#define PCIE_LTSSM_L0 0x16 /* L0 state */
139
138int __init mpc86xx_add_bridge(struct device_node *dev) 140int __init mpc86xx_add_bridge(struct device_node *dev)
139{ 141{
140 int len; 142 int len;
@@ -143,6 +145,7 @@ int __init mpc86xx_add_bridge(struct device_node *dev)
143 const int *bus_range; 145 const int *bus_range;
144 int has_address = 0; 146 int has_address = 0;
145 int primary = 0; 147 int primary = 0;
148 u16 val;
146 149
147 DBG("Adding PCIE host bridge %s\n", dev->full_name); 150 DBG("Adding PCIE host bridge %s\n", dev->full_name);
148 151
@@ -159,12 +162,18 @@ int __init mpc86xx_add_bridge(struct device_node *dev)
159 if (!hose) 162 if (!hose)
160 return -ENOMEM; 163 return -ENOMEM;
161 hose->arch_data = dev; 164 hose->arch_data = dev;
165 hose->indirect_type = PPC_INDIRECT_TYPE_EXT_REG;
162 166
163 hose->first_busno = bus_range ? bus_range[0] : 0x0; 167 hose->first_busno = bus_range ? bus_range[0] : 0x0;
164 hose->last_busno = bus_range ? bus_range[1] : 0xff; 168 hose->last_busno = bus_range ? bus_range[1] : 0xff;
165 169
166 setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4); 170 setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4);
167 171
172 /* Probe the hose link training status */
173 early_read_config_word(hose, 0, 0, PCIE_LTSSM, &val);
174 if (val < PCIE_LTSSM_L0)
175 return -ENXIO;
176
168 /* Setup the PCIE host controller. */ 177 /* Setup the PCIE host controller. */
169 mpc86xx_setup_pcie(hose, rsrc.start, rsrc.end - rsrc.start + 1); 178 mpc86xx_setup_pcie(hose, rsrc.start, rsrc.end - rsrc.start + 1);
170 179