blob: d6627c1f7f30bb9691ea5eda9c42059df5c5c9cb [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>
Saeed Bisharaedabd382009-08-06 15:12:43 +030014#include <plat/irq.h>
Saeed Bisharaedabd382009-08-06 15:12:43 +030015#include <mach/bridge-regs.h>
Rob Herringce915742012-08-29 10:16:55 -050016#include <plat/orion-gpio.h>
Saeed Bisharaedabd382009-08-06 15:12:43 +030017#include "common.h"
18
Andrew Lunn278b45b2012-06-27 13:40:04 +020019static 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
26static int __initdata gpio1_irqs[4] = {
27 IRQ_DOVE_HIGH_GPIO,
28 0,
29 0,
30 0,
31};
32
33static int __initdata gpio2_irqs[4] = {
34 0,
35 0,
36 0,
37 0,
38};
39
Thomas Petazzonideac3d82014-04-22 23:26:26 +020040static void __iomem *dove_irq_base = IRQ_VIRT_BASE;
41
42static 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) {
Russell King5d6bed22015-06-22 18:39:43 +010050 unsigned int hwirq = 1 + __fls(stat);
Thomas Petazzonideac3d82014-04-22 23:26:26 +020051 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) {
Russell King5d6bed22015-06-22 18:39:43 +010057 unsigned int hwirq = 33 + __fls(stat);
Thomas Petazzonideac3d82014-04-22 23:26:26 +020058 handle_IRQ(hwirq, regs);
59 return;
60 }
61}
Thomas Petazzonideac3d82014-04-22 23:26:26 +020062
Saeed Bisharaedabd382009-08-06 15:12:43 +030063void __init dove_init_irq(void)
64{
Russell King5d6bed22015-06-22 18:39:43 +010065 orion_irq_init(1, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF);
66 orion_irq_init(33, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF);
Saeed Bisharaedabd382009-08-06 15:12:43 +030067
Thomas Petazzonideac3d82014-04-22 23:26:26 +020068 set_handle_irq(dove_legacy_handle_irq);
Thomas Petazzonideac3d82014-04-22 23:26:26 +020069
Saeed Bisharaedabd382009-08-06 15:12:43 +030070 /*
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010071 * Initialize gpiolib for GPIOs 0-71.
Saeed Bisharaedabd382009-08-06 15:12:43 +030072 */
Thomas Petazzonic3c5a282012-09-11 14:27:18 +020073 orion_gpio_init(NULL, 0, 32, DOVE_GPIO_LO_VIRT_BASE, 0,
Andrew Lunn278b45b2012-06-27 13:40:04 +020074 IRQ_DOVE_GPIO_START, gpio0_irqs);
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010075
Thomas Petazzonic3c5a282012-09-11 14:27:18 +020076 orion_gpio_init(NULL, 32, 32, DOVE_GPIO_HI_VIRT_BASE, 0,
Andrew Lunn278b45b2012-06-27 13:40:04 +020077 IRQ_DOVE_GPIO_START + 32, gpio1_irqs);
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010078
Thomas Petazzonic3c5a282012-09-11 14:27:18 +020079 orion_gpio_init(NULL, 64, 8, DOVE_GPIO2_VIRT_BASE, 0,
Andrew Lunn278b45b2012-06-27 13:40:04 +020080 IRQ_DOVE_GPIO_START + 64, gpio2_irqs);
Saeed Bisharaedabd382009-08-06 15:12:43 +030081}