aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
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
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')
-rw-r--r--arch/powerpc/platforms/83xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/83xx/Makefile1
-rw-r--r--arch/powerpc/platforms/83xx/mpc831x_rdb.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_rdb.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_itx.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_mds.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_rdk.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc837x_mds.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc837x_rdb.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc83xx.h1
-rw-r--r--arch/powerpc/platforms/83xx/pci.c91
-rw-r--r--arch/powerpc/platforms/83xx/sbc834x.c1
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c61
-rw-r--r--arch/powerpc/sysdev/fsl_pci.h1
16 files changed, 73 insertions, 94 deletions
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index a95298810c1c..6159c5d4e5f1 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -3,7 +3,7 @@ menuconfig PPC_83xx
3 depends on 6xx && PPC_MULTIPLATFORM 3 depends on 6xx && PPC_MULTIPLATFORM
4 select PPC_UDBG_16550 4 select PPC_UDBG_16550
5 select PPC_PCI_CHOICE 5 select PPC_PCI_CHOICE
6 select PPC_INDIRECT_PCI 6 select FSL_PCI if PCI
7 select FSL_SOC 7 select FSL_SOC
8 select IPIC 8 select IPIC
9 9
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index 32c7ad13911c..ba5028e29890 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -2,7 +2,6 @@
2# Makefile for the PowerPC 83xx linux kernel. 2# Makefile for the PowerPC 83xx linux kernel.
3# 3#
4obj-y := misc.o usb.o 4obj-y := misc.o usb.o
5obj-$(CONFIG_PCI) += pci.o
6obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o 5obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o
7obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o 6obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o
8obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o 7obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o
diff --git a/arch/powerpc/platforms/83xx/mpc831x_rdb.c b/arch/powerpc/platforms/83xx/mpc831x_rdb.c
index c4db5172b27a..a428f8d1ac80 100644
--- a/arch/powerpc/platforms/83xx/mpc831x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc831x_rdb.c
@@ -19,6 +19,7 @@
19#include <asm/time.h> 19#include <asm/time.h>
20#include <asm/ipic.h> 20#include <asm/ipic.h>
21#include <asm/udbg.h> 21#include <asm/udbg.h>
22#include <sysdev/fsl_pci.h>
22 23
23#include "mpc83xx.h" 24#include "mpc83xx.h"
24 25
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 6dbc6eabcb02..dd4be4aee314 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -36,6 +36,7 @@
36#include <asm/prom.h> 36#include <asm/prom.h>
37#include <asm/udbg.h> 37#include <asm/udbg.h>
38#include <sysdev/fsl_soc.h> 38#include <sysdev/fsl_soc.h>
39#include <sysdev/fsl_pci.h>
39#include <asm/qe.h> 40#include <asm/qe.h>
40#include <asm/qe_ic.h> 41#include <asm/qe_ic.h>
41 42
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index e7f706b624fe..f049d692d4c8 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -27,6 +27,7 @@
27#include <asm/qe.h> 27#include <asm/qe.h>
28#include <asm/qe_ic.h> 28#include <asm/qe_ic.h>
29#include <sysdev/fsl_soc.h> 29#include <sysdev/fsl_soc.h>
30#include <sysdev/fsl_pci.h>
30 31
31#include "mpc83xx.h" 32#include "mpc83xx.h"
32 33
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 50e8f632061c..7301d77a08ee 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -35,6 +35,7 @@
35#include <asm/prom.h> 35#include <asm/prom.h>
36#include <asm/udbg.h> 36#include <asm/udbg.h>
37#include <sysdev/fsl_soc.h> 37#include <sysdev/fsl_soc.h>
38#include <sysdev/fsl_pci.h>
38 39
39#include "mpc83xx.h" 40#include "mpc83xx.h"
40 41
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index 2b8a0a3f8557..30d509aa9f08 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -35,6 +35,7 @@
35#include <asm/prom.h> 35#include <asm/prom.h>
36#include <asm/udbg.h> 36#include <asm/udbg.h>
37#include <sysdev/fsl_soc.h> 37#include <sysdev/fsl_soc.h>
38#include <sysdev/fsl_pci.h>
38 39
39#include "mpc83xx.h" 40#include "mpc83xx.h"
40 41
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index c2e5de60c055..75b80e836576 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -42,6 +42,7 @@
42#include <asm/prom.h> 42#include <asm/prom.h>
43#include <asm/udbg.h> 43#include <asm/udbg.h>
44#include <sysdev/fsl_soc.h> 44#include <sysdev/fsl_soc.h>
45#include <sysdev/fsl_pci.h>
45#include <asm/qe.h> 46#include <asm/qe.h>
46#include <asm/qe_ic.h> 47#include <asm/qe_ic.h>
47 48
diff --git a/arch/powerpc/platforms/83xx/mpc836x_rdk.c b/arch/powerpc/platforms/83xx/mpc836x_rdk.c
index c10dec4bf178..a5273bb28e1b 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_rdk.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_rdk.c
@@ -23,6 +23,7 @@
23#include <asm/qe.h> 23#include <asm/qe.h>
24#include <asm/qe_ic.h> 24#include <asm/qe_ic.h>
25#include <sysdev/fsl_soc.h> 25#include <sysdev/fsl_soc.h>
26#include <sysdev/fsl_pci.h>
26 27
27#include "mpc83xx.h" 28#include "mpc83xx.h"
28 29
diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c
index 64d17b0d6455..be62de23bead 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c
@@ -19,6 +19,7 @@
19#include <asm/ipic.h> 19#include <asm/ipic.h>
20#include <asm/udbg.h> 20#include <asm/udbg.h>
21#include <asm/prom.h> 21#include <asm/prom.h>
22#include <sysdev/fsl_pci.h>
22 23
23#include "mpc83xx.h" 24#include "mpc83xx.h"
24 25
diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
index c00356bdb1dd..da030afa2e2c 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
@@ -17,6 +17,7 @@
17#include <asm/time.h> 17#include <asm/time.h>
18#include <asm/ipic.h> 18#include <asm/ipic.h>
19#include <asm/udbg.h> 19#include <asm/udbg.h>
20#include <sysdev/fsl_pci.h>
20 21
21#include "mpc83xx.h" 22#include "mpc83xx.h"
22 23
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 88a3b5cabb18..393dfecdbf53 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -55,7 +55,6 @@
55 * mpc83xx_* files. Mostly for use by mpc83xx_setup 55 * mpc83xx_* files. Mostly for use by mpc83xx_setup
56 */ 56 */
57 57
58extern int mpc83xx_add_bridge(struct device_node *dev);
59extern void mpc83xx_restart(char *cmd); 58extern void mpc83xx_restart(char *cmd);
60extern long mpc83xx_time_init(void); 59extern long mpc83xx_time_init(void);
61extern int mpc834x_usb_cfg(void); 60extern int mpc834x_usb_cfg(void);
diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c
deleted file mode 100644
index 14f1080c6c9d..000000000000
--- a/arch/powerpc/platforms/83xx/pci.c
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * FSL SoC setup code
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/stddef.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/errno.h>
16#include <linux/pci.h>
17#include <linux/delay.h>
18#include <linux/irq.h>
19#include <linux/module.h>
20
21#include <asm/system.h>
22#include <asm/atomic.h>
23#include <asm/io.h>
24#include <asm/pci-bridge.h>
25#include <asm/prom.h>
26#include <sysdev/fsl_soc.h>
27
28#undef DEBUG
29
30#ifdef DEBUG
31#define DBG(x...) printk(x)
32#else
33#define DBG(x...)
34#endif
35
36int __init mpc83xx_add_bridge(struct device_node *dev)
37{
38 int len;
39 struct pci_controller *hose;
40 struct resource rsrc;
41 const int *bus_range;
42 int primary = 1, has_address = 0;
43 phys_addr_t immr = get_immrbase();
44
45 DBG("Adding PCI host bridge %s\n", dev->full_name);
46
47 /* Fetch host bridge registers address */
48 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
49
50 /* Get bus range if any */
51 bus_range = of_get_property(dev, "bus-range", &len);
52 if (bus_range == NULL || len < 2 * sizeof(int)) {
53 printk(KERN_WARNING "Can't get bus-range for %s, assume"
54 " bus 0\n", dev->full_name);
55 }
56
57 ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS;
58 hose = pcibios_alloc_controller(dev);
59 if (!hose)
60 return -ENOMEM;
61
62 hose->first_busno = bus_range ? bus_range[0] : 0;
63 hose->last_busno = bus_range ? bus_range[1] : 0xff;
64
65 /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar
66 * the other at 0x8600, we consider the 0x8500 the primary controller
67 */
68 /* PCI 1 */
69 if ((rsrc.start & 0xfffff) == 0x8500) {
70 setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304, 0);
71 }
72 /* PCI 2 */
73 if ((rsrc.start & 0xfffff) == 0x8600) {
74 setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384, 0);
75 primary = 0;
76 }
77
78 printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%016llx. "
79 "Firmware bus number: %d->%d\n",
80 (unsigned long long)rsrc.start, hose->first_busno,
81 hose->last_busno);
82
83 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
84 hose, hose->cfg_addr, hose->cfg_data);
85
86 /* Interpret the "ranges" property */
87 /* This also maps the I/O region and sets isa_io/mem_base */
88 pci_process_bridge_OF_ranges(hose, dev, primary);
89
90 return 0;
91}
diff --git a/arch/powerpc/platforms/83xx/sbc834x.c b/arch/powerpc/platforms/83xx/sbc834x.c
index cf382474a83d..fc21f5c15bab 100644
--- a/arch/powerpc/platforms/83xx/sbc834x.c
+++ b/arch/powerpc/platforms/83xx/sbc834x.c
@@ -37,6 +37,7 @@
37#include <asm/prom.h> 37#include <asm/prom.h>
38#include <asm/udbg.h> 38#include <asm/udbg.h>
39#include <sysdev/fsl_soc.h> 39#include <sysdev/fsl_soc.h>
40#include <sysdev/fsl_pci.h>
40 41
41#include "mpc83xx.h" 42#include "mpc83xx.h"
42 43
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 87b0aa13ab48..61e6d77efa4f 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 */
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index 37b04ad26571..13f30c2a61e7 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -83,6 +83,7 @@ struct ccsr_pci {
83 83
84extern int fsl_add_bridge(struct device_node *dev, int is_primary); 84extern int fsl_add_bridge(struct device_node *dev, int is_primary);
85extern void fsl_pcibios_fixup_bus(struct pci_bus *bus); 85extern void fsl_pcibios_fixup_bus(struct pci_bus *bus);
86extern int mpc83xx_add_bridge(struct device_node *dev);
86 87
87#endif /* __POWERPC_FSL_PCI_H */ 88#endif /* __POWERPC_FSL_PCI_H */
88#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */