blob: b1b45fff776e614f68ed1058e1313361e03b487b [file] [log] [blame]
Tzachi Perelstein3085de62007-10-23 15:14:42 -04001/*
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -04002 * arch/arm/mach-orion5x/irq.c
Tzachi Perelstein3085de62007-10-23 15:14:42 -04003 *
4 * Core IRQ functions for Marvell Orion System On Chip
5 *
6 * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
Lennert Buytenhek159ffb32008-03-27 14:51:41 -04009 * License version 2. This program is licensed "as is" without any
Tzachi Perelstein3085de62007-10-23 15:14:42 -040010 * warranty of any kind, whether express or implied.
11 */
Russell King2f8163b2011-07-26 10:53:52 +010012#include <linux/gpio.h>
Tzachi Perelstein3085de62007-10-23 15:14:42 -040013#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/irq.h>
Russell Kingfced80c2008-09-06 12:10:45 +010016#include <linux/io.h>
Nicolas Pitrefdd8b072009-04-22 20:08:17 +010017#include <mach/bridge-regs.h>
Lennert Buytenhek6f088f12008-08-09 13:44:58 +020018#include <plat/irq.h>
Tzachi Perelstein3085de62007-10-23 15:14:42 -040019#include "common.h"
20
Lennert Buytenhek07332312008-10-20 01:51:03 +020021static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
Tzachi Perelsteinf0066612007-11-15 10:57:48 +020022{
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040023 BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31);
Tzachi Perelstein3085de62007-10-23 15:14:42 -040024
Lennert Buytenhek07332312008-10-20 01:51:03 +020025 orion_gpio_irq_handler((irq - IRQ_ORION5X_GPIO_0_7) << 3);
Tzachi Perelstein3085de62007-10-23 15:14:42 -040026}
27
Lennert Buytenhek07332312008-10-20 01:51:03 +020028void __init orion5x_init_irq(void)
Tzachi Perelstein3085de62007-10-23 15:14:42 -040029{
Lennert Buytenhek07332312008-10-20 01:51:03 +020030 orion_irq_init(0, (void __iomem *)MAIN_IRQ_MASK);
Tzachi Perelstein3085de62007-10-23 15:14:42 -040031
32 /*
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010033 * Initialize gpiolib for GPIOs 0-31.
Tzachi Perelstein3085de62007-10-23 15:14:42 -040034 */
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010035 orion_gpio_init(0, 32, GPIO_VIRT_BASE, 0, IRQ_ORION5X_GPIO_START);
Thomas Gleixner6845664a2011-03-24 13:25:22 +010036 irq_set_chained_handler(IRQ_ORION5X_GPIO_0_7, gpio_irq_handler);
37 irq_set_chained_handler(IRQ_ORION5X_GPIO_8_15, gpio_irq_handler);
38 irq_set_chained_handler(IRQ_ORION5X_GPIO_16_23, gpio_irq_handler);
39 irq_set_chained_handler(IRQ_ORION5X_GPIO_24_31, gpio_irq_handler);
Tzachi Perelstein3085de62007-10-23 15:14:42 -040040}