]> err.no Git - linux-2.6/blobdiff - arch/powerpc/platforms/chrp/setup.c
[POWERPC] Fix CHRP platforms with only 8259
[linux-2.6] / arch / powerpc / platforms / chrp / setup.c
index bb10171132fa63cf8ec9c06ae28879b23b2f687f..49b8dabcbc992996db5a3c53dd00b9035f7e5a05 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/pci.h>
-#include <linux/version.h>
+#include <linux/utsrelease.h>
 #include <linux/adb.h>
 #include <linux/module.h>
 #include <linux/delay.h>
@@ -70,10 +70,13 @@ unsigned long event_scan_interval;
  * has to include <linux/interrupt.h> (to get irqreturn_t), which
  * causes all sorts of problems.  -- paulus
  */
-extern irqreturn_t xmon_irq(int, void *, struct pt_regs *);
+extern irqreturn_t xmon_irq(int, void *);
 
 extern unsigned long loops_per_jiffy;
 
+/* To be replaced by RTAS when available */
+static unsigned int *briq_SPOR;
+
 #ifdef CONFIG_SMP
 extern struct smp_ops_t chrp_smp_ops;
 #endif
@@ -92,6 +95,15 @@ static const char *gg2_cachemodes[4] = {
        "Disabled", "Write-Through", "Copy-Back", "Transparent Mode"
 };
 
+static const char *chrp_names[] = {
+       "Unknown",
+       "","","",
+       "Motorola",
+       "IBM or Longtrail",
+       "Genesi Pegasos",
+       "Total Impact Briq"
+};
+
 void chrp_show_cpuinfo(struct seq_file *m)
 {
        int i, sdramen;
@@ -214,8 +226,7 @@ static void __init pegasos_set_l2cr(void)
        /* Enable L2 cache if needed */
        np = find_type_devices("cpu");
        if (np != NULL) {
-               unsigned int *l2cr = (unsigned int *)
-                       get_property (np, "l2cr", NULL);
+               const unsigned int *l2cr = get_property(np, "l2cr", NULL);
                if (l2cr == NULL) {
                        printk ("Pegasos l2cr : no cpu l2cr property found\n");
                        return;
@@ -229,10 +240,18 @@ static void __init pegasos_set_l2cr(void)
        }
 }
 
+static void briq_restart(char *cmd)
+{
+       local_irq_disable();
+       if (briq_SPOR)
+               out_be32(briq_SPOR, 0);
+       for(;;);
+}
+
 void __init chrp_setup_arch(void)
 {
        struct device_node *root = find_path_device ("/");
-       char *machine = NULL;
+       const char *machine = NULL;
 
        /* init to some ~sane value until calibrate_delay() runs */
        loops_per_jiffy = 50000000/HZ;
@@ -245,11 +264,16 @@ void __init chrp_setup_arch(void)
                _chrp_type = _CHRP_IBM;
        } else if (machine && strncmp(machine, "MOT", 3) == 0) {
                _chrp_type = _CHRP_Motorola;
+       } else if (machine && strncmp(machine, "TotalImpact,BRIQ-1", 18) == 0) {
+               _chrp_type = _CHRP_briq;
+               /* Map the SPOR register on briq and change the restart hook */
+               briq_SPOR = (unsigned int *)ioremap(0xff0000e8, 4);
+               ppc_md.restart = briq_restart;
        } else {
                /* Let's assume it is an IBM chrp if all else fails */
                _chrp_type = _CHRP_IBM;
        }
-       printk("chrp type = %x\n", _chrp_type);
+       printk("chrp type = %x [%s]\n", _chrp_type, chrp_names[_chrp_type]);
 
        rtas_initialize();
        if (rtas_token("display-character") >= 0)
@@ -291,10 +315,6 @@ void __init chrp_setup_arch(void)
 
        pci_create_OF_bus_map();
 
-#ifdef CONFIG_SMP
-       smp_ops = &chrp_smp_ops;
-#endif /* CONFIG_SMP */
-
        /*
         * Print the banner, then scroll down so boot progress
         * can be printed.  -- Cort
@@ -315,12 +335,11 @@ chrp_event_scan(unsigned long unused)
                  jiffies + event_scan_interval);
 }
 
-static void chrp_8259_cascade(unsigned int irq, struct irq_desc *desc,
-                             struct pt_regs *regs)
+static void chrp_8259_cascade(unsigned int irq, struct irq_desc *desc)
 {
-       unsigned int cascade_irq = i8259_irq(regs);
+       unsigned int cascade_irq = i8259_irq();
        if (cascade_irq != NO_IRQ)
-               generic_handle_irq(cascade_irq, regs);
+               generic_handle_irq(cascade_irq);
        desc->chip->eoi(irq);
 }
 
@@ -332,7 +351,7 @@ static void __init chrp_find_openpic(void)
        struct device_node *np, *root;
        int len, i, j;
        int isu_size, idu_size;
-       unsigned int *iranges, *opprop = NULL;
+       const unsigned int *iranges, *opprop = NULL;
        int oplen = 0;
        unsigned long opaddr;
        int na = 1;
@@ -342,8 +361,7 @@ static void __init chrp_find_openpic(void)
                return;
        root = of_find_node_by_path("/");
        if (root) {
-               opprop = (unsigned int *) get_property
-                       (root, "platform-open-pic", &oplen);
+               opprop = get_property(root, "platform-open-pic", &oplen);
                na = prom_n_addr_cells(root);
        }
        if (opprop && oplen >= na * sizeof(unsigned int)) {
@@ -360,7 +378,7 @@ static void __init chrp_find_openpic(void)
 
        printk(KERN_INFO "OpenPIC at %lx\n", opaddr);
 
-       iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len);
+       iranges = get_property(np, "interrupt-ranges", &len);
        if (iranges == NULL)
                len = 0;        /* non-distributed mpic */
        else
@@ -446,8 +464,8 @@ static void __init chrp_find_8259(void)
         * from anyway
         */
        for (np = find_devices("pci"); np != NULL; np = np->next) {
-               unsigned int *addrp = (unsigned int *)
-                       get_property(np, "8259-interrupt-acknowledge", NULL);
+               const unsigned int *addrp = get_property(np,
+                               "8259-interrupt-acknowledge", NULL);
 
                if (addrp == NULL)
                        continue;
@@ -459,8 +477,10 @@ static void __init chrp_find_8259(void)
                       " address, polling\n");
 
        i8259_init(pic, chrp_int_ack);
-       if (ppc_md.get_irq == NULL)
+       if (ppc_md.get_irq == NULL) {
                ppc_md.get_irq = i8259_irq;
+               irq_set_default_host(i8259_get_host());
+       }
        if (chrp_mpic != NULL) {
                cascade_irq = irq_of_parse_and_map(pic, 0);
                if (cascade_irq == NO_IRQ)
@@ -479,6 +499,14 @@ void __init chrp_init_IRQ(void)
        chrp_find_openpic();
        chrp_find_8259();
 
+#ifdef CONFIG_SMP
+       /* Pegasos has no MPIC, those ops would make it crash. It might be an
+        * option to move setting them to after we probe the PIC though
+        */
+       if (chrp_mpic != NULL)
+               smp_ops = &chrp_smp_ops;
+#endif /* CONFIG_SMP */
+
        if (_chrp_type == _CHRP_Pegasos)
                ppc_md.get_irq        = i8259_irq;
 
@@ -498,7 +526,7 @@ void __init
 chrp_init2(void)
 {
        struct device_node *device;
-       unsigned int *p = NULL;
+       const unsigned int *p = NULL;
 
 #ifdef CONFIG_NVRAM
        chrp_nvram_init();
@@ -516,8 +544,7 @@ chrp_init2(void)
         */
        device = find_devices("rtas");
        if (device)
-               p = (unsigned int *) get_property
-                       (device, "rtas-event-scan-rate", NULL);
+               p = get_property(device, "rtas-event-scan-rate", NULL);
        if (p && *p) {
                /*
                 * Arrange to call chrp_event_scan at least *p times