aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/fsl_pci.c
diff options
context:
space:
mode:
authorJohn Rigby <jrigby@freescale.com>2008-06-26 13:07:57 -0400
committerKumar Gala <galak@kernel.crashing.org>2008-07-16 18:57:35 -0400
commit76fe1ffce94067fc82d1d958f826eb9f1df53910 (patch)
treec6c6a7bdd6c7d6d2fb7374789868fed40d93fdd7 /arch/powerpc/sysdev/fsl_pci.c
parentb500563b22ea2a78760b2ccaa328426b0388e2ee (diff)
powerpc: Move mpc83xx_add_bridge to fsl_pci.c
This allows other platforms with the same pci block like MPC5121 to use it. Signed-off-by: John Rigby <jrigby@freescale.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev/fsl_pci.c')
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 87b0aa13ab4..61e6d77efa4 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -27,6 +27,7 @@
27#include <sysdev/fsl_soc.h> 27#include <sysdev/fsl_soc.h>
28#include <sysdev/fsl_pci.h> 28#include <sysdev/fsl_pci.h>
29 29
30#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx)
30/* atmu setup for fsl pci/pcie controller */ 31/* atmu setup for fsl pci/pcie controller */
31void __init setup_pci_atmu(struct pci_controller *hose, struct resource *rsrc) 32void __init setup_pci_atmu(struct pci_controller *hose, struct resource *rsrc)
32{ 33{
@@ -248,3 +249,63 @@ DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8536, quirk_fsl_pcie_header);
248DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_header); 249DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_header);
249DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641D, quirk_fsl_pcie_header); 250DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641D, quirk_fsl_pcie_header);
250DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header); 251DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header);
252#endif /* CONFIG_PPC_85xx || CONFIG_PPC_86xx */
253
254#if defined(CONFIG_PPC_83xx)
255int __init mpc83xx_add_bridge(struct device_node *dev)
256{
257 int len;
258 struct pci_controller *hose;
259 struct resource rsrc;
260 const int *bus_range;
261 int primary = 1, has_address = 0;
262 phys_addr_t immr = get_immrbase();
263
264 pr_debug("Adding PCI host bridge %s\n", dev->full_name);
265
266 /* Fetch host bridge registers address */
267 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
268
269 /* Get bus range if any */
270 bus_range = of_get_property(dev, "bus-range", &len);
271 if (bus_range == NULL || len < 2 * sizeof(int)) {
272 printk(KERN_WARNING "Can't get bus-range for %s, assume"
273 " bus 0\n", dev->full_name);
274 }
275
276 ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS;
277 hose = pcibios_alloc_controller(dev);
278 if (!hose)
279 return -ENOMEM;
280
281 hose->first_busno = bus_range ? bus_range[0] : 0;
282 hose->last_busno = bus_range ? bus_range[1] : 0xff;
283
284 /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar
285 * the other at 0x8600, we consider the 0x8500 the primary controller
286 */
287 /* PCI 1 */
288 if ((rsrc.start & 0xfffff) == 0x8500) {
289 setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304, 0);
290 }
291 /* PCI 2 */
292 if ((rsrc.start & 0xfffff) == 0x8600) {
293 setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384, 0);
294 primary = 0;
295 }
296
297 printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%016llx. "
298 "Firmware bus number: %d->%d\n",
299 (unsigned long long)rsrc.start, hose->first_busno,
300 hose->last_busno);
301
302 pr_debug(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
303 hose, hose->cfg_addr, hose->cfg_data);
304
305 /* Interpret the "ranges" property */
306 /* This also maps the I/O region and sets isa_io/mem_base */
307 pci_process_bridge_OF_ranges(hose, dev, primary);
308
309 return 0;
310}
311#endif /* CONFIG_PPC_83xx */