crypto: aes_s390 - access .cip instead of .blk in cipher mode
[safe/jmp/linux-2.6] / arch / arm / mach-sa1100 / irq.c
index 66a929c..3093d46 100644 (file)
  */
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/ioport.h>
-#include <linux/ptrace.h>
 #include <linux/sysdev.h>
 
-#include <asm/hardware.h>
-#include <asm/irq.h>
+#include <mach/hardware.h>
 #include <asm/mach/irq.h>
 
 #include "generic.h"
@@ -46,17 +46,17 @@ static int sa1100_gpio_type(unsigned int irq, unsigned int type)
        else
                mask = GPIO11_27_MASK(irq);
 
-       if (type == IRQT_PROBE) {
+       if (type == IRQ_TYPE_PROBE) {
                if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask)
                        return 0;
-               type = __IRQT_RISEDGE | __IRQT_FALEDGE;
+               type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
        }
 
-       if (type & __IRQT_RISEDGE) {
+       if (type & IRQ_TYPE_EDGE_RISING) {
                GPIO_IRQ_rising_edge |= mask;
        } else
                GPIO_IRQ_rising_edge &= ~mask;
-       if (type & __IRQT_FALEDGE) {
+       if (type & IRQ_TYPE_EDGE_FALLING) {
                GPIO_IRQ_falling_edge |= mask;
        } else
                GPIO_IRQ_falling_edge &= ~mask;
@@ -94,12 +94,13 @@ static int sa1100_low_gpio_wake(unsigned int irq, unsigned int on)
        return 0;
 }
 
-static struct irqchip sa1100_low_gpio_chip = {
+static struct irq_chip sa1100_low_gpio_chip = {
+       .name           = "GPIO-l",
        .ack            = sa1100_low_gpio_ack,
        .mask           = sa1100_low_gpio_mask,
        .unmask         = sa1100_low_gpio_unmask,
-       .type           = sa1100_gpio_type,
-       .wake           = sa1100_low_gpio_wake,
+       .set_type       = sa1100_gpio_type,
+       .set_wake       = sa1100_low_gpio_wake,
 };
 
 /*
@@ -108,8 +109,7 @@ static struct irqchip sa1100_low_gpio_chip = {
  * and call the handler.
  */
 static void
-sa1100_high_gpio_handler(unsigned int irq, struct irqdesc *desc,
-                        struct pt_regs *regs)
+sa1100_high_gpio_handler(unsigned int irq, struct irq_desc *desc)
 {
        unsigned int mask;
 
@@ -122,14 +122,12 @@ sa1100_high_gpio_handler(unsigned int irq, struct irqdesc *desc,
                GEDR = mask;
 
                irq = IRQ_GPIO11;
-               desc = irq_desc + irq;
                mask >>= 11;
                do {
                        if (mask & 1)
-                               desc->handle(irq, desc, regs);
+                               generic_handle_irq(irq);
                        mask >>= 1;
                        irq++;
-                       desc++;
                } while (mask);
 
                mask = GEDR & 0xfffff800;
@@ -177,12 +175,13 @@ static int sa1100_high_gpio_wake(unsigned int irq, unsigned int on)
        return 0;
 }
 
-static struct irqchip sa1100_high_gpio_chip = {
+static struct irq_chip sa1100_high_gpio_chip = {
+       .name           = "GPIO-h",
        .ack            = sa1100_high_gpio_ack,
        .mask           = sa1100_high_gpio_mask,
        .unmask         = sa1100_high_gpio_unmask,
-       .type           = sa1100_gpio_type,
-       .wake           = sa1100_high_gpio_wake,
+       .set_type       = sa1100_gpio_type,
+       .set_wake       = sa1100_high_gpio_wake,
 };
 
 /*
@@ -199,10 +198,27 @@ static void sa1100_unmask_irq(unsigned int irq)
        ICMR |= (1 << irq);
 }
 
-static struct irqchip sa1100_normal_chip = {
+/*
+ * Apart form GPIOs, only the RTC alarm can be a wakeup event.
+ */
+static int sa1100_set_wake(unsigned int irq, unsigned int on)
+{
+       if (irq == IRQ_RTCAlrm) {
+               if (on)
+                       PWER |= PWER_RTC;
+               else
+                       PWER &= ~PWER_RTC;
+               return 0;
+       }
+       return -EINVAL;
+}
+
+static struct irq_chip sa1100_normal_chip = {
+       .name           = "SC",
        .ack            = sa1100_mask_irq,
        .mask           = sa1100_mask_irq,
        .unmask         = sa1100_unmask_irq,
+       .set_wake       = sa1100_set_wake,
 };
 
 static struct resource irq_resource = {
@@ -265,7 +281,7 @@ static int sa1100irq_resume(struct sys_device *dev)
 }
 
 static struct sysdev_class sa1100irq_sysclass = {
-       set_kset_name("sa11x0-irq"),
+       .name           = "sa11x0-irq",
        .suspend        = sa1100irq_suspend,
        .resume         = sa1100irq_resume,
 };
@@ -308,19 +324,19 @@ void __init sa1100_init_irq(void)
 
        for (irq = 0; irq <= 10; irq++) {
                set_irq_chip(irq, &sa1100_low_gpio_chip);
-               set_irq_handler(irq, do_edge_IRQ);
+               set_irq_handler(irq, handle_edge_irq);
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }
 
        for (irq = 12; irq <= 31; irq++) {
                set_irq_chip(irq, &sa1100_normal_chip);
-               set_irq_handler(irq, do_level_IRQ);
+               set_irq_handler(irq, handle_level_irq);
                set_irq_flags(irq, IRQF_VALID);
        }
 
        for (irq = 32; irq <= 48; irq++) {
                set_irq_chip(irq, &sa1100_high_gpio_chip);
-               set_irq_handler(irq, do_edge_IRQ);
+               set_irq_handler(irq, handle_edge_irq);
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }
 
@@ -329,4 +345,6 @@ void __init sa1100_init_irq(void)
         */
        set_irq_chip(IRQ_GPIO11_27, &sa1100_normal_chip);
        set_irq_chained_handler(IRQ_GPIO11_27, sa1100_high_gpio_handler);
+
+       sa1100_init_gpio();
 }