[PATCH] irq-flags: POWERPC: Use the new IRQF_ constants
[safe/jmp/linux-2.6] / arch / powerpc / platforms / powermac / setup.c
index 1955462..8654b5f 100644 (file)
@@ -23,7 +23,6 @@
  * bootup setup stuff..
  */
 
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
@@ -86,11 +85,10 @@ int ppc_override_l2cr = 0;
 int ppc_override_l2cr_value;
 int has_l2cache = 0;
 
-int pmac_newworld = 1;
+int pmac_newworld;
 
 static int current_root_goodness = -1;
 
-extern int pmac_newworld;
 extern struct machdep_calls pmac_md;
 
 #define DEFAULT_ROOT_DEVICE Root_SDA1  /* sda1 - slightly silly choice */
@@ -308,9 +306,10 @@ static void __init pmac_setup_arch(void)
        for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; )
                if (get_property(ic, "interrupt-controller", NULL))
                        break;
-       pmac_newworld = (ic != NULL);
-       if (ic)
+       if (ic) {
+               pmac_newworld = 1;
                of_node_put(ic);
+       }
 
        /* Lookup PCI hosts */
        pmac_pci_init();
@@ -350,6 +349,13 @@ static void __init pmac_setup_arch(void)
                smp_ops = &psurge_smp_ops;
 #endif
 #endif /* CONFIG_SMP */
+
+#ifdef CONFIG_ADB
+       if (strstr(cmd_line, "adb_sync")) {
+               extern int __adb_probe_sync;
+               __adb_probe_sync = 1;
+       }
+#endif /* CONFIG_ADB */
 }
 
 char *bootpath;
@@ -451,16 +457,28 @@ static int pmac_pm_finish(suspend_state_t state)
        printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
 
        /* Restore userland MMU context */
-       set_context(current->active_mm->context, current->active_mm->pgd);
+       set_context(current->active_mm->context.id, current->active_mm->pgd);
 
        return 0;
 }
 
+static int pmac_pm_valid(suspend_state_t state)
+{
+       switch (state) {
+       case PM_SUSPEND_DISK:
+               return 1;
+       /* can't do any other states via generic mechanism yet */
+       default:
+               return 0;
+       }
+}
+
 static struct pm_ops pmac_pm_ops = {
        .pm_disk_mode   = PM_DISK_SHUTDOWN,
        .prepare        = pmac_pm_prepare,
        .enter          = pmac_pm_enter,
        .finish         = pmac_pm_finish,
+       .valid          = pmac_pm_valid,
 };
 
 #endif /* CONFIG_SOFTWARE_SUSPEND */
@@ -576,42 +594,11 @@ pmac_halt(void)
        pmac_power_off();
 }
 
