Linux-2.6.12-rc2
[linux-2.6/next.git] / arch / arm / mach-lh7a40x / irq-lh7a400.c
blobf334d81c2cd8bea264ae5385215d515d12079211
1 /* arch/arm/mach-lh7a40x/irq-lh7a400.c
3 * Copyright (C) 2004 Coastal Environmental Systems
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
9 */
11 #include <linux/init.h>
12 #include <linux/module.h>
13 #include <linux/interrupt.h>
14 #include <linux/ptrace.h>
16 #include <asm/hardware.h>
17 #include <asm/irq.h>
18 #include <asm/mach/irq.h>
19 #include <asm/arch/irq.h>
20 #include <asm/arch/irqs.h>
23 /* CPU IRQ handling */
25 static void lh7a400_mask_irq (u32 irq)
27 INTC_INTENC = (1 << irq);
30 static void lh7a400_unmask_irq (u32 irq)
32 INTC_INTENS = (1 << irq);
35 static void lh7a400_ack_gpio_irq (u32 irq)
37 GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (irq));
38 INTC_INTENC = (1 << irq);
41 static struct irqchip lh7a400_internal_chip = {
42 .ack = lh7a400_mask_irq, /* Level triggering -> mask is ack */
43 .mask = lh7a400_mask_irq,
44 .unmask = lh7a400_unmask_irq,
47 static struct irqchip lh7a400_gpio_chip = {
48 .ack = lh7a400_ack_gpio_irq,
49 .mask = lh7a400_mask_irq,
50 .unmask = lh7a400_unmask_irq,
54 /* IRQ initialization */
56 void __init lh7a400_init_irq (void)
58 int irq;
60 INTC_INTENC = 0xffffffff; /* Disable all interrupts */
61 GPIO_GPIOFINTEN = 0x00; /* Disable all GPIOF interrupts */
62 barrier ();
64 for (irq = 0; irq < NR_IRQS; ++irq) {
65 switch (irq) {
66 case IRQ_GPIO0INTR:
67 case IRQ_GPIO1INTR:
68 case IRQ_GPIO2INTR:
69 case IRQ_GPIO3INTR:
70 case IRQ_GPIO4INTR:
71 case IRQ_GPIO5INTR:
72 case IRQ_GPIO6INTR:
73 case IRQ_GPIO7INTR:
74 set_irq_chip (irq, &lh7a400_gpio_chip);
75 set_irq_handler (irq, do_level_IRQ); /* OK default */
76 break;
77 default:
78 set_irq_chip (irq, &lh7a400_internal_chip);
79 set_irq_handler (irq, do_level_IRQ);
81 set_irq_flags (irq, IRQF_VALID);
84 lh7a40x_init_board_irq ();
86 /* *** FIXME: the LH7a400 does use FIQ interrupts in some cases. For
87 the time being, these are not initialized. */
89 /* init_FIQ(); */