diff options
-rw-r--r-- | arch/arm/mach-orion/irq.c | 35 | ||||
-rw-r--r-- | arch/arm/plat-orion/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/plat-orion/irq.c | 64 | ||||
-rw-r--r-- | include/asm-arm/plat-orion/irq.h | 17 |
4 files changed, 84 insertions, 34 deletions
diff --git a/arch/arm/mach-orion/irq.c b/arch/arm/mach-orion/irq.c index df7e12ad378b..855793afcca8 100644 --- a/arch/arm/mach-orion/irq.c +++ b/arch/arm/mach-orion/irq.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/irq.h> | 15 | #include <linux/irq.h> |
16 | #include <asm/gpio.h> | 16 | #include <asm/gpio.h> |
17 | #include <asm/arch/orion.h> | 17 | #include <asm/arch/orion.h> |
18 | #include <asm/plat-orion/irq.h> | ||
18 | #include "common.h" | 19 | #include "common.h" |
19 | 20 | ||
20 | /***************************************************************************** | 21 | /***************************************************************************** |
@@ -197,41 +198,9 @@ static void __init orion_init_gpio_irq(void) | |||
197 | /***************************************************************************** | 198 | /***************************************************************************** |
198 | * Orion Main IRQ | 199 | * Orion Main IRQ |
199 | ****************************************************************************/ | 200 | ****************************************************************************/ |
200 | static void orion_main_irq_mask(u32 irq) | ||
201 | { | ||
202 | orion_clrbits(MAIN_IRQ_MASK, 1 << irq); | ||
203 | } | ||
204 | |||
205 | static void orion_main_irq_unmask(u32 irq) | ||
206 | { | ||
207 | orion_setbits(MAIN_IRQ_MASK, 1 << irq); | ||
208 | } | ||
209 | |||
210 | static struct irq_chip orion_main_irq_chip = { | ||
211 | .name = "Orion-IRQ-Main", | ||
212 | .ack = orion_main_irq_mask, | ||
213 | .mask = orion_main_irq_mask, | ||
214 | .unmask = orion_main_irq_unmask, | ||
215 | }; | ||
216 | |||
217 | static void __init orion_init_main_irq(void) | 201 | static void __init orion_init_main_irq(void) |
218 | { | 202 | { |
219 | int i; | 203 | orion_irq_init(0, (void __iomem *)MAIN_IRQ_MASK); |
220 | |||
221 | /* | ||
222 | * Mask and clear Main IRQ interrupts | ||
223 | */ | ||
224 | orion_write(MAIN_IRQ_MASK, 0x0); | ||
225 | orion_write(MAIN_IRQ_CAUSE, 0x0); | ||
226 | |||
227 | /* | ||
228 | * Register level handler for Main IRQs | ||
229 | */ | ||
230 | for (i = 0; i < IRQ_ORION_GPIO_START; i++) { | ||
231 | set_irq_chip(i, &orion_main_irq_chip); | ||
232 | set_irq_handler(i, handle_level_irq); | ||
233 | set_irq_flags(i, IRQF_VALID); | ||
234 | } | ||
235 | } | 204 | } |
236 | 205 | ||
237 | void __init orion_init_irq(void) | 206 | void __init orion_init_irq(void) |
diff --git a/arch/arm/plat-orion/Makefile b/arch/arm/plat-orion/Makefile index 2327762133f7..ea4ce342a196 100644 --- a/arch/arm/plat-orion/Makefile +++ b/arch/arm/plat-orion/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := | 5 | obj-y := irq.o |
6 | obj-m := | 6 | obj-m := |
7 | obj-n := | 7 | obj-n := |
8 | obj- := | 8 | obj- := |
diff --git a/arch/arm/plat-orion/irq.c b/arch/arm/plat-orion/irq.c new file mode 100644 index 000000000000..c5b669d234bc --- /dev/null +++ b/arch/arm/plat-orion/irq.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-orion/irq.c | ||
3 | * | ||
4 | * Marvell Orion SoC IRQ handling. | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/irq.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <asm/plat-orion/irq.h> | ||
16 | |||
17 | static void orion_irq_mask(u32 irq) | ||
18 | { | ||
19 | void __iomem *maskaddr = get_irq_chip_data(irq); | ||
20 | u32 mask; | ||
21 | |||
22 | mask = readl(maskaddr); | ||
23 | mask &= ~(1 << (irq & 31)); | ||
24 | writel(mask, maskaddr); | ||
25 | } | ||
26 | |||
27 | static void orion_irq_unmask(u32 irq) | ||
28 | { | ||
29 | void __iomem *maskaddr = get_irq_chip_data(irq); | ||
30 | u32 mask; | ||
31 | |||
32 | mask = readl(maskaddr); | ||
33 | mask |= 1 << (irq & 31); | ||
34 | writel(mask, maskaddr); | ||
35 | } | ||
36 | |||
37 | static struct irq_chip orion_irq_chip = { | ||
38 | .name = "orion_irq", | ||
39 | .ack = orion_irq_mask, | ||
40 | .mask = orion_irq_mask, | ||
41 | .unmask = orion_irq_unmask, | ||
42 | }; | ||
43 | |||
44 | void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr) | ||
45 | { | ||
46 | unsigned int i; | ||
47 | |||
48 | /* | ||
49 | * Mask all interrupts initially. | ||
50 | */ | ||
51 | writel(0, maskaddr); | ||
52 | |||
53 | /* | ||
54 | * Register IRQ sources. | ||
55 | */ | ||
56 | for (i = 0; i < 32; i++) { | ||
57 | unsigned int irq = irq_start + i; | ||
58 | |||
59 | set_irq_chip(irq, &orion_irq_chip); | ||
60 | set_irq_chip_data(irq, maskaddr); | ||
61 | set_irq_handler(irq, handle_level_irq); | ||
62 | set_irq_flags(irq, IRQF_VALID); | ||
63 | } | ||
64 | } | ||
diff --git a/include/asm-arm/plat-orion/irq.h b/include/asm-arm/plat-orion/irq.h new file mode 100644 index 000000000000..94aeed919d5b --- /dev/null +++ b/include/asm-arm/plat-orion/irq.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * include/asm-arm/plat-orion/irq.h | ||
3 | * | ||
4 | * Marvell Orion SoC IRQ handling. | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_PLAT_ORION_IRQ_H | ||
12 | #define __ASM_PLAT_ORION_IRQ_H | ||
13 | |||
14 | void orion_irq_init(unsigned int irq_start, void __iomem *maskaddr); | ||
15 | |||
16 | |||
17 | #endif | ||