-#ifdef CONFIG_PPC32
-void __init pmac_init(void)
-{
-       /* isa_io_base gets set in pmac_pci_init */
-       isa_mem_base = PMAC_ISA_MEM_BASE;
-       pci_dram_offset = PMAC_PCI_DRAM_OFFSET;
-       ISA_DMA_THRESHOLD = ~0L;
-       DMA_MODE_READ = 1;
-       DMA_MODE_WRITE = 2;
-
-       ppc_md = pmac_md;
-
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-#ifdef CONFIG_BLK_DEV_IDE_PMAC
-        ppc_ide_md.ide_init_hwif       = pmac_ide_init_hwif_ports;
-        ppc_ide_md.default_io_base     = pmac_ide_get_base;
-#endif /* CONFIG_BLK_DEV_IDE_PMAC */
-#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
-
-       if (ppc_md.progress) ppc_md.progress("pmac_init(): exit", 0);
-
-}
-#endif
-
 /* 
  * Early initialization.
  */
 static void __init pmac_init_early(void)
 {
-#ifdef CONFIG_PPC64
-       /* Initialize hash table, from now on, we can take hash faults
-        * and call ioremap
-        */
-       hpte_init_native();
-#endif
-
        /* Enable early btext debug if requested */
        if (strstr(cmd_line, "btextdbg")) {
                udbg_adb_init_early();
@@ -621,10 +608,6 @@ static void __init pmac_init_early(void)
        /* Probe motherboard chipset */
        pmac_feature_init();
 
-       /* We can NAP */
-       powersave_nap = 1;
-       printk(KERN_INFO "Using native/NAP idle loop\n");
-
        /* Initialize debug stuff */
        udbg_scc_init(!!strstr(cmd_line, "sccdbg"));
        udbg_adb_init(!!strstr(cmd_line, "btextdbg"));
@@ -650,6 +633,12 @@ static int __init pmac_declare_of_platform_devices(void)
 {
        struct device_node *np;
 
+       if (machine_is(chrp))
+               return -1;
+
+       if (!machine_is(powermac))
+               return 0;
+
        np = of_find_node_by_name(NULL, "valkyrie");
        if (np)
                of_platform_device_create(np, "valkyrie", NULL);
@@ -670,12 +659,15 @@ device_initcall(pmac_declare_of_platform_devices);
 /*
  * Called very early, MMU is off, device-tree isn't unflattened
  */
-static int __init pmac_probe(int platform)
+static int __init pmac_probe(void)
 {
-#ifdef CONFIG_PPC64
-       if (platform != PLATFORM_POWERMAC)
+       unsigned long root = of_get_flat_dt_root();
+
+       if (!of_flat_dt_is_compatible(root, "Power Macintosh") &&
+           !of_flat_dt_is_compatible(root, "MacRISC"))
                return 0;
 
+#ifdef CONFIG_PPC64
        /*
         * On U3, the DART (iommu) must be allocated now since it
         * has an impact on htab_initialize (due to the large page it
@@ -683,8 +675,27 @@ static int __init pmac_probe(int platform)
         * part of the cacheable linar mapping
         */
        alloc_dart_table();
+
+       hpte_init_native();
 #endif
 
+#ifdef CONFIG_PPC32
+       /* isa_io_base gets set in pmac_pci_init */
+       isa_mem_base = PMAC_ISA_MEM_BASE;
+       pci_dram_offset = PMAC_PCI_DRAM_OFFSET;
+       ISA_DMA_THRESHOLD = ~0L;
+       DMA_MODE_READ = 1;
+       DMA_MODE_WRITE = 2;
+
+#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
+#ifdef CONFIG_BLK_DEV_IDE_PMAC
+        ppc_ide_md.ide_init_hwif       = pmac_ide_init_hwif_ports;
+        ppc_ide_md.default_io_base     = pmac_ide_get_base;
+#endif /* CONFIG_BLK_DEV_IDE_PMAC */
+#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
+
+#endif /* CONFIG_PPC32 */
+
 #ifdef CONFIG_PMAC_SMU
        /*
         * SMU based G5s need some memory below 2Gb, at least the current
@@ -713,10 +724,8 @@ static int pmac_pci_probe_mode(struct pci_bus *bus)
 }
 #endif
 
-struct machdep_calls __initdata pmac_md = {
-#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
-       .cpu_die                = generic_mach_cpu_die,
-#endif
+define_machine(powermac) {
+       .name                   = "PowerMac",
        .probe                  = pmac_probe,
        .setup_arch             = pmac_setup_arch,
        .init_early             = pmac_init_early,
@@ -737,7 +746,7 @@ struct machdep_calls __initdata pmac_md = {
        .progress               = udbg_progress,
 #ifdef CONFIG_PPC64
        .pci_probe_mode         = pmac_pci_probe_mode,
-       .idle_loop              = native_idle,
+       .power_save             = power4_idle,
        .enable_pmcs            = power4_enable_pmcs,
 #ifdef CONFIG_KEXEC
        .machine_kexec          = default_machine_kexec,
@@ -750,4 +759,7 @@ struct machdep_calls __initdata pmac_md = {
        .pcibios_after_init     = pmac_pcibios_after_init,
        .phys_mem_access_prot   = pci_phys_mem_access_prot,
 #endif
+#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
+       .cpu_die                = generic_mach_cpu_die,
+#endif
 };