powerpc/85xx: Kconfig cleanup
[safe/jmp/linux-2.6] / arch / powerpc / platforms / 85xx / mpc85xx_ds.c
index 25f41cd..544011a 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/seq_file.h>
 #include <linux/interrupt.h>
 #include <linux/of_platform.h>
+#include <linux/lmb.h>
 
 #include <asm/system.h>
 #include <asm/time.h>
@@ -30,6 +31,7 @@
 #include <asm/udbg.h>
 #include <asm/mpic.h>
 #include <asm/i8259.h>
+#include <asm/swiotlb.h>
 
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
@@ -63,6 +65,7 @@ void __init mpc85xx_ds_pic_init(void)
        struct device_node *cascade_node = NULL;
        int cascade_irq;
 #endif
+       unsigned long root = of_get_flat_dt_root();
 
        np = of_find_node_by_type(NULL, "open-pic");
        if (np == NULL) {
@@ -76,10 +79,19 @@ void __init mpc85xx_ds_pic_init(void)
                return;
        }
 
-       mpic = mpic_alloc(np, r.start,
+       if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) {
+               mpic = mpic_alloc(np, r.start,
+                       MPIC_PRIMARY |
+                       MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
+                       0, 256, " OpenPIC  ");
+       } else {
+               mpic = mpic_alloc(np, r.start,
                          MPIC_PRIMARY | MPIC_WANTS_RESET |
-                         MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
+                         MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
+                         MPIC_SINGLE_DEST_CPU,
                        0, 256, " OpenPIC  ");
+       }
+
        BUG_ON(mpic == NULL);
        of_node_put(np);
 
@@ -115,7 +127,6 @@ void __init mpc85xx_ds_pic_init(void)
 
 #ifdef CONFIG_PCI
 static int primary_phb_addr;
-extern int uses_fsl_uli_m1575;
 extern int uli_exclude_device(struct pci_controller *hose,
                                u_char bus, u_char devfn);
 
@@ -139,11 +150,16 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
 /*
  * Setup the architecture
  */
+#ifdef CONFIG_SMP
+extern void __init mpc85xx_smp_init(void);
+#endif
 static void __init mpc85xx_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)
                ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
@@ -151,20 +167,36 @@ static void __init mpc85xx_ds_setup_arch(void)
 #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")) {
+                   of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
+                   of_device_is_compatible(np, "fsl,p2020-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);
+
+                       hose = pci_find_hose_for_OF_device(np);
+                       max = min(max, hose->dma_window_base_cur +
+                                       hose->dma_window_size);
                }
        }
 
-       uses_fsl_uli_m1575 = 1;
        ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 
+#ifdef CONFIG_SMP
+       mpc85xx_smp_init();
+#endif
+
+#ifdef CONFIG_SWIOTLB
+       if (lmb_end_of_DRAM() > 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("MPC85xx DS board from Freescale Semiconductor\n");
 }
 
@@ -180,14 +212,16 @@ static int __init mpc8544_ds_probe(void)
                primary_phb_addr = 0xb000;
 #endif
                return 1;
-       } else {
-               return 0;
        }
+
+       return 0;
 }
 
 static struct of_device_id __initdata mpc85xxds_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
+       { .compatible = "simple-bus", },
+       { .compatible = "gianfar", },
        {},
 };
 
@@ -197,6 +231,11 @@ static int __init mpc85xxds_publish_devices(void)
 }
 machine_device_initcall(mpc8544_ds, mpc85xxds_publish_devices);
 machine_device_initcall(mpc8572_ds, mpc85xxds_publish_devices);
+machine_device_initcall(p2020_ds, mpc85xxds_publish_devices);
+
+machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier);
+machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier);
+machine_arch_initcall(p2020_ds, swiotlb_setup_bus_notifier);
 
 /*
  * Called very early, device-tree isn't unflattened
@@ -210,9 +249,26 @@ static int __init mpc8572_ds_probe(void)
                primary_phb_addr = 0x8000;
 #endif
                return 1;
-       } else {
-               return 0;
        }
+
+       return 0;
+}
+
+/*
+ * Called very early, device-tree isn't unflattened
+ */
+static int __init p2020_ds_probe(void)
+{
+       unsigned long root = of_get_flat_dt_root();
+
+       if (of_flat_dt_is_compatible(root, "fsl,P2020DS")) {
+#ifdef CONFIG_PCI
+               primary_phb_addr = 0x9000;
+#endif
+               return 1;
+       }
+
+       return 0;
 }
 
 define_machine(mpc8544_ds) {
@@ -242,3 +298,17 @@ define_machine(mpc8572_ds) {
        .calibrate_decr         = generic_calibrate_decr,
        .progress               = udbg_progress,
 };
+
+define_machine(p2020_ds) {
+       .name                   = "P2020 DS",
+       .probe                  = p2020_ds_probe,
+       .setup_arch             = mpc85xx_ds_setup_arch,
+       .init_IRQ               = mpc85xx_ds_pic_init,
+#ifdef CONFIG_PCI
+       .pcibios_fixup_bus      = fsl_pcibios_fixup_bus,
+#endif
+       .get_irq                = mpic_get_irq,
+       .restart                = fsl_rstcr_restart,
+       .calibrate_decr         = generic_calibrate_decr,
+       .progress               = udbg_progress,
+};