blob: c4c68e5b94f145cf1a3d36c4a7b4e281d40d92ba [file] [log] [blame]
Saeed Bishara651c74c2008-06-22 22:45:06 +02001/*
2 * arch/arm/mach-kirkwood/irq.c
3 *
4 * Kirkwood 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 */
Russell King2f8163b2011-07-26 10:53:52 +010010#include <linux/gpio.h>
Saeed Bishara651c74c2008-06-22 22:45:06 +020011#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/io.h>
Nicolas Pitrefdd8b072009-04-22 20:08:17 +010015#include <mach/bridge-regs.h>
Lennert Buytenhek6f088f12008-08-09 13:44:58 +020016#include <plat/irq.h>
Saeed Bishara651c74c2008-06-22 22:45:06 +020017#include "common.h"
18
Lennert Buytenhek4c213432008-10-20 01:51:04 +020019static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
20{
21 BUG_ON(irq < IRQ_KIRKWOOD_GPIO_LOW_0_7);
22 BUG_ON(irq > IRQ_KIRKWOOD_GPIO_HIGH_16_23);
23
24 orion_gpio_irq_handler((irq - IRQ_KIRKWOOD_GPIO_LOW_0_7) << 3);
25}
26
Saeed Bishara651c74c2008-06-22 22:45:06 +020027void __init kirkwood_init_irq(void)
28{
29 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF));
30 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF));
Lennert Buytenhek4c213432008-10-20 01:51:04 +020031
32 /*
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010033 * Initialize gpiolib for GPIOs 0-49.
Lennert Buytenhek4c213432008-10-20 01:51:04 +020034 */
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010035 orion_gpio_init(0, 32, GPIO_LOW_VIRT_BASE, 0,
36 IRQ_KIRKWOOD_GPIO_START);
Thomas Gleixner6845664a2011-03-24 13:25:22 +010037 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler);
38 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler);
39 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler);
40 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler);
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010041
42 orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0,
43 IRQ_KIRKWOOD_GPIO_START + 32);
Thomas Gleixner6845664a2011-03-24 13:25:22 +010044 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler);
45 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler);
46 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23,
47 gpio_irq_handler);
Saeed Bishara651c74c2008-06-22 22:45:06 +020048}