aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRoy Zang <tie-fei.zang@freescale.com>2007-07-10 06:47:06 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-07-23 11:27:08 -0400
commit3f6c5dae277d43b4fe2dd77a5984b0ef9aee52c6 (patch)
tree9a542f1c56624351ef042708b1933439757e11e5 /arch
parent344ffde71e65fb0ef4b73590015362005a59b3c0 (diff)
[POWERPC] Use Freescale pci/pcie common code for 85xx boards
Switch the 85xx platform over to using the FSL generic PCI code. This gets ups PCIe support in addition to base PCI support. Signed-off-by: Roy Zang <tie-fei.zang@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig5
-rw-r--r--arch/powerpc/platforms/85xx/Makefile2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx.h1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c3
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c14
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c6
-rw-r--r--arch/powerpc/platforms/85xx/pci.c91
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c7
8 files changed, 25 insertions, 104 deletions
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 629926e01e90..526ddde2f186 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -50,9 +50,10 @@ config MPC8560
50config MPC85xx 50config MPC85xx
51 bool 51 bool
52 select PPC_UDBG_16550 52 select PPC_UDBG_16550
53 select PPC_INDIRECT_PCI 53 select PPC_INDIRECT_PCI if PCI
54 select PPC_INDIRECT_PCI_BE 54 select PPC_INDIRECT_PCI_BE if PCI
55 select MPIC 55 select MPIC
56 select FSL_PCI if PCI
56 select SERIAL_8250_SHARE_IRQ if SERIAL_8250 57 select SERIAL_8250_SHARE_IRQ if SERIAL_8250
57 default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS \ 58 default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS \
58 || MPC85xx_MDS || MPC8544_DS 59 || MPC85xx_MDS || MPC8544_DS
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 4e02cbb14cf7..d70f2d0f9d36 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for the PowerPC 85xx linux kernel. 2# Makefile for the PowerPC 85xx linux kernel.
3# 3#
4obj-$(CONFIG_PPC_85xx) += misc.o pci.o 4obj-$(CONFIG_PPC_85xx) += misc.o
5obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o 5obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
6obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o 6obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
7obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o 7obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
diff --git a/arch/powerpc/platforms/85xx/mpc85xx.h b/arch/powerpc/platforms/85xx/mpc85xx.h
index 7286ffac2c1d..5b34deef12b5 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx.h
+++ b/arch/powerpc/platforms/85xx/mpc85xx.h
@@ -15,4 +15,3 @@
15 */ 15 */
16 16
17extern void mpc85xx_restart(char *); 17extern void mpc85xx_restart(char *);
18extern int mpc85xx_add_bridge(struct device_node *dev);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 7235f702394c..40a828675c7b 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -29,6 +29,7 @@
29#include <asm/udbg.h> 29#include <asm/udbg.h>
30 30
31#include <sysdev/fsl_soc.h> 31#include <sysdev/fsl_soc.h>
32#include <sysdev/fsl_pci.h>
32#include "mpc85xx.h" 33#include "mpc85xx.h"
33 34
34#ifdef CONFIG_CPM2 35#ifdef CONFIG_CPM2
@@ -217,7 +218,7 @@ static void __init mpc85xx_ads_setup_arch(void)
217 218
218#ifdef CONFIG_PCI 219#ifdef CONFIG_PCI
219 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) 220 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
220 mpc85xx_add_bridge(np); 221 fsl_add_bridge(np, 1);
221 ppc_md.pci_exclude_device = mpc85xx_exclude_device; 222 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
222#endif 223#endif
223} 224}
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 50c8d6458362..2539bb560694 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -45,6 +45,7 @@
45#include <asm/i8259.h> 45#include <asm/i8259.h>
46 46
47#include <sysdev/fsl_soc.h> 47#include <sysdev/fsl_soc.h>
48#include <sysdev/fsl_pci.h>
48#include "mpc85xx.h" 49#include "mpc85xx.h"
49 50
50static int cds_pci_slot = 2; 51static int cds_pci_slot = 2;
@@ -58,8 +59,6 @@ static volatile u8 *cadmus;
58static int mpc85xx_exclude_device(struct pci_controller *hose, 59static int mpc85xx_exclude_device(struct pci_controller *hose,
59 u_char bus, u_char devfn) 60 u_char bus, u_char devfn)
60{ 61{
61 if ((bus == hose->first_busno) && PCI_SLOT(devfn) == 0)
62 return PCIBIOS_DEVICE_NOT_FOUND;
63 /* We explicitly do not go past the Tundra 320 Bridge */ 62 /* We explicitly do not go past the Tundra 320 Bridge */
64 if ((bus == 1) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL)) 63 if ((bus == 1) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL))
65 return PCIBIOS_DEVICE_NOT_FOUND; 64 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -218,9 +217,14 @@ static void __init mpc85xx_cds_setup_arch(void)
218 } 217 }
219 218
220#ifdef CONFIG_PCI 219#ifdef CONFIG_PCI
221 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) 220 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) {
222 mpc85xx_add_bridge(np); 221 struct resource rsrc;
223 222 of_address_to_resource(np, 0, &rsrc);
223 if ((rsrc.start & 0xfffff) == 0x9000)
224 fsl_add_bridge(np, 0);
225 else
226 fsl_add_bridge(np, 1);
227 }
224 ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup; 228 ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup;
225 ppc_md.pci_exclude_device = mpc85xx_exclude_device; 229 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
226#endif 230#endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 004b80bd0b84..9aa96f065b25 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -46,6 +46,7 @@
46#include <asm/prom.h> 46#include <asm/prom.h>
47#include <asm/udbg.h> 47#include <asm/udbg.h>
48#include <sysdev/fsl_soc.h> 48#include <sysdev/fsl_soc.h>
49#include <sysdev/fsl_pci.h>
49#include <asm/qe.h> 50#include <asm/qe.h>
50#include <asm/qe_ic.h> 51#include <asm/qe_ic.h>
51#include <asm/mpic.h> 52#include <asm/mpic.h>
@@ -94,9 +95,8 @@ static void __init mpc85xx_mds_setup_arch(void)
94 } 95 }
95 96
96#ifdef CONFIG_PCI 97#ifdef CONFIG_PCI
97 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) { 98 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
98 mpc85xx_add_bridge(np); 99 fsl_add_bridge(np, 1);
99 }
100 of_node_put(np); 100 of_node_put(np);
101#endif 101#endif
102 102
diff --git a/arch/powerpc/platforms/85xx/pci.c b/arch/powerpc/platforms/85xx/pci.c
deleted file mode 100644
index 8118417b7364..000000000000
--- a/arch/powerpc/platforms/85xx/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
36#ifdef CONFIG_PCI
37int __init mpc85xx_add_bridge(struct device_node *dev)
38{
39 int len;
40 struct pci_controller *hose;
41 struct resource rsrc;
42 const int *bus_range;
43 int primary = 1, has_address = 0;
44 phys_addr_t immr = get_immrbase();
45
46 DBG("Adding PCI host bridge %s\n", dev->full_name);
47
48 /* Fetch host bridge registers address */
49 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
50
51 /* Get bus range if any */
52 bus_range = of_get_property(dev, "bus-range", &len);
53 if (bus_range == NULL || len < 2 * sizeof(int)) {
54 printk(KERN_WARNING "Can't get bus-range for %s, assume"
55 " bus 0\n", dev->full_name);
56 }
57
58 pci_assign_all_buses = 1;
59 hose = pcibios_alloc_controller(dev);
60 if (!hose)
61 return -ENOMEM;
62
63 hose->first_busno = bus_range ? bus_range[0] : 0;
64 hose->last_busno = bus_range ? bus_range[1] : 0xff;
65
66 /* PCI 1 */
67 if ((rsrc.start & 0xfffff) == 0x8000) {
68 setup_indirect_pci(hose, immr + 0x8000, immr + 0x8004);
69 }
70 /* PCI 2 */
71 if ((rsrc.start & 0xfffff) == 0x9000) {
72 setup_indirect_pci(hose, immr + 0x9000, immr + 0x9004);
73 primary = 0;
74 }
75
76 printk(KERN_INFO "Found MPC85xx PCI host bridge at 0x%016llx. "
77 "Firmware bus number: %d->%d\n",
78 (unsigned long long)rsrc.start, hose->first_busno,
79 hose->last_busno);
80
81 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
82 hose, hose->cfg_addr, hose->cfg_data);
83
84 /* Interpret the "ranges" property */
85 /* This also maps the I/O region and sets isa_io/mem_base */
86 pci_process_bridge_OF_ranges(hose, dev, primary);
87
88 return 0;
89}
90
91#endif
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 69d3c6eee83d..2eefcde5b0da 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -200,5 +200,12 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
200 return 0; 200 return 0;
201} 201}
202 202
203DECLARE_PCI_FIXUP_EARLY(0x1957, 0x0012, quirk_fsl_pcie_transparent);
204DECLARE_PCI_FIXUP_EARLY(0x1957, 0x0013, quirk_fsl_pcie_transparent);
205DECLARE_PCI_FIXUP_EARLY(0x1957, 0x0014, quirk_fsl_pcie_transparent);
206DECLARE_PCI_FIXUP_EARLY(0x1957, 0x0015, quirk_fsl_pcie_transparent);
207DECLARE_PCI_FIXUP_EARLY(0x1957, 0x0018, quirk_fsl_pcie_transparent);
208DECLARE_PCI_FIXUP_EARLY(0x1957, 0x0019, quirk_fsl_pcie_transparent);
209DECLARE_PCI_FIXUP_EARLY(0x1957, 0x001a, quirk_fsl_pcie_transparent);
203DECLARE_PCI_FIXUP_EARLY(0x1957, 0x7010, quirk_fsl_pcie_transparent); 210DECLARE_PCI_FIXUP_EARLY(0x1957, 0x7010, quirk_fsl_pcie_transparent);
204DECLARE_PCI_FIXUP_EARLY(0x1957, 0x7011, quirk_fsl_pcie_transparent); 211DECLARE_PCI_FIXUP_EARLY(0x1957, 0x7011, quirk_fsl_pcie_transparent);