Commit | Line | Data |
---|---|---|
3085de6a | 1 | /* |
9dd0b194 | 2 | * arch/arm/mach-orion5x/irq.c |
3085de6a TP |
3 | * |
4 | * Core IRQ functions for Marvell Orion System On Chip | |
5 | * | |
6 | * Maintainer: Tzachi Perelstein <tzachi@marvell.com> | |
7 | * | |
8 | * This file is licensed under the terms of the GNU General Public | |
159ffb3a | 9 | * License version 2. This program is licensed "as is" without any |
3085de6a TP |
10 | * warranty of any kind, whether express or implied. |
11 | */ | |
12 | ||
13 | #include <linux/kernel.h> | |
14 | #include <linux/init.h> | |
15 | #include <linux/irq.h> | |
fced80c7 | 16 | #include <linux/io.h> |
3085de6a | 17 | #include <asm/gpio.h> |
a09e64fb | 18 | #include <mach/orion5x.h> |
6f088f1d | 19 | #include <plat/irq.h> |
3085de6a TP |
20 | #include "common.h" |
21 | ||
07332318 | 22 | static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) |
3085de6a | 23 | { |
9dd0b194 | 24 | BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31); |
f0066614 | 25 | |
07332318 | 26 | orion_gpio_irq_handler((irq - IRQ_ORION5X_GPIO_0_7) << 3); |
3085de6a TP |
27 | } |
28 | ||
07332318 | 29 | void __init orion5x_init_irq(void) |
3085de6a TP |
30 | { |
31 | int i; | |
07332318 LB |
32 | |
33 | orion_irq_init(0, (void __iomem *)MAIN_IRQ_MASK); | |
3085de6a TP |
34 | |
35 | /* | |
36 | * Mask and clear GPIO IRQ interrupts | |
37 | */ | |
07332318 LB |
38 | writel(0x0, GPIO_LEVEL_MASK(0)); |
39 | writel(0x0, GPIO_EDGE_MASK(0)); | |
40 | writel(0x0, GPIO_EDGE_CAUSE(0)); | |
3085de6a TP |
41 | |
42 | /* | |
f0066614 TP |
43 | * Register chained level handlers for GPIO IRQs by default. |
44 | * User can use set_type() if he wants to use edge types handlers. | |
3085de6a | 45 | */ |
9dd0b194 | 46 | for (i = IRQ_ORION5X_GPIO_START; i < NR_IRQS; i++) { |
fd4b9b36 | 47 | set_irq_chip(i, &orion_gpio_irq_chip); |
3085de6a | 48 | set_irq_handler(i, handle_level_irq); |
07332318 | 49 | irq_desc[i].status |= IRQ_LEVEL; |
3085de6a TP |
50 | set_irq_flags(i, IRQF_VALID); |
51 | } | |
07332318 LB |
52 | set_irq_chained_handler(IRQ_ORION5X_GPIO_0_7, gpio_irq_handler); |
53 | set_irq_chained_handler(IRQ_ORION5X_GPIO_8_15, gpio_irq_handler); | |
54 | set_irq_chained_handler(IRQ_ORION5X_GPIO_16_23, gpio_irq_handler); | |
55 | set_irq_chained_handler(IRQ_ORION5X_GPIO_24_31, gpio_irq_handler); | |
3085de6a | 56 | } |