include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / arch / powerpc / platforms / maple / setup.c
index f12d5c6..39df705 100644 (file)
@@ -21,9 +21,7 @@
 #include <linux/stddef.h>
 #include <linux/unistd.h>
 #include <linux/ptrace.h>
-#include <linux/slab.h>
 #include <linux/user.h>
-#include <linux/a.out.h>
 #include <linux/tty.h>
 #include <linux/string.h>
 #include <linux/delay.h>
@@ -32,7 +30,6 @@
 #include <linux/initrd.h>
 #include <linux/vt_kern.h>
 #include <linux/console.h>
-#include <linux/ide.h>
 #include <linux/pci.h>
 #include <linux/adb.h>
 #include <linux/cuda.h>
 #include <linux/root_dev.h>
 #include <linux/serial.h>
 #include <linux/smp.h>
+#include <linux/bitops.h>
+#include <linux/of_device.h>
+#include <linux/lmb.h>
 
 #include <asm/processor.h>
 #include <asm/sections.h>
 #include <asm/prom.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
-#include <asm/bitops.h>
 #include <asm/io.h>
-#include <asm/kexec.h>
 #include <asm/pci-bridge.h>
 #include <asm/iommu.h>
 #include <asm/machdep.h>
 #include <asm/dma.h>
 #include <asm/cputable.h>
 #include <asm/time.h>
-#include <asm/of_device.h>
-#include <asm/lmb.h>
 #include <asm/mpic.h>
 #include <asm/rtas.h>
 #include <asm/udbg.h>
+#include <asm/nvram.h>
 
 #include "maple.h"
 
@@ -113,8 +110,8 @@ static void maple_restart(char *cmd)
                printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
                goto fail;
        }
-       maple_nvram_offset = get_property(sp, "restart-addr", NULL);
-       maple_nvram_command = get_property(sp, "restart-value", NULL);
+       maple_nvram_offset = of_get_property(sp, "restart-addr", NULL);
+       maple_nvram_command = of_get_property(sp, "restart-value", NULL);
        of_node_put(sp);
 
        /* send command */
@@ -140,8 +137,8 @@ static void maple_power_off(void)
                printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
                goto fail;
        }
-       maple_nvram_offset = get_property(sp, "power-off-addr", NULL);
-       maple_nvram_command = get_property(sp, "power-off-value", NULL);
+       maple_nvram_offset = of_get_property(sp, "power-off-addr", NULL);
+       maple_nvram_command = of_get_property(sp, "power-off-value", NULL);
        of_node_put(sp);
 
        /* send command */
@@ -195,6 +192,8 @@ void __init maple_setup_arch(void)
        maple_use_rtas_reboot_and_halt_if_present();
 
        printk(KERN_DEBUG "Using native/NAP idle loop\n");
+
+       mmio_nvram_init();
 }
 
 /* 
@@ -229,7 +228,7 @@ static void __init maple_init_IRQ(void)
         */
 
        for_each_node_by_type(np, "interrupt-controller")
-               if (device_is_compatible(np, "open-pic")) {
+               if (of_device_is_compatible(np, "open-pic")) {
                        mpic_node = np;
                        break;
                }
@@ -246,24 +245,23 @@ static void __init maple_init_IRQ(void)
 
        /* Find address list in /platform-open-pic */
        root = of_find_node_by_path("/");
-       naddr = prom_n_addr_cells(root);
-       opprop = get_property(root, "platform-open-pic", &opplen);
+       naddr = of_n_addr_cells(root);
+       opprop = of_get_property(root, "platform-open-pic", &opplen);
        if (opprop != 0) {
                openpic_addr = of_read_number(opprop, naddr);
                has_isus = (opplen > naddr);
                printk(KERN_DEBUG "OpenPIC addr: %lx, has ISUs: %d\n",
                       openpic_addr, has_isus);
        }
-       of_node_put(root);
 
        BUG_ON(openpic_addr == 0);
 
        /* Check for a big endian MPIC */
-       if (get_property(np, "big-endian", NULL) != NULL)
+       if (of_get_property(np, "big-endian", NULL) != NULL)
                flags |= MPIC_BIG_ENDIAN;
 
        /* XXX Maple specific bits */
-       flags |= MPIC_BROKEN_U3 | MPIC_WANTS_RESET;
+       flags |= MPIC_U3_HT_IRQS | MPIC_WANTS_RESET;
        /* All U3/U4 are big-endian, older SLOF firmware doesn't encode this */
        flags |= MPIC_BIG_ENDIAN;
 
@@ -318,7 +316,7 @@ static int __init maple_probe(void)
        return 1;
 }
 
-define_machine(maple_md) {
+define_machine(maple) {
        .name                   = "Maple",
        .probe                  = maple_probe,
        .setup_arch             = maple_setup_arch,
@@ -335,9 +333,63 @@ define_machine(maple_md) {
        .calibrate_decr         = generic_calibrate_decr,
        .progress               = maple_progress,
        .power_save             = power4_idle,
-#ifdef CONFIG_KEXEC
-       .machine_kexec          = default_machine_kexec,
-       .machine_kexec_prepare  = default_machine_kexec_prepare,
-       .machine_crash_shutdown = default_machine_crash_shutdown,
-#endif
 };
+
+#ifdef CONFIG_EDAC
+/*
+ * Register a platform device for CPC925 memory controller on
+ * Motorola ATCA-6101 blade.
+ */
+#define MAPLE_CPC925_MODEL     "Motorola,ATCA-6101"
+static int __init maple_cpc925_edac_setup(void)
+{
+       struct platform_device *pdev;
+       struct device_node *np = NULL;
+       struct resource r;
+       const unsigned char *model;
+       int ret;
+
+       np = of_find_node_by_path("/");
+       if (!np) {
+               printk(KERN_ERR "%s: Unable to get root node\n", __func__);
+               return -ENODEV;
+       }
+
+       model = (const unsigned char *)of_get_property(np, "model", NULL);
+       if (!model) {
+               printk(KERN_ERR "%s: Unabel to get model info\n", __func__);
+               return -ENODEV;
+       }
+
+       ret = strcmp(model, MAPLE_CPC925_MODEL);
+       of_node_put(np);
+
+       if (ret != 0)
+               return 0;
+
+       np = of_find_node_by_type(NULL, "memory-controller");
+       if (!np) {
+               printk(KERN_ERR "%s: Unable to find memory-controller node\n",
+                       __func__);
+               return -ENODEV;
+       }
+
+       ret = of_address_to_resource(np, 0, &r);
+       of_node_put(np);
+
+       if (ret < 0) {
+               printk(KERN_ERR "%s: Unable to get memory-controller reg\n",
+                       __func__);
+               return -ENODEV;
+       }
+
+       pdev = platform_device_register_simple("cpc925_edac", 0, &r, 1);
+       if (IS_ERR(pdev))
+               return PTR_ERR(pdev);
+
+       printk(KERN_INFO "%s: CPC925 platform device created\n", __func__);
+
+       return 0;
+}
+machine_device_initcall(maple, maple_cpc925_edac_setup);
+#endif