Commit | Line | Data |
---|---|---|
edabd38e SB |
1 | /* |
2 | * arch/arm/mach-dove/irq.c | |
3 | * | |
4 | * Dove 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 | */ | |
edabd38e SB |
10 | #include <linux/init.h> |
11 | #include <linux/irq.h> | |
edabd38e | 12 | #include <linux/io.h> |
b8cd337c | 13 | #include <asm/exception.h> |
edabd38e | 14 | #include <plat/irq.h> |
edabd38e | 15 | #include <mach/bridge-regs.h> |
ce91574c | 16 | #include <plat/orion-gpio.h> |
edabd38e SB |
17 | #include "common.h" |
18 | ||
278b45b0 AL |
19 | static int __initdata gpio0_irqs[4] = { |
20 | IRQ_DOVE_GPIO_0_7, | |
21 | IRQ_DOVE_GPIO_8_15, | |
22 | IRQ_DOVE_GPIO_16_23, | |
23 | IRQ_DOVE_GPIO_24_31, | |
24 | }; | |
25 | ||
26 | static int __initdata gpio1_irqs[4] = { | |
27 | IRQ_DOVE_HIGH_GPIO, | |
28 | 0, | |
29 | 0, | |
30 | 0, | |
31 | }; | |
32 | ||
33 | static int __initdata gpio2_irqs[4] = { | |
34 | 0, | |
35 | 0, | |
36 | 0, | |
37 | 0, | |
38 | }; | |
39 | ||
deac3d87 TP |
40 | static void __iomem *dove_irq_base = IRQ_VIRT_BASE; |
41 | ||
42 | static asmlinkage void | |
43 | __exception_irq_entry dove_legacy_handle_irq(struct pt_regs *regs) | |
44 | { | |
45 | u32 stat; | |
46 | ||
47 | stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_LOW_OFF); | |
48 | stat &= readl_relaxed(dove_irq_base + IRQ_MASK_LOW_OFF); | |
49 | if (stat) { | |
5d6bed2a | 50 | unsigned int hwirq = 1 + __fls(stat); |
deac3d87 TP |
51 | handle_IRQ(hwirq, regs); |
52 | return; | |
53 | } | |
54 | stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_HIGH_OFF); | |
55 | stat &= readl_relaxed(dove_irq_base + IRQ_MASK_HIGH_OFF); | |
56 | if (stat) { | |
5d6bed2a | 57 | unsigned int hwirq = 33 + __fls(stat); |
deac3d87 TP |
58 | handle_IRQ(hwirq, regs); |
59 | return; | |
60 | } | |
61 | } | |
deac3d87 | 62 | |
edabd38e SB |
63 | void __init dove_init_irq(void) |
64 | { | |
5d6bed2a RK |
65 | orion_irq_init(1, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF); |
66 | orion_irq_init(33, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF); | |
edabd38e | 67 | |
deac3d87 | 68 | set_handle_irq(dove_legacy_handle_irq); |
deac3d87 | 69 | |
edabd38e | 70 | /* |
9eac6d0a | 71 | * Initialize gpiolib for GPIOs 0-71. |
edabd38e | 72 | */ |
c3c5a281 | 73 | orion_gpio_init(NULL, 0, 32, DOVE_GPIO_LO_VIRT_BASE, 0, |
278b45b0 AL |
74 | IRQ_DOVE_GPIO_START, gpio0_irqs); |
75 | ||
c3c5a281 | 76 | orion_gpio_init(NULL, 32, 32, DOVE_GPIO_HI_VIRT_BASE, 0, |
278b45b0 AL |
77 | IRQ_DOVE_GPIO_START + 32, gpio1_irqs); |
78 | ||
c3c5a281 | 79 | orion_gpio_init(NULL, 64, 8, DOVE_GPIO2_VIRT_BASE, 0, |
278b45b0 | 80 | IRQ_DOVE_GPIO_START + 64, gpio2_irqs); |
edabd38e | 81 | } |