]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/platforms/cell/interrupt.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-2.6-omap-h63xx.git] / arch / powerpc / platforms / cell / interrupt.c
index a914c12b4060a2072d77a7bfc08e7c18c3265467..151fd8b82d63b2e0878a7ee48118b3cda0ca0576 100644 (file)
@@ -41,9 +41,9 @@
 #include <asm/prom.h>
 #include <asm/ptrace.h>
 #include <asm/machdep.h>
+#include <asm/cell-regs.h>
 
 #include "interrupt.h"
-#include "cbe_regs.h"
 
 struct iic {
        struct cbe_iic_thread_regs __iomem *regs;
@@ -227,7 +227,7 @@ void iic_request_IPIs(void)
 
 static int iic_host_match(struct irq_host *h, struct device_node *node)
 {
-       return device_is_compatible(node,
+       return of_device_is_compatible(node,
                                    "IBM,CBEA-Internal-Interrupt-Controller");
 }
 
@@ -256,12 +256,12 @@ static int iic_host_xlate(struct irq_host *h, struct device_node *ct,
        unsigned int node, ext, unit, class;
        const u32 *val;
 
-       if (!device_is_compatible(ct,
+       if (!of_device_is_compatible(ct,
                                     "IBM,CBEA-Internal-Interrupt-Controller"))
                return -ENODEV;
        if (intsize != 1)
                return -ENODEV;
-       val = get_property(ct, "#interrupt-cells", NULL);
+       val = of_get_property(ct, "#interrupt-cells", NULL);
        if (val == NULL || *val != 1)
                return -ENODEV;
 
@@ -324,10 +324,10 @@ static int __init setup_iic(void)
 
        for (dn = NULL;
             (dn = of_find_node_by_name(dn,"interrupt-controller")) != NULL;) {
-               if (!device_is_compatible(dn,
+               if (!of_device_is_compatible(dn,
                                     "IBM,CBEA-Internal-Interrupt-Controller"))
                        continue;
-               np = get_property(dn, "ibm,interrupt-server-ranges", NULL);
+               np = of_get_property(dn, "ibm,interrupt-server-ranges", NULL);
                if (np == NULL) {
                        printk(KERN_WARNING "IIC: CPU association not found\n");
                        of_node_put(dn);
@@ -381,7 +381,7 @@ static int __init setup_iic(void)
 void __init iic_init_IRQ(void)
 {
        /* Setup an irq host data structure */
-       iic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, IIC_SOURCE_COUNT,
+       iic_host = irq_alloc_host(NULL, IRQ_HOST_MAP_LINEAR, IIC_SOURCE_COUNT,
                                  &iic_host_ops, IIC_IRQ_INVALID);
        BUG_ON(iic_host == NULL);
        irq_set_default_host(iic_host);
@@ -396,3 +396,19 @@ void __init iic_init_IRQ(void)
        /* Enable on current CPU */
        iic_setup_cpu();
 }
+
+void iic_set_interrupt_routing(int cpu, int thread, int priority)
+{
+       struct cbe_iic_regs __iomem *iic_regs = cbe_get_cpu_iic_regs(cpu);
+       u64 iic_ir = 0;
+       int node = cpu >> 1;
+
+       /* Set which node and thread will handle the next interrupt */
+       iic_ir |= CBE_IIC_IR_PRIO(priority) |
+                 CBE_IIC_IR_DEST_NODE(node);
+       if (thread == 0)
+               iic_ir |= CBE_IIC_IR_DEST_UNIT(CBE_IIC_IR_PT_0);
+       else
+               iic_ir |= CBE_IIC_IR_DEST_UNIT(CBE_IIC_IR_PT_1);
+       out_be64(&iic_regs->iic_ir, iic_ir);
+}