Linux 5.6.13
[linux/fpc-iii.git] / arch / arm / mach-dove / irq.c
blob31ccbcee262742f6003dfffffc05eab9f3c3c480
1 /*
2 * arch/arm/mach-dove/irq.c
4 * Dove IRQ handling.
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 #include <linux/init.h>
11 #include <linux/irq.h>
12 #include <linux/io.h>
13 #include <asm/exception.h>
15 #include <plat/irq.h>
16 #include <plat/orion-gpio.h>
18 #include "pm.h"
19 #include "bridge-regs.h"
20 #include "common.h"
22 static int __initdata gpio0_irqs[4] = {
23 IRQ_DOVE_GPIO_0_7,
24 IRQ_DOVE_GPIO_8_15,
25 IRQ_DOVE_GPIO_16_23,
26 IRQ_DOVE_GPIO_24_31,
29 static int __initdata gpio1_irqs[4] = {
30 IRQ_DOVE_HIGH_GPIO,
36 static int __initdata gpio2_irqs[4] = {
43 static void __iomem *dove_irq_base = IRQ_VIRT_BASE;
45 static asmlinkage void
46 __exception_irq_entry dove_legacy_handle_irq(struct pt_regs *regs)
48 u32 stat;
50 stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_LOW_OFF);
51 stat &= readl_relaxed(dove_irq_base + IRQ_MASK_LOW_OFF);
52 if (stat) {
53 unsigned int hwirq = 1 + __fls(stat);
54 handle_IRQ(hwirq, regs);
55 return;
57 stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_HIGH_OFF);
58 stat &= readl_relaxed(dove_irq_base + IRQ_MASK_HIGH_OFF);
59 if (stat) {
60 unsigned int hwirq = 33 + __fls(stat);
61 handle_IRQ(hwirq, regs);
62 return;
66 void __init dove_init_irq(void)
68 orion_irq_init(1, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF);
69 orion_irq_init(33, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF);
71 set_handle_irq(dove_legacy_handle_irq);
74 * Initialize gpiolib for GPIOs 0-71.
76 orion_gpio_init(NULL, 0, 32, DOVE_GPIO_LO_VIRT_BASE, 0,
77 IRQ_DOVE_GPIO_START, gpio0_irqs);
79 orion_gpio_init(NULL, 32, 32, DOVE_GPIO_HI_VIRT_BASE, 0,
80 IRQ_DOVE_GPIO_START + 32, gpio1_irqs);
82 orion_gpio_init(NULL, 64, 8, DOVE_GPIO2_VIRT_BASE, 0,
83 IRQ_DOVE_GPIO_START + 64, gpio2_irqs);