1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm/mach-dove/irq.c
7 #include <linux/init.h>
10 #include <asm/exception.h>
13 #include <plat/orion-gpio.h>
16 #include "bridge-regs.h"
19 static int __initdata gpio0_irqs
[4] = {
26 static int __initdata gpio1_irqs
[4] = {
33 static int __initdata gpio2_irqs
[4] = {
40 static void __iomem
*dove_irq_base
= IRQ_VIRT_BASE
;
42 static asmlinkage
void
43 __exception_irq_entry
dove_legacy_handle_irq(struct pt_regs
*regs
)
47 stat
= readl_relaxed(dove_irq_base
+ IRQ_CAUSE_LOW_OFF
);
48 stat
&= readl_relaxed(dove_irq_base
+ IRQ_MASK_LOW_OFF
);
50 unsigned int hwirq
= 1 + __fls(stat
);
51 handle_IRQ(hwirq
, regs
);
54 stat
= readl_relaxed(dove_irq_base
+ IRQ_CAUSE_HIGH_OFF
);
55 stat
&= readl_relaxed(dove_irq_base
+ IRQ_MASK_HIGH_OFF
);
57 unsigned int hwirq
= 33 + __fls(stat
);
58 handle_IRQ(hwirq
, regs
);
63 void __init
dove_init_irq(void)
65 orion_irq_init(1, IRQ_VIRT_BASE
+ IRQ_MASK_LOW_OFF
);
66 orion_irq_init(33, IRQ_VIRT_BASE
+ IRQ_MASK_HIGH_OFF
);
68 set_handle_irq(dove_legacy_handle_irq
);
71 * Initialize gpiolib for GPIOs 0-71.
73 orion_gpio_init(0, 32, DOVE_GPIO_LO_VIRT_BASE
, 0,
74 IRQ_DOVE_GPIO_START
, gpio0_irqs
);
76 orion_gpio_init(32, 32, DOVE_GPIO_HI_VIRT_BASE
, 0,
77 IRQ_DOVE_GPIO_START
+ 32, gpio1_irqs
);
79 orion_gpio_init(64, 8, DOVE_GPIO2_VIRT_BASE
, 0,
80 IRQ_DOVE_GPIO_START
+ 64, gpio2_irqs
);