]> err.no Git - linux-2.6/blobdiff - arch/powerpc/platforms/pasemi/setup.c
[POWERPC] Use SLB size from the device tree
[linux-2.6] / arch / powerpc / platforms / pasemi / setup.c
index 5ddf40a66ae8f189da5fbc4f7d39bf5c3934a40d..6d7d068ceba099be37ea5ec6c2542a2838991ffc 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/delay.h>
 #include <linux/console.h>
 #include <linux/pci.h>
+#include <linux/of_platform.h>
 
 #include <asm/prom.h>
 #include <asm/system.h>
 #include <asm/mpic.h>
 #include <asm/smp.h>
 #include <asm/time.h>
-#include <asm/of_platform.h>
+#include <asm/mmu.h>
+
+#include <pcmcia/ss.h>
+#include <pcmcia/cistpl.h>
+#include <pcmcia/ds.h>
 
 #include "pasemi.h"
 
+#if !defined(CONFIG_SMP)
+static void smp_send_stop(void) {}
+#endif
+
 /* SDC reset register, must be pre-mapped at reset time */
 static void __iomem *reset_reg;
 
@@ -56,6 +65,9 @@ static int num_mce_regs;
 
 static void pas_restart(char *cmd)
 {
+       /* Need to put others cpu in hold loop so they're not sleeping */
+       smp_send_stop();
+       udelay(10000);
        printk("Restarting...\n");
        while (1)
                out_le32(reset_reg, 0x6000000);
@@ -210,7 +222,7 @@ static __init void pas_init_IRQ(void)
        printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
 
        mpic = mpic_alloc(mpic_node, openpic_addr,
-                         MPIC_PRIMARY|MPIC_LARGE_VECTORS|MPIC_WANTS_RESET,
+                         MPIC_PRIMARY|MPIC_LARGE_VECTORS,
                          0, 0, " PAS-OPIC  ");
        BUG_ON(!mpic);
 
@@ -291,7 +303,7 @@ static int pas_machine_check_handler(struct pt_regs *regs)
                int i;
 
                printk(KERN_ERR "slb contents:\n");
-               for (i = 0; i < SLB_NUM_ENTRIES; i++) {
+               for (i = 0; i < mmu_slb_size; i++) {
                        asm volatile("slbmfee  %0,%1" : "=r" (e) : "r" (i));
                        asm volatile("slbmfev  %0,%1" : "=r" (v) : "r" (i));
                        printk(KERN_ERR "%02d %016lx %016lx\n", i, e, v);
@@ -308,8 +320,62 @@ static void __init pas_init_early(void)
        iommu_init_early_pasemi();
 }
 
+#ifdef CONFIG_PCMCIA
+static int pcmcia_notify(struct notifier_block *nb, unsigned long action,
+                        void *data)
+{
+       struct device *dev = data;
+       struct device *parent;
+       struct pcmcia_device *pdev = to_pcmcia_dev(dev);
+
+       /* We are only intereted in device addition */
+       if (action != BUS_NOTIFY_ADD_DEVICE)
+               return 0;
+
+       parent = pdev->socket->dev.parent;
+
+       /* We know electra_cf devices will always have of_node set, since
+        * electra_cf is an of_platform driver.
+        */
+       if (!parent->archdata.of_node)
+               return 0;
+
+       if (!of_device_is_compatible(parent->archdata.of_node, "electra-cf"))
+               return 0;
+
+       /* We use the direct ops for localbus */
+       dev->archdata.dma_ops = &dma_direct_ops;
+
+       return 0;
+}
+
+static struct notifier_block pcmcia_notifier = {
+       .notifier_call = pcmcia_notify,
+};
+
+static inline void pasemi_pcmcia_init(void)
+{
+       extern struct bus_type pcmcia_bus_type;
+
+       bus_register_notifier(&pcmcia_bus_type, &pcmcia_notifier);
+}
+
+#else
+
+static inline void pasemi_pcmcia_init(void)
+{
+}
+
+#endif
+
+
 static struct of_device_id pasemi_bus_ids[] = {
+       /* Unfortunately needed for legacy firmwares */
+       { .type = "localbus", },
        { .type = "sdc", },
+       /* These are the proper entries, which newer firmware uses */
+       { .compatible = "pasemi,localbus", },
+       { .compatible = "pasemi,sdc", },
        {},
 };
 
@@ -318,6 +384,8 @@ static int __init pasemi_publish_devices(void)
        if (!machine_is(pasemi))
                return 0;
 
+       pasemi_pcmcia_init();
+
        /* Publish OF platform devices for SDC and other non-PCI devices */
        of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
 
@@ -333,7 +401,8 @@ static int __init pas_probe(void)
 {
        unsigned long root = of_get_flat_dt_root();
 
-       if (!of_flat_dt_is_compatible(root, "PA6T-1682M"))
+       if (!of_flat_dt_is_compatible(root, "PA6T-1682M") &&
+           !of_flat_dt_is_compatible(root, "pasemi,pwrficient"))
                return 0;
 
        hpte_init_native();
@@ -344,7 +413,7 @@ static int __init pas_probe(void)
 }
 
 define_machine(pasemi) {
-       .name                   = "PA Semi PA6T-1682M",
+       .name                   = "PA Semi PWRficient",
        .probe                  = pas_probe,
        .setup_arch             = pas_setup_arch,
        .init_early             = pas_init_early,