Commit 905e75c4 authored by Jia Hongtao's avatar Jia Hongtao Committed by Kumar Gala

powerpc/fsl-pci: Unify pci/pcie initialization code

We unified the Freescale pci/pcie initialization by changing the fsl_pci
to a platform driver. In previous PCI code architecture the initialization
routine is called at board_setup_arch stage. Now the initialization is done
in probe function which is architectural better. Also It's convenient for
adding PM support for PCI controller in later patch.

Now we registered pci controllers as platform devices. So we combine two
initialization code as one platform driver.
Signed-off-by: default avatarJia Hongtao <B38951@freescale.com>
Signed-off-by: default avatarLi Yang <leoli@freescale.com>
Signed-off-by: default avatarChunhe Lan <Chunhe.Lan@freescale.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 9e67886b
...@@ -27,6 +27,16 @@ static struct of_device_id __initdata mpc85xx_common_ids[] = { ...@@ -27,6 +27,16 @@ static struct of_device_id __initdata mpc85xx_common_ids[] = {
{ .compatible = "fsl,mpc8548-guts", }, { .compatible = "fsl,mpc8548-guts", },
/* Probably unnecessary? */ /* Probably unnecessary? */
{ .compatible = "gpio-leds", }, { .compatible = "gpio-leds", },
/* For all PCI controllers */
{ .compatible = "fsl,mpc8540-pci", },
{ .compatible = "fsl,mpc8548-pcie", },
{ .compatible = "fsl,p1022-pcie", },
{ .compatible = "fsl,p1010-pcie", },
{ .compatible = "fsl,p1023-pcie", },
{ .compatible = "fsl,p4080-pcie", },
{ .compatible = "fsl,qoriq-pcie-v2.4", },
{ .compatible = "fsl,qoriq-pcie-v2.3", },
{ .compatible = "fsl,qoriq-pcie-v2.2", },
{}, {},
}; };
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/memblock.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/machdep.h> #include <asm/machdep.h>
...@@ -52,39 +51,16 @@ void __init corenet_ds_pic_init(void) ...@@ -52,39 +51,16 @@ void __init corenet_ds_pic_init(void)
*/ */
void __init corenet_ds_setup_arch(void) void __init corenet_ds_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
struct pci_controller *hose;
#endif
dma_addr_t max = 0xffffffff;
mpc85xx_smp_init(); mpc85xx_smp_init();
#ifdef CONFIG_PCI #if defined(CONFIG_PCI) && defined(CONFIG_PPC64)
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,p4080-pcie") ||
of_device_is_compatible(np, "fsl,qoriq-pcie-v2.2") ||
of_device_is_compatible(np, "fsl,qoriq-pcie-v2.3") ||
of_device_is_compatible(np, "fsl,qoriq-pcie-v2.4")) {
fsl_add_bridge(np, 0);
hose = pci_find_hose_for_OF_device(np);
max = min(max, hose->dma_window_base_cur +
hose->dma_window_size);
}
}
#ifdef CONFIG_PPC64
pci_devs_phb_init(); pci_devs_phb_init();
#endif #endif
#endif
#ifdef CONFIG_SWIOTLB fsl_pci_assign_primary();
if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1; swiotlb_detect_4g();
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
}
#endif
pr_info("%s board from Freescale Semiconductor\n", ppc_md.name); pr_info("%s board from Freescale Semiconductor\n", ppc_md.name);
} }
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/memblock.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/machdep.h> #include <asm/machdep.h>
...@@ -84,53 +83,39 @@ void __init ge_imp3a_pic_init(void) ...@@ -84,53 +83,39 @@ void __init ge_imp3a_pic_init(void)
of_node_put(cascade_node); of_node_put(cascade_node);
} }
#ifdef CONFIG_PCI static void ge_imp3a_pci_assign_primary(void)
static int primary_phb_addr;
#endif /* CONFIG_PCI */
/*
* Setup the architecture
*/
static void __init ge_imp3a_setup_arch(void)
{ {
struct device_node *regs;
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
struct device_node *np; struct device_node *np;
struct pci_controller *hose; struct resource rsrc;
#endif
dma_addr_t max = 0xffffffff;
if (ppc_md.progress)
ppc_md.progress("ge_imp3a_setup_arch()", 0);
#ifdef CONFIG_PCI
for_each_node_by_type(np, "pci") { for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,mpc8540-pci") || if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_device_is_compatible(np, "fsl,mpc8548-pcie") || of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
of_device_is_compatible(np, "fsl,p2020-pcie")) { of_device_is_compatible(np, "fsl,p2020-pcie")) {
struct resource rsrc;
of_address_to_resource(np, 0, &rsrc); of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == primary_phb_addr) if ((rsrc.start & 0xfffff) == 0x9000)
fsl_add_bridge(np, 1); fsl_pci_primary = np;
else
fsl_add_bridge(np, 0);
hose = pci_find_hose_for_OF_device(np);
max = min(max, hose->dma_window_base_cur +
hose->dma_window_size);
} }
} }
#endif #endif
}
/*
* Setup the architecture
*/
static void __init ge_imp3a_setup_arch(void)
{
struct device_node *regs;
if (ppc_md.progress)
ppc_md.progress("ge_imp3a_setup_arch()", 0);
mpc85xx_smp_init(); mpc85xx_smp_init();
#ifdef CONFIG_SWIOTLB ge_imp3a_pci_assign_primary();
if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1; swiotlb_detect_4g();
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
}
#endif
/* Remap basic board registers */ /* Remap basic board registers */
regs = of_find_compatible_node(NULL, NULL, "ge,imp3a-fpga-regs"); regs = of_find_compatible_node(NULL, NULL, "ge,imp3a-fpga-regs");
...@@ -215,17 +200,10 @@ static int __init ge_imp3a_probe(void) ...@@ -215,17 +200,10 @@ static int __init ge_imp3a_probe(void)
{ {
unsigned long root = of_get_flat_dt_root(); unsigned long root = of_get_flat_dt_root();
if (of_flat_dt_is_compatible(root, "ge,IMP3A")) { return of_flat_dt_is_compatible(root, "ge,IMP3A");
#ifdef CONFIG_PCI
primary_phb_addr = 0x9000;
#endif
return 1;
}
return 0;
} }
machine_device_initcall(ge_imp3a, mpc85xx_common_publish_devices); machine_arch_initcall(ge_imp3a, mpc85xx_common_publish_devices);
machine_arch_initcall(ge_imp3a, swiotlb_setup_bus_notifier); machine_arch_initcall(ge_imp3a, swiotlb_setup_bus_notifier);
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/memblock.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/machdep.h> #include <asm/machdep.h>
...@@ -46,46 +45,17 @@ void __init mpc8536_ds_pic_init(void) ...@@ -46,46 +45,17 @@ void __init mpc8536_ds_pic_init(void)
*/ */
static void __init mpc8536_ds_setup_arch(void) static void __init mpc8536_ds_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
struct pci_controller *hose;
#endif
dma_addr_t max = 0xffffffff;
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc8536_ds_setup_arch()", 0); ppc_md.progress("mpc8536_ds_setup_arch()", 0);
#ifdef CONFIG_PCI fsl_pci_assign_primary();
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
struct resource rsrc;
of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0x8000)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
hose = pci_find_hose_for_OF_device(np);
max = min(max, hose->dma_window_base_cur +
hose->dma_window_size);
}
}
#endif
#ifdef CONFIG_SWIOTLB swiotlb_detect_4g();
if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
}
#endif
printk("MPC8536 DS board from Freescale Semiconductor\n"); printk("MPC8536 DS board from Freescale Semiconductor\n");
} }
machine_device_initcall(mpc8536_ds, mpc85xx_common_publish_devices); machine_arch_initcall(mpc8536_ds, mpc85xx_common_publish_devices);
machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier);
......
...@@ -137,10 +137,6 @@ static void __init init_ioports(void) ...@@ -137,10 +137,6 @@ static void __init init_ioports(void)
static void __init mpc85xx_ads_setup_arch(void) static void __init mpc85xx_ads_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc85xx_ads_setup_arch()", 0); ppc_md.progress("mpc85xx_ads_setup_arch()", 0);
...@@ -150,11 +146,10 @@ static void __init mpc85xx_ads_setup_arch(void) ...@@ -150,11 +146,10 @@ static void __init mpc85xx_ads_setup_arch(void)
#endif #endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
fsl_add_bridge(np, 1);
ppc_md.pci_exclude_device = mpc85xx_exclude_device; ppc_md.pci_exclude_device = mpc85xx_exclude_device;
#endif #endif
fsl_pci_assign_primary();
} }
static void mpc85xx_ads_show_cpuinfo(struct seq_file *m) static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
...@@ -173,7 +168,7 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m) ...@@ -173,7 +168,7 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
} }
machine_device_initcall(mpc85xx_ads, mpc85xx_common_publish_devices); machine_arch_initcall(mpc85xx_ads, mpc85xx_common_publish_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -276,6 +276,33 @@ machine_device_initcall(mpc85xx_cds, mpc85xx_cds_8259_attach); ...@@ -276,6 +276,33 @@ machine_device_initcall(mpc85xx_cds, mpc85xx_cds_8259_attach);
#endif /* CONFIG_PPC_I8259 */ #endif /* CONFIG_PPC_I8259 */
static void mpc85xx_cds_pci_assign_primary(void)
{
#ifdef CONFIG_PCI
struct device_node *np;
if (fsl_pci_primary)
return;
/*
* MPC85xx_CDS has ISA bridge but unfortunately there is no
* isa node in device tree. We now looking for i8259 node as
* a workaround for such a broken device tree. This routine
* is for complying to all device trees.
*/
np = of_find_node_by_name(NULL, "i8259");
while ((fsl_pci_primary = of_get_parent(np))) {
of_node_put(np);
np = fsl_pci_primary;
if ((of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_device_is_compatible(np, "fsl,mpc8548-pcie")) &&
of_device_is_available(np))
return;
}
#endif
}
/* /*
* Setup the architecture * Setup the architecture
*/ */
...@@ -309,21 +336,12 @@ static void __init mpc85xx_cds_setup_arch(void) ...@@ -309,21 +336,12 @@ static void __init mpc85xx_cds_setup_arch(void)
} }
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
struct resource rsrc;
of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0x8000)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
}
}
ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup; ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup;
ppc_md.pci_exclude_device = mpc85xx_exclude_device; ppc_md.pci_exclude_device = mpc85xx_exclude_device;
#endif #endif
mpc85xx_cds_pci_assign_primary();
fsl_pci_assign_primary();
} }
static void mpc85xx_cds_show_cpuinfo(struct seq_file *m) static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)
...@@ -355,7 +373,7 @@ static int __init mpc85xx_cds_probe(void) ...@@ -355,7 +373,7 @@ static int __init mpc85xx_cds_probe(void)
return of_flat_dt_is_compatible(root, "MPC85xxCDS"); return of_flat_dt_is_compatible(root, "MPC85xxCDS");
} }
machine_device_initcall(mpc85xx_cds, mpc85xx_common_publish_devices); machine_arch_initcall(mpc85xx_cds, mpc85xx_common_publish_devices);
define_machine(mpc85xx_cds) { define_machine(mpc85xx_cds) {
.name = "MPC85xx CDS", .name = "MPC85xx CDS",
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/memblock.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/machdep.h> #include <asm/machdep.h>
...@@ -129,13 +128,11 @@ static int mpc85xx_exclude_device(struct pci_controller *hose, ...@@ -129,13 +128,11 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
} }
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
static void __init mpc85xx_ds_pci_init(void) static void __init mpc85xx_ds_uli_init(void)
{ {
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
struct device_node *node; struct device_node *node;
fsl_pci_init();
/* See if we have a ULI under the primary */ /* See if we have a ULI under the primary */
node = of_find_node_by_name(NULL, "uli1575"); node = of_find_node_by_name(NULL, "uli1575");
...@@ -160,7 +157,8 @@ static void __init mpc85xx_ds_setup_arch(void) ...@@ -160,7 +157,8 @@ static void __init mpc85xx_ds_setup_arch(void)
ppc_md.progress("mpc85xx_ds_setup_arch()", 0); ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
swiotlb_detect_4g(); swiotlb_detect_4g();
mpc85xx_ds_pci_init(); fsl_pci_assign_primary();
mpc85xx_ds_uli_init();
mpc85xx_smp_init(); mpc85xx_smp_init();
printk("MPC85xx DS board from Freescale Semiconductor\n"); printk("MPC85xx DS board from Freescale Semiconductor\n");
...@@ -176,9 +174,9 @@ static int __init mpc8544_ds_probe(void) ...@@ -176,9 +174,9 @@ static int __init mpc8544_ds_probe(void)
return !!of_flat_dt_is_compatible(root, "MPC8544DS"); return !!of_flat_dt_is_compatible(root, "MPC8544DS");
} }
machine_device_initcall(mpc8544_ds, mpc85xx_common_publish_devices); machine_arch_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
machine_device_initcall(mpc8572_ds, mpc85xx_common_publish_devices); machine_arch_initcall(mpc8572_ds, mpc85xx_common_publish_devices);
machine_device_initcall(p2020_ds, mpc85xx_common_publish_devices); machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices);
machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier);
machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier);
......
...@@ -327,44 +327,16 @@ static void __init mpc85xx_mds_qeic_init(void) { } ...@@ -327,44 +327,16 @@ static void __init mpc85xx_mds_qeic_init(void) { }
static void __init mpc85xx_mds_setup_arch(void) static void __init mpc85xx_mds_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct pci_controller *hose;
struct device_node *np;
#endif
dma_addr_t max = 0xffffffff;
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc85xx_mds_setup_arch()", 0); ppc_md.progress("mpc85xx_mds_setup_arch()", 0);
#ifdef CONFIG_PCI
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
struct resource rsrc;
of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0x8000)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
hose = pci_find_hose_for_OF_device(np);
max = min(max, hose->dma_window_base_cur +
hose->dma_window_size);
}
}
#endif
mpc85xx_smp_init(); mpc85xx_smp_init();
mpc85xx_mds_qe_init(); mpc85xx_mds_qe_init();
#ifdef CONFIG_SWIOTLB fsl_pci_assign_primary();
if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1; swiotlb_detect_4g();
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
}
#endif
} }
...@@ -409,9 +381,9 @@ static int __init mpc85xx_publish_devices(void) ...@@ -409,9 +381,9 @@ static int __init mpc85xx_publish_devices(void)
return mpc85xx_common_publish_devices(); return mpc85xx_common_publish_devices();
} }
machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices); machine_arch_initcall(mpc8568_mds, mpc85xx_publish_devices);
machine_device_initcall(mpc8569_mds, mpc85xx_publish_devices); machine_arch_initcall(mpc8569_mds, mpc85xx_publish_devices);
machine_device_initcall(p1021_mds, mpc85xx_common_publish_devices); machine_arch_initcall(p1021_mds, mpc85xx_common_publish_devices);
machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier);
machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier);
......
...@@ -86,23 +86,17 @@ void __init mpc85xx_rdb_pic_init(void) ...@@ -86,23 +86,17 @@ void __init mpc85xx_rdb_pic_init(void)
*/ */
static void __init mpc85xx_rdb_setup_arch(void) static void __init mpc85xx_rdb_setup_arch(void)
{ {
#if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE) #ifdef CONFIG_QUICC_ENGINE
struct device_node *np; struct device_node *np;
#endif #endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc85xx_rdb_setup_arch()", 0); ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
#ifdef CONFIG_PCI
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,mpc8548-pcie"))
fsl_add_bridge(np, 0);
}
#endif
mpc85xx_smp_init(); mpc85xx_smp_init();
fsl_pci_assign_primary();
#ifdef CONFIG_QUICC_ENGINE #ifdef CONFIG_QUICC_ENGINE
np = of_find_compatible_node(NULL, NULL, "fsl,qe"); np = of_find_compatible_node(NULL, NULL, "fsl,qe");
if (!np) { if (!np) {
...@@ -161,15 +155,15 @@ static void __init mpc85xx_rdb_setup_arch(void) ...@@ -161,15 +155,15 @@ static void __init mpc85xx_rdb_setup_arch(void)
printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
} }
machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices); machine_arch_initcall(p2020_rdb, mpc85xx_common_publish_devices);
machine_device_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices); machine_arch_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices);
machine_device_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices); machine_arch_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices);
machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices); machine_arch_initcall(p1020_rdb, mpc85xx_common_publish_devices);
machine_device_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices); machine_arch_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices);
machine_device_initcall(p1020_utm_pc, mpc85xx_common_publish_devices); machine_arch_initcall(p1020_utm_pc, mpc85xx_common_publish_devices);
machine_device_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices); machine_arch_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices);
machine_device_initcall(p1025_rdb, mpc85xx_common_publish_devices); machine_arch_initcall(p1025_rdb, mpc85xx_common_publish_devices);
machine_device_initcall(p1024_rdb, mpc85xx_common_publish_devices); machine_arch_initcall(p1024_rdb, mpc85xx_common_publish_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -46,25 +46,15 @@ void __init p1010_rdb_pic_init(void) ...@@ -46,25 +46,15 @@ void __init p1010_rdb_pic_init(void)
*/ */
static void __init p1010_rdb_setup_arch(void) static void __init p1010_rdb_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("p1010_rdb_setup_arch()", 0); ppc_md.progress("p1010_rdb_setup_arch()", 0);
#ifdef CONFIG_PCI fsl_pci_assign_primary();
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,p1010-pcie"))
fsl_add_bridge(np, 0);
}
#endif
printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n"); printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n");
} }
machine_device_initcall(p1010_rdb, mpc85xx_common_publish_devices); machine_arch_initcall(p1010_rdb, mpc85xx_common_publish_devices);
machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier); machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier);
/* /*
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/memblock.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <asm/mpic.h> #include <asm/mpic.h>
#include <asm/swiotlb.h> #include <asm/swiotlb.h>
...@@ -507,32 +506,9 @@ early_param("video", early_video_setup); ...@@ -507,32 +506,9 @@ early_param("video", early_video_setup);
*/ */
static void __init p1022_ds_setup_arch(void) static void __init p1022_ds_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
dma_addr_t max = 0xffffffff;
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("p1022_ds_setup_arch()", 0); ppc_md.progress("p1022_ds_setup_arch()", 0);
#ifdef CONFIG_PCI
for_each_compatible_node(np, "pci", "fsl,p1022-pcie") {
struct resource rsrc;
struct pci_controller *hose;
of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0x8000)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
hose = pci_find_hose_for_OF_device(np);
max = min(max, hose->dma_window_base_cur +
hose->dma_window_size);
}
#endif
#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
diu_ops.get_pixel_format = p1022ds_get_pixel_format; diu_ops.get_pixel_format = p1022ds_get_pixel_format;
diu_ops.set_gamma_table = p1022ds_set_gamma_table; diu_ops.set_gamma_table = p1022ds_set_gamma_table;
...@@ -601,18 +577,14 @@ static void __init p1022_ds_setup_arch(void) ...@@ -601,18 +577,14 @@ static void __init p1022_ds_setup_arch(void)
mpc85xx_smp_init(); mpc85xx_smp_init();
#ifdef CONFIG_SWIOTLB fsl_pci_assign_primary();
if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1; swiotlb_detect_4g();
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
}
#endif
pr_info("Freescale P1022 DS reference board\n"); pr_info("Freescale P1022 DS reference board\n");
} }
machine_device_initcall(p1022_ds, mpc85xx_common_publish_devices); machine_arch_initcall(p1022_ds, mpc85xx_common_publish_devices);
machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier);
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/memblock.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <asm/mpic.h> #include <asm/mpic.h>
#include <asm/swiotlb.h> #include <asm/swiotlb.h>
...@@ -121,32 +120,9 @@ void __init p1022_rdk_pic_init(void) ...@@ -121,32 +120,9 @@ void __init p1022_rdk_pic_init(void)
*/ */
static void __init p1022_rdk_setup_arch(void) static void __init p1022_rdk_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
dma_addr_t max = 0xffffffff;
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("p1022_rdk_setup_arch()", 0); ppc_md.progress("p1022_rdk_setup_arch()", 0);
#ifdef CONFIG_PCI
for_each_compatible_node(np, "pci", "fsl,p1022-pcie") {
struct resource rsrc;
struct pci_controller *hose;
of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0x8000)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
hose = pci_find_hose_for_OF_device(np);
max = min(max, hose->dma_window_base_cur +
hose->dma_window_size);
}
#endif
#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
diu_ops.set_monitor_port = p1022rdk_set_monitor_port; diu_ops.set_monitor_port = p1022rdk_set_monitor_port;
diu_ops.set_pixel_clock = p1022rdk_set_pixel_clock; diu_ops.set_pixel_clock = p1022rdk_set_pixel_clock;
...@@ -155,18 +131,14 @@ static void __init p1022_rdk_setup_arch(void) ...@@ -155,18 +131,14 @@ static void __init p1022_rdk_setup_arch(void)
mpc85xx_smp_init(); mpc85xx_smp_init();
#ifdef CONFIG_SWIOTLB fsl_pci_assign_primary();
if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1; swiotlb_detect_4g();
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
}
#endif
pr_info("Freescale / iVeia P1022 RDK reference board\n"); pr_info("Freescale / iVeia P1022 RDK reference board\n");
} }
machine_device_initcall(p1022_rdk, mpc85xx_common_publish_devices); machine_arch_initcall(p1022_rdk, mpc85xx_common_publish_devices);
machine_arch_initcall(p1022_rdk, swiotlb_setup_bus_notifier); machine_arch_initcall(p1022_rdk, swiotlb_setup_bus_notifier);
......
...@@ -80,15 +80,12 @@ static void __init mpc85xx_rds_setup_arch(void) ...@@ -80,15 +80,12 @@ static void __init mpc85xx_rds_setup_arch(void)
} }
} }
#ifdef CONFIG_PCI
for_each_compatible_node(np, "pci", "fsl,p1023-pcie")
fsl_add_bridge(np, 0);
#endif
mpc85xx_smp_init(); mpc85xx_smp_init();
fsl_pci_assign_primary();
} }
machine_device_initcall(p1023_rds, mpc85xx_common_publish_devices); machine_arch_initcall(p1023_rds, mpc85xx_common_publish_devices);
static void __init mpc85xx_rds_pic_init(void) static void __init mpc85xx_rds_pic_init(void)
{ {
......
...@@ -80,7 +80,7 @@ define_machine(p2041_rdb) { ...@@ -80,7 +80,7 @@ define_machine(p2041_rdb) {
.power_save = e500_idle, .power_save = e500_idle,
}; };
machine_device_initcall(p2041_rdb, corenet_ds_publish_devices); machine_arch_initcall(p2041_rdb, corenet_ds_publish_devices);
#ifdef CONFIG_SWIOTLB #ifdef CONFIG_SWIOTLB
machine_arch_initcall(p2041_rdb, swiotlb_setup_bus_notifier); machine_arch_initcall(p2041_rdb, swiotlb_setup_bus_notifier);
......
...@@ -82,7 +82,7 @@ define_machine(p3041_ds) { ...@@ -82,7 +82,7 @@ define_machine(p3041_ds) {
.power_save = e500_idle, .power_save = e500_idle,
}; };
machine_device_initcall(p3041_ds, corenet_ds_publish_devices); machine_arch_initcall(p3041_ds, corenet_ds_publish_devices);
#ifdef CONFIG_SWIOTLB #ifdef CONFIG_SWIOTLB
machine_arch_initcall(p3041_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(p3041_ds, swiotlb_setup_bus_notifier);
......
...@@ -81,7 +81,7 @@ define_machine(p4080_ds) { ...@@ -81,7 +81,7 @@ define_machine(p4080_ds) {
.power_save = e500_idle, .power_save = e500_idle,
}; };
machine_device_initcall(p4080_ds, corenet_ds_publish_devices); machine_arch_initcall(p4080_ds, corenet_ds_publish_devices);
#ifdef CONFIG_SWIOTLB #ifdef CONFIG_SWIOTLB
machine_arch_initcall(p4080_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(p4080_ds, swiotlb_setup_bus_notifier);
#endif #endif
...@@ -91,7 +91,7 @@ define_machine(p5020_ds) { ...@@ -91,7 +91,7 @@ define_machine(p5020_ds) {
#endif #endif
}; };
machine_device_initcall(p5020_ds, corenet_ds_publish_devices); machine_arch_initcall(p5020_ds, corenet_ds_publish_devices);
#ifdef CONFIG_SWIOTLB #ifdef CONFIG_SWIOTLB
machine_arch_initcall(p5020_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(p5020_ds, swiotlb_setup_bus_notifier);
......
...@@ -82,7 +82,7 @@ define_machine(p5040_ds) { ...@@ -82,7 +82,7 @@ define_machine(p5040_ds) {
#endif #endif
}; };
machine_device_initcall(p5040_ds, corenet_ds_publish_devices); machine_arch_initcall(p5040_ds, corenet_ds_publish_devices);
#ifdef CONFIG_SWIOTLB #ifdef CONFIG_SWIOTLB
machine_arch_initcall(p5040_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(p5040_ds, swiotlb_setup_bus_notifier);
......
...@@ -41,7 +41,7 @@ static void __init qemu_e500_setup_arch(void) ...@@ -41,7 +41,7 @@ static void __init qemu_e500_setup_arch(void)
{ {
ppc_md.progress("qemu_e500_setup_arch()", 0); ppc_md.progress("qemu_e500_setup_arch()", 0);
fsl_pci_init(); fsl_pci_assign_primary();
swiotlb_detect_4g(); swiotlb_detect_4g();
mpc85xx_smp_init(); mpc85xx_smp_init();
} }
...@@ -56,7 +56,7 @@ static int __init qemu_e500_probe(void) ...@@ -56,7 +56,7 @@ static int __init qemu_e500_probe(void)
return !!of_flat_dt_is_compatible(root, "fsl,qemu-e500"); return !!of_flat_dt_is_compatible(root, "fsl,qemu-e500");
} }
machine_device_initcall(qemu_e500, mpc85xx_common_publish_devices); machine_arch_initcall(qemu_e500, mpc85xx_common_publish_devices);
define_machine(qemu_e500) { define_machine(qemu_e500) {
.name = "QEMU e500", .name = "QEMU e500",
......
...@@ -88,26 +88,11 @@ static int __init sbc8548_hw_rev(void) ...@@ -88,26 +88,11 @@ static int __init sbc8548_hw_rev(void)
*/ */
static void __init sbc8548_setup_arch(void) static void __init sbc8548_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("sbc8548_setup_arch()", 0); ppc_md.progress("sbc8548_setup_arch()", 0);
#ifdef CONFIG_PCI fsl_pci_assign_primary();
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
struct resource rsrc;
of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0x8000)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
}
}
#endif
sbc_rev = sbc8548_hw_rev(); sbc_rev = sbc8548_hw_rev();
} }
...@@ -128,7 +113,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m) ...@@ -128,7 +113,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
} }
machine_device_initcall(sbc8548, mpc85xx_common_publish_devices); machine_arch_initcall(sbc8548, mpc85xx_common_publish_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -66,20 +66,13 @@ static void __init socrates_pic_init(void) ...@@ -66,20 +66,13 @@ static void __init socrates_pic_init(void)
*/ */
static void __init socrates_setup_arch(void) static void __init socrates_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("socrates_setup_arch()", 0); ppc_md.progress("socrates_setup_arch()", 0);
#ifdef CONFIG_PCI fsl_pci_assign_primary();
for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
fsl_add_bridge(np, 1);
#endif
} }
machine_device_initcall(socrates, mpc85xx_common_publish_devices); machine_arch_initcall(socrates, mpc85xx_common_publish_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -60,21 +60,14 @@ static void __init stx_gp3_pic_init(void) ...@@ -60,21 +60,14 @@ static void __init stx_gp3_pic_init(void)
*/ */
static void __init stx_gp3_setup_arch(void) static void __init stx_gp3_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("stx_gp3_setup_arch()", 0); ppc_md.progress("stx_gp3_setup_arch()", 0);
fsl_pci_assign_primary();
#ifdef CONFIG_CPM2 #ifdef CONFIG_CPM2
cpm2_reset(); cpm2_reset();
#endif #endif
#ifdef CONFIG_PCI
for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
fsl_add_bridge(np, 1);
#endif
} }
static void stx_gp3_show_cpuinfo(struct seq_file *m) static void stx_gp3_show_cpuinfo(struct seq_file *m)
...@@ -93,7 +86,7 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m) ...@@ -93,7 +86,7 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m)
seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
} }
machine_device_initcall(stx_gp3, mpc85xx_common_publish_devices); machine_arch_initcall(stx_gp3, mpc85xx_common_publish_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -59,10 +59,6 @@ static void __init tqm85xx_pic_init(void) ...@@ -59,10 +59,6 @@ static void __init tqm85xx_pic_init(void)
*/ */
static void __init tqm85xx_setup_arch(void) static void __init tqm85xx_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("tqm85xx_setup_arch()", 0); ppc_md.progress("tqm85xx_setup_arch()", 0);
...@@ -70,20 +66,7 @@ static void __init tqm85xx_setup_arch(void) ...@@ -70,20 +66,7 @@ static void __init tqm85xx_setup_arch(void)
cpm2_reset(); cpm2_reset();
#endif #endif
#ifdef CONFIG_PCI fsl_pci_assign_primary();
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
struct resource rsrc;
if (!of_address_to_resource(np, 0, &rsrc)) {
if ((rsrc.start & 0xfffff) == 0x8000)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
}
}
}
#endif
} }
static void tqm85xx_show_cpuinfo(struct seq_file *m) static void tqm85xx_show_cpuinfo(struct seq_file *m)
...@@ -123,7 +106,7 @@ static void __devinit tqm85xx_ti1520_fixup(struct pci_dev *pdev) ...@@ -123,7 +106,7 @@ static void __devinit tqm85xx_ti1520_fixup(struct pci_dev *pdev)
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520, DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520,
tqm85xx_ti1520_fixup); tqm85xx_ti1520_fixup);
machine_device_initcall(tqm85xx, mpc85xx_common_publish_devices); machine_arch_initcall(tqm85xx, mpc85xx_common_publish_devices);
static const char *board[] __initdata = { static const char *board[] __initdata = {
"tqc,tqm8540", "tqc,tqm8540",
......
...@@ -111,18 +111,11 @@ static void xes_mpc85xx_fixups(void) ...@@ -111,18 +111,11 @@ static void xes_mpc85xx_fixups(void)
} }
} }
#ifdef CONFIG_PCI
static int primary_phb_addr;
#endif
/* /*
* Setup the architecture * Setup the architecture
*/ */
static void __init xes_mpc85xx_setup_arch(void) static void __init xes_mpc85xx_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
struct device_node *root; struct device_node *root;
const char *model = "Unknown"; const char *model = "Unknown";
...@@ -137,26 +130,14 @@ static void __init xes_mpc85xx_setup_arch(void) ...@@ -137,26 +130,14 @@ static void __init xes_mpc85xx_setup_arch(void)
xes_mpc85xx_fixups(); xes_mpc85xx_fixups();
#ifdef CONFIG_PCI
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
struct resource rsrc;
of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == primary_phb_addr)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
}
}
#endif
mpc85xx_smp_init(); mpc85xx_smp_init();
fsl_pci_assign_primary();
} }
machine_device_initcall(xes_mpc8572, mpc85xx_common_publish_devices); machine_arch_initcall(xes_mpc8572, mpc85xx_common_publish_devices);
machine_device_initcall(xes_mpc8548, mpc85xx_common_publish_devices); machine_arch_initcall(xes_mpc8548, mpc85xx_common_publish_devices);
machine_device_initcall(xes_mpc8540, mpc85xx_common_publish_devices); machine_arch_initcall(xes_mpc8540, mpc85xx_common_publish_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
...@@ -165,42 +146,21 @@ static int __init xes_mpc8572_probe(void) ...@@ -165,42 +146,21 @@ static int __init xes_mpc8572_probe(void)
{ {
unsigned long root = of_get_flat_dt_root(); unsigned long root = of_get_flat_dt_root();
if (of_flat_dt_is_compatible(root, "xes,MPC8572")) { return of_flat_dt_is_compatible(root, "xes,MPC8572");
#ifdef CONFIG_PCI
primary_phb_addr = 0x8000;
#endif
return 1;
} else {
return 0;
}
} }
static int __init xes_mpc8548_probe(void) static int __init xes_mpc8548_probe(void)
{ {
unsigned long root = of_get_flat_dt_root(); unsigned long root = of_get_flat_dt_root();
if (of_flat_dt_is_compatible(root, "xes,MPC8548")) { return of_flat_dt_is_compatible(root, "xes,MPC8548");
#ifdef CONFIG_PCI
primary_phb_addr = 0xb000;
#endif
return 1;
} else {
return 0;
}
} }
static int __init xes_mpc8540_probe(void) static int __init xes_mpc8540_probe(void)
{ {
unsigned long root = of_get_flat_dt_root(); unsigned long root = of_get_flat_dt_root();
if (of_flat_dt_is_compatible(root, "xes,MPC8540")) { return of_flat_dt_is_compatible(root, "xes,MPC8540");
#ifdef CONFIG_PCI
primary_phb_addr = 0xb000;
#endif
return 1;
} else {
return 0;
}
} }
define_machine(xes_mpc8572) { define_machine(xes_mpc8572) {
......
...@@ -73,13 +73,6 @@ static void __init gef_ppc9a_init_irq(void) ...@@ -73,13 +73,6 @@ static void __init gef_ppc9a_init_irq(void)
static void __init gef_ppc9a_setup_arch(void) static void __init gef_ppc9a_setup_arch(void)
{ {
struct device_node *regs; struct device_node *regs;
#ifdef CONFIG_PCI
struct device_node *np;
for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
fsl_add_bridge(np, 1);
}
#endif
printk(KERN_INFO "GE Intelligent Platforms PPC9A 6U VME SBC\n"); printk(KERN_INFO "GE Intelligent Platforms PPC9A 6U VME SBC\n");
...@@ -87,6 +80,8 @@ static void __init gef_ppc9a_setup_arch(void) ...@@ -87,6 +80,8 @@ static void __init gef_ppc9a_setup_arch(void)
mpc86xx_smp_init(); mpc86xx_smp_init();
#endif #endif
fsl_pci_assign_primary();
/* Remap basic board registers */ /* Remap basic board registers */
regs = of_find_compatible_node(NULL, NULL, "gef,ppc9a-fpga-regs"); regs = of_find_compatible_node(NULL, NULL, "gef,ppc9a-fpga-regs");
if (regs) { if (regs) {
...@@ -221,6 +216,7 @@ static long __init mpc86xx_time_init(void) ...@@ -221,6 +216,7 @@ static long __init mpc86xx_time_init(void)
static __initdata struct of_device_id of_bus_ids[] = { static __initdata struct of_device_id of_bus_ids[] = {
{ .compatible = "simple-bus", }, { .compatible = "simple-bus", },
{ .compatible = "gianfar", }, { .compatible = "gianfar", },
{ .compatible = "fsl,mpc8641-pcie", },
{}, {},
}; };
...@@ -231,7 +227,7 @@ static int __init declare_of_platform_devices(void) ...@@ -231,7 +227,7 @@ static int __init declare_of_platform_devices(void)
return 0; return 0;
} }
machine_device_initcall(gef_ppc9a, declare_of_platform_devices); machine_arch_initcall(gef_ppc9a, declare_of_platform_devices);
define_machine(gef_ppc9a) { define_machine(gef_ppc9a) {
.name = "GE PPC9A", .name = "GE PPC9A",
......
...@@ -73,20 +73,14 @@ static void __init gef_sbc310_init_irq(void) ...@@ -73,20 +73,14 @@ static void __init gef_sbc310_init_irq(void)
static void __init gef_sbc310_setup_arch(void) static void __init gef_sbc310_setup_arch(void)
{ {
struct device_node *regs; struct device_node *regs;
#ifdef CONFIG_PCI
struct device_node *np;
for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
fsl_add_bridge(np, 1);
}
#endif
printk(KERN_INFO "GE Intelligent Platforms SBC310 6U VPX SBC\n"); printk(KERN_INFO "GE Intelligent Platforms SBC310 6U VPX SBC\n");
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
mpc86xx_smp_init(); mpc86xx_smp_init();
#endif #endif
fsl_pci_assign_primary();
/* Remap basic board registers */ /* Remap basic board registers */
regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs"); regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs");
if (regs) { if (regs) {
...@@ -209,6 +203,7 @@ static long __init mpc86xx_time_init(void) ...@@ -209,6 +203,7 @@ static long __init mpc86xx_time_init(void)
static __initdata struct of_device_id of_bus_ids[] = { static __initdata struct of_device_id of_bus_ids[] = {
{ .compatible = "simple-bus", }, { .compatible = "simple-bus", },
{ .compatible = "gianfar", }, { .compatible = "gianfar", },
{ .compatible = "fsl,mpc8641-pcie", },
{}, {},
}; };
...@@ -219,7 +214,7 @@ static int __init declare_of_platform_devices(void) ...@@ -219,7 +214,7 @@ static int __init declare_of_platform_devices(void)
return 0; return 0;
} }
machine_device_initcall(gef_sbc310, declare_of_platform_devices); machine_arch_initcall(gef_sbc310, declare_of_platform_devices);
define_machine(gef_sbc310) { define_machine(gef_sbc310) {
.name = "GE SBC310", .name = "GE SBC310",
......
...@@ -73,13 +73,6 @@ static void __init gef_sbc610_init_irq(void) ...@@ -73,13 +73,6 @@ static void __init gef_sbc610_init_irq(void)
static void __init gef_sbc610_setup_arch(void) static void __init gef_sbc610_setup_arch(void)
{ {
struct device_node *regs; struct device_node *regs;
#ifdef CONFIG_PCI
struct device_node *np;
for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
fsl_add_bridge(np, 1);
}
#endif
printk(KERN_INFO "GE Intelligent Platforms SBC610 6U VPX SBC\n"); printk(KERN_INFO "GE Intelligent Platforms SBC610 6U VPX SBC\n");
...@@ -87,6 +80,8 @@ static void __init gef_sbc610_setup_arch(void) ...@@ -87,6 +80,8 @@ static void __init gef_sbc610_setup_arch(void)
mpc86xx_smp_init(); mpc86xx_smp_init();
#endif #endif
fsl_pci_assign_primary();
/* Remap basic board registers */ /* Remap basic board registers */
regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs"); regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs");
if (regs) { if (regs) {
...@@ -198,6 +193,7 @@ static long __init mpc86xx_time_init(void) ...@@ -198,6 +193,7 @@ static long __init mpc86xx_time_init(void)
static __initdata struct of_device_id of_bus_ids[] = { static __initdata struct of_device_id of_bus_ids[] = {
{ .compatible = "simple-bus", }, { .compatible = "simple-bus", },
{ .compatible = "gianfar", }, { .compatible = "gianfar", },
{ .compatible = "fsl,mpc8641-pcie", },
{}, {},
}; };
...@@ -208,7 +204,7 @@ static int __init declare_of_platform_devices(void) ...@@ -208,7 +204,7 @@ static int __init declare_of_platform_devices(void)
return 0; return 0;
} }
machine_device_initcall(gef_sbc610, declare_of_platform_devices); machine_arch_initcall(gef_sbc610, declare_of_platform_devices);
define_machine(gef_sbc610) { define_machine(gef_sbc610) {
.name = "GE SBC610", .name = "GE SBC610",
......
...@@ -91,6 +91,9 @@ static struct of_device_id __initdata mpc8610_ids[] = { ...@@ -91,6 +91,9 @@ static struct of_device_id __initdata mpc8610_ids[] = {
{ .compatible = "simple-bus", }, { .compatible = "simple-bus", },
/* So that the DMA channel nodes can be probed individually: */ /* So that the DMA channel nodes can be probed individually: */
{ .compatible = "fsl,eloplus-dma", }, { .compatible = "fsl,eloplus-dma", },
/* PCI controllers */
{ .compatible = "fsl,mpc8610-pci", },
{ .compatible = "fsl,mpc8641-pcie", },
{} {}
}; };
...@@ -107,7 +110,7 @@ static int __init mpc8610_declare_of_platform_devices(void) ...@@ -107,7 +110,7 @@ static int __init mpc8610_declare_of_platform_devices(void)
return 0; return 0;
} }
machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices); machine_arch_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices);
#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
...@@ -278,25 +281,13 @@ mpc8610hpcd_valid_monitor_port(enum fsl_diu_monitor_port port) ...@@ -278,25 +281,13 @@ mpc8610hpcd_valid_monitor_port(enum fsl_diu_monitor_port port)
static void __init mpc86xx_hpcd_setup_arch(void) static void __init mpc86xx_hpcd_setup_arch(void)
{ {
struct resource r; struct resource r;
struct device_node *np;
unsigned char *pixis; unsigned char *pixis;
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc86xx_hpcd_setup_arch()", 0); ppc_md.progress("mpc86xx_hpcd_setup_arch()", 0);
#ifdef CONFIG_PCI fsl_pci_assign_primary();
for_each_node_by_type(np, "pci") {
if (of_device_is_compatible(np, "fsl,mpc8610-pci")
|| of_device_is_compatible(np, "fsl,mpc8641-pcie")) {
struct resource rsrc;
of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0xa000)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
}
}
#endif
#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
diu_ops.get_pixel_format = mpc8610hpcd_get_pixel_format; diu_ops.get_pixel_format = mpc8610hpcd_get_pixel_format;
diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table; diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table;
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/memblock.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/machdep.h> #include <asm/machdep.h>
...@@ -51,15 +50,8 @@ extern int uli_exclude_device(struct pci_controller *hose, ...@@ -51,15 +50,8 @@ extern int uli_exclude_device(struct pci_controller *hose,
static int mpc86xx_exclude_device(struct pci_controller *hose, static int mpc86xx_exclude_device(struct pci_controller *hose,
u_char bus, u_char devfn) u_char bus, u_char devfn)
{ {
struct device_node* node; if (hose->dn == fsl_pci_primary)
struct resource rsrc;
node = hose->dn;
of_address_to_resource(node, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0x8000) {
return uli_exclude_device(hose, bus, devfn); return uli_exclude_device(hose, bus, devfn);
}
return PCIBIOS_SUCCESSFUL; return PCIBIOS_SUCCESSFUL;
} }
...@@ -69,30 +61,11 @@ static int mpc86xx_exclude_device(struct pci_controller *hose, ...@@ -69,30 +61,11 @@ static int mpc86xx_exclude_device(struct pci_controller *hose,
static void __init static void __init
mpc86xx_hpcn_setup_arch(void) mpc86xx_hpcn_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
struct pci_controller *hose;
#endif
dma_addr_t max = 0xffffffff;
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0); ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
struct resource rsrc;
of_address_to_resource(np, 0, &rsrc);
if ((rsrc.start & 0xfffff) == 0x8000)
fsl_add_bridge(np, 1);
else
fsl_add_bridge(np, 0);
hose = pci_find_hose_for_OF_device(np);
max = min(max, hose->dma_window_base_cur +
hose->dma_window_size);
}
ppc_md.pci_exclude_device = mpc86xx_exclude_device; ppc_md.pci_exclude_device = mpc86xx_exclude_device;
#endif #endif
printk("MPC86xx HPCN board from Freescale Semiconductor\n"); printk("MPC86xx HPCN board from Freescale Semiconductor\n");
...@@ -101,13 +74,9 @@ mpc86xx_hpcn_setup_arch(void) ...@@ -101,13 +74,9 @@ mpc86xx_hpcn_setup_arch(void)
mpc86xx_smp_init(); mpc86xx_smp_init();
#endif #endif
#ifdef CONFIG_SWIOTLB fsl_pci_assign_primary();
if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1; swiotlb_detect_4g();
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
}
#endif
} }
...@@ -162,6 +131,7 @@ static __initdata struct of_device_id of_bus_ids[] = { ...@@ -162,6 +131,7 @@ static __initdata struct of_device_id of_bus_ids[] = {
{ .compatible = "simple-bus", }, { .compatible = "simple-bus", },
{ .compatible = "fsl,srio", }, { .compatible = "fsl,srio", },
{ .compatible = "gianfar", }, { .compatible = "gianfar", },
{ .compatible = "fsl,mpc8641-pcie", },
{}, {},
}; };
...@@ -171,7 +141,7 @@ static int __init declare_of_platform_devices(void) ...@@ -171,7 +141,7 @@ static int __init declare_of_platform_devices(void)
return 0; return 0;
} }
machine_device_initcall(mpc86xx_hpcn, declare_of_platform_devices); machine_arch_initcall(mpc86xx_hpcn, declare_of_platform_devices);
machine_arch_initcall(mpc86xx_hpcn, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc86xx_hpcn, swiotlb_setup_bus_notifier);
define_machine(mpc86xx_hpcn) { define_machine(mpc86xx_hpcn) {
......
...@@ -38,23 +38,16 @@ ...@@ -38,23 +38,16 @@
static void __init static void __init
sbc8641_setup_arch(void) sbc8641_setup_arch(void)
{ {
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("sbc8641_setup_arch()", 0); ppc_md.progress("sbc8641_setup_arch()", 0);
#ifdef CONFIG_PCI
for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie")
fsl_add_bridge(np, 0);
#endif
printk("SBC8641 board from Wind River\n"); printk("SBC8641 board from Wind River\n");
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
mpc86xx_smp_init(); mpc86xx_smp_init();
#endif #endif
fsl_pci_assign_primary();
} }
...@@ -102,6 +95,7 @@ mpc86xx_time_init(void) ...@@ -102,6 +95,7 @@ mpc86xx_time_init(void)
static __initdata struct of_device_id of_bus_ids[] = { static __initdata struct of_device_id of_bus_ids[] = {
{ .compatible = "simple-bus", }, { .compatible = "simple-bus", },
{ .compatible = "gianfar", }, { .compatible = "gianfar", },
{ .compatible = "fsl,mpc8641-pcie", },
{}, {},
}; };
...@@ -111,7 +105,7 @@ static int __init declare_of_platform_devices(void) ...@@ -111,7 +105,7 @@ static int __init declare_of_platform_devices(void)
return 0; return 0;
} }
machine_device_initcall(sbc8641, declare_of_platform_devices); machine_arch_initcall(sbc8641, declare_of_platform_devices);
define_machine(sbc8641) { define_machine(sbc8641) {
.name = "SBC8641D", .name = "SBC8641D",
......
...@@ -828,54 +828,78 @@ static const struct of_device_id pci_ids[] = { ...@@ -828,54 +828,78 @@ static const struct of_device_id pci_ids[] = {
struct device_node *fsl_pci_primary; struct device_node *fsl_pci_primary;
void __devinit fsl_pci_init(void) void fsl_pci_assign_primary(void)
{ {
int ret; struct device_node *np;
struct device_node *node;
struct pci_controller *hose;
dma_addr_t max = 0xffffffff;
/* Callers can specify the primary bus using other means. */ /* Callers can specify the primary bus using other means. */
if (!fsl_pci_primary) { if (fsl_pci_primary)
/* If a PCI host bridge contains an ISA node, it's primary. */ return;
node = of_find_node_by_type(NULL, "isa");
while ((fsl_pci_primary = of_get_parent(node))) { /* If a PCI host bridge contains an ISA node, it's primary. */
of_node_put(node); np = of_find_node_by_type(NULL, "isa");
node = fsl_pci_primary; while ((fsl_pci_primary = of_get_parent(np))) {
of_node_put(np);
if (of_match_node(pci_ids, node)) np = fsl_pci_primary;
break;
} if (of_match_node(pci_ids, np) && of_device_is_available(np))
return;
} }
node = NULL; /*
for_each_node_by_type(node, "pci") { * If there's no PCI host bridge with ISA, arbitrarily
if (of_match_node(pci_ids, node)) { * designate one as primary. This can go away once
/* * various bugs with primary-less systems are fixed.
* If there's no PCI host bridge with ISA, arbitrarily */
* designate one as primary. This can go away once for_each_matching_node(np, pci_ids) {
* various bugs with primary-less systems are fixed. if (of_device_is_available(np)) {
*/ fsl_pci_primary = np;
if (!fsl_pci_primary) of_node_put(np);
fsl_pci_primary = node; return;
ret = fsl_add_bridge(node, fsl_pci_primary == node);
if (ret == 0) {
hose = pci_find_hose_for_OF_device(node);
max = min(max, hose->dma_window_base_cur +
hose->dma_window_size);
}
} }
} }
}
static int __devinit fsl_pci_probe(struct platform_device *pdev)
{
int ret;
struct device_node *node;
struct pci_controller *hose;
node = pdev->dev.of_node;
ret = fsl_add_bridge(node, fsl_pci_primary == node);
#ifdef CONFIG_SWIOTLB #ifdef CONFIG_SWIOTLB
/* if (ret == 0) {
* if we couldn't map all of DRAM via the dma windows hose = pci_find_hose_for_OF_device(pdev->dev.of_node);
* we need SWIOTLB to handle buffers located outside of
* dma capable memory region /*
*/ * if we couldn't map all of DRAM via the dma windows
if (memblock_end_of_DRAM() - 1 > max) * we need SWIOTLB to handle buffers located outside of
ppc_swiotlb_enable = 1; * dma capable memory region
*/
if (memblock_end_of_DRAM() - 1 > hose->dma_window_base_cur +
hose->dma_window_size)
ppc_swiotlb_enable = 1;
}
#endif #endif
mpc85xx_pci_err_probe(pdev);
return 0;
}
static struct platform_driver fsl_pci_driver = {
.driver = {
.name = "fsl-pci",
.of_match_table = pci_ids,
},
.probe = fsl_pci_probe,
};
static int __init fsl_pci_init(void)
{
return platform_driver_register(&fsl_pci_driver);
} }
arch_initcall(fsl_pci_init);
#endif #endif
...@@ -98,10 +98,19 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose); ...@@ -98,10 +98,19 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose);
extern struct device_node *fsl_pci_primary; extern struct device_node *fsl_pci_primary;
#ifdef CONFIG_FSL_PCI #ifdef CONFIG_PCI
void fsl_pci_init(void); void fsl_pci_assign_primary(void);
#else #else
static inline void fsl_pci_init(void) {} static inline void fsl_pci_assign_primary(void) {}
#endif
#ifdef CONFIG_EDAC_MPC85XX
int mpc85xx_pci_err_probe(struct platform_device *op);
#else
static inline int mpc85xx_pci_err_probe(struct platform_device *op)
{
return -ENOTSUPP;
}
#endif #endif
#endif /* __POWERPC_FSL_PCI_H */ #endif /* __POWERPC_FSL_PCI_H */
......
...@@ -212,7 +212,7 @@ static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id) ...@@ -212,7 +212,7 @@ static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int __devinit mpc85xx_pci_err_probe(struct platform_device *op) int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
{ {
struct edac_pci_ctl_info *pci; struct edac_pci_ctl_info *pci;
struct mpc85xx_pci_pdata *pdata; struct mpc85xx_pci_pdata *pdata;
...@@ -226,6 +226,16 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op) ...@@ -226,6 +226,16 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
if (!pci) if (!pci)
return -ENOMEM; return -ENOMEM;
/* make sure error reporting method is sane */
switch (edac_op_state) {
case EDAC_OPSTATE_POLL:
case EDAC_OPSTATE_INT:
break;
default:
edac_op_state = EDAC_OPSTATE_INT;
break;
}
pdata = pci->pvt_info; pdata = pci->pvt_info;
pdata->name = "mpc85xx_pci_err"; pdata->name = "mpc85xx_pci_err";
pdata->irq = NO_IRQ; pdata->irq = NO_IRQ;
...@@ -315,6 +325,7 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op) ...@@ -315,6 +325,7 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
devres_release_group(&op->dev, mpc85xx_pci_err_probe); devres_release_group(&op->dev, mpc85xx_pci_err_probe);
return res; return res;
} }
EXPORT_SYMBOL(mpc85xx_pci_err_probe);
static int mpc85xx_pci_err_remove(struct platform_device *op) static int mpc85xx_pci_err_remove(struct platform_device *op)
{ {
...@@ -338,27 +349,6 @@ static int mpc85xx_pci_err_remove(struct platform_device *op) ...@@ -338,27 +349,6 @@ static int mpc85xx_pci_err_remove(struct platform_device *op)
return 0; return 0;
} }
static struct of_device_id mpc85xx_pci_err_of_match[] = {
{
.compatible = "fsl,mpc8540-pcix",
},
{
.compatible = "fsl,mpc8540-pci",
},
{},
};
MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match);
static struct platform_driver mpc85xx_pci_err_driver = {
.probe = mpc85xx_pci_err_probe,
.remove = __devexit_p(mpc85xx_pci_err_remove),
.driver = {
.name = "mpc85xx_pci_err",
.owner = THIS_MODULE,
.of_match_table = mpc85xx_pci_err_of_match,
},
};
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
/**************************** L2 Err device ***************************/ /**************************** L2 Err device ***************************/
...@@ -1210,12 +1200,6 @@ static int __init mpc85xx_mc_init(void) ...@@ -1210,12 +1200,6 @@ static int __init mpc85xx_mc_init(void)
if (res) if (res)
printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n"); printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n");
#ifdef CONFIG_PCI
res = platform_driver_register(&mpc85xx_pci_err_driver);
if (res)
printk(KERN_WARNING EDAC_MOD_STR "PCI fails to register\n");
#endif
#ifdef CONFIG_FSL_SOC_BOOKE #ifdef CONFIG_FSL_SOC_BOOKE
pvr = mfspr(SPRN_PVR); pvr = mfspr(SPRN_PVR);
...@@ -1251,9 +1235,6 @@ static void __exit mpc85xx_mc_exit(void) ...@@ -1251,9 +1235,6 @@ static void __exit mpc85xx_mc_exit(void)
(PVR_VER(pvr) == PVR_VER_E500V2)) { (PVR_VER(pvr) == PVR_VER_E500V2)) {
on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0); on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
} }
#endif
#ifdef CONFIG_PCI
platform_driver_unregister(&mpc85xx_pci_err_driver);
#endif #endif
platform_driver_unregister(&mpc85xx_l2_err_driver); platform_driver_unregister(&mpc85xx_l2_err_driver);
platform_driver_unregister(&mpc85xx_mc_err_driver); platform_driver_unregister(&mpc85xx_mc_err_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment