blob: 31ccbcee262742f6003dfffffc05eab9f3c3c480 [file] [log] [blame]
Saeed Bisharaedabd382009-08-06 15:12:43 +03001/*
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 */
Saeed Bisharaedabd382009-08-06 15:12:43 +030010#include <linux/init.h>
11#include <linux/irq.h>
Saeed Bisharaedabd382009-08-06 15:12:43 +030012#include <linux/io.h>
Arnd Bergmannb8cd3372015-12-02 22:27:04 +010013#include <asm/exception.h>
Arnd Bergmannce781792019-07-31 21:56:54 +020014
Saeed Bisharaedabd382009-08-06 15:12:43 +030015#include <plat/irq.h>
Rob Herringce915742012-08-29 10:16:55 -050016#include <plat/orion-gpio.h>
Arnd Bergmannce781792019-07-31 21:56:54 +020017
18#include "pm.h"
19#include "bridge-regs.h"
Saeed Bisharaedabd382009-08-06 15:12:43 +030020#include "common.h"
21
Andrew Lunn278b45b2012-06-27 13:40:04 +020022static 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,
27};
28
29static int __initdata gpio1_irqs[4] = {
30 IRQ_DOVE_HIGH_GPIO,
31 0,
32 0,
33 0,
34};
35
36static int __initdata gpio2_irqs[4] = {
37 0,
38 0,
39 0,
40 0,
41};
42
Thomas Petazzonideac3d82014-04-22 23:26:26 +020043static void __iomem *dove_irq_base = IRQ_VIRT_BASE;
44
45static asmlinkage void
46__exception_irq_entry dove_legacy_handle_irq(struct pt_regs *regs)
47{
48 u32 stat;
49
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) {
Russell King5d6bed22015-06-22 18:39:43 +010053 unsigned int hwirq = 1 + __fls(stat);
Thomas Petazzonideac3d82014-04-22 23:26:26 +020054 handle_IRQ(hwirq, regs);
55 return;
56 }
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) {
Russell King5d6bed22015-06-22 18:39:43 +010060 unsigned int hwirq = 33 + __fls(stat);
Thomas Petazzonideac3d82014-04-22 23:26:26 +020061 handle_IRQ(hwirq, regs);
62 return;
63 }
64}
Thomas Petazzonideac3d82014-04-22 23:26:26 +020065
Saeed Bisharaedabd382009-08-06 15:12:43 +030066void __init dove_init_irq(void)
67{
Russell King5d6bed22015-06-22 18:39:43 +010068 orion_irq_init(1, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF);
69 orion_irq_init(33, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF);
Saeed Bisharaedabd382009-08-06 15:12:43 +030070
Thomas Petazzonideac3d82014-04-22 23:26:26 +020071 set_handle_irq(dove_legacy_handle_irq);
Thomas Petazzonideac3d82014-04-22 23:26:26 +020072
Saeed Bisharaedabd382009-08-06 15:12:43 +030073 /*
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010074 * Initialize gpiolib for GPIOs 0-71.
Saeed Bisharaedabd382009-08-06 15:12:43 +030075 */
Thomas Petazzonic3c5a282012-09-11 14:27:18 +020076 orion_gpio_init(NULL, 0, 32, DOVE_GPIO_LO_VIRT_BASE, 0,
Andrew Lunn278b45b2012-06-27 13:40:04 +020077 IRQ_DOVE_GPIO_START, gpio0_irqs);
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010078
Thomas Petazzonic3c5a282012-09-11 14:27:18 +020079 orion_gpio_init(NULL, 32, 32, DOVE_GPIO_HI_VIRT_BASE, 0,
Andrew Lunn278b45b2012-06-27 13:40:04 +020080 IRQ_DOVE_GPIO_START + 32, gpio1_irqs);
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010081
Thomas Petazzonic3c5a282012-09-11 14:27:18 +020082 orion_gpio_init(NULL, 64, 8, DOVE_GPIO2_VIRT_BASE, 0,
Andrew Lunn278b45b2012-06-27 13:40:04 +020083 IRQ_DOVE_GPIO_START + 64, gpio2_irqs);
Saeed Bisharaedabd382009-08-06 15:12:43 +030084}