blob: cd4bac4d7e43f194f8bf0306f7ed808d48caec3d [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>
Tzachi Perelstein3085de62007-10-23 15:14:42 -040014#include <linux/irq.h>
Thomas Petazzoni3904a392012-09-11 14:27:21 +020015#include <linux/io.h>
Nicolas Pitrefdd8b072009-04-22 20:08:17 +010016#include <mach/bridge-regs.h>
Rob Herringce915742012-08-29 10:16:55 -050017#include <plat/orion-gpio.h>
Lennert Buytenhek6f088f12008-08-09 13:44:58 +020018#include <plat/irq.h>
Thomas Petazzoniab5ab9d2014-04-22 23:26:27 +020019#include <asm/exception.h>
Andrew Lunn42366662013-10-23 16:12:51 +020020#include "common.h"
Tzachi Perelstein3085de62007-10-23 15:14:42 -040021
Andrew Lunn278b45b2012-06-27 13:40:04 +020022static int __initdata gpio0_irqs[4] = {
23 IRQ_ORION5X_GPIO_0_7,
24 IRQ_ORION5X_GPIO_8_15,
25 IRQ_ORION5X_GPIO_16_23,
26 IRQ_ORION5X_GPIO_24_31,
27};
Tzachi Perelstein3085de62007-10-23 15:14:42 -040028
Thomas Petazzoniab5ab9d2014-04-22 23:26:27 +020029#ifdef CONFIG_MULTI_IRQ_HANDLER
30/*
31 * Compiling with both non-DT and DT support enabled, will
32 * break asm irq handler used by non-DT boards. Therefore,
33 * we provide a C-style irq handler even for non-DT boards,
34 * if MULTI_IRQ_HANDLER is set.
35 */
36
37asmlinkage void
38__exception_irq_entry orion5x_legacy_handle_irq(struct pt_regs *regs)
39{
40 u32 stat;
41
42 stat = readl_relaxed(MAIN_IRQ_CAUSE);
43 stat &= readl_relaxed(MAIN_IRQ_MASK);
44 if (stat) {
45 unsigned int hwirq = __fls(stat);
46 handle_IRQ(hwirq, regs);
47 return;
48 }
49}
50#endif
51
Lennert Buytenhek07332312008-10-20 01:51:03 +020052void __init orion5x_init_irq(void)
Tzachi Perelstein3085de62007-10-23 15:14:42 -040053{
Thomas Petazzoni3904a392012-09-11 14:27:21 +020054 orion_irq_init(0, MAIN_IRQ_MASK);
Tzachi Perelstein3085de62007-10-23 15:14:42 -040055
Thomas Petazzoniab5ab9d2014-04-22 23:26:27 +020056#ifdef CONFIG_MULTI_IRQ_HANDLER
57 set_handle_irq(orion5x_legacy_handle_irq);
58#endif
59
Tzachi Perelstein3085de62007-10-23 15:14:42 -040060 /*
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010061 * Initialize gpiolib for GPIOs 0-31.
Tzachi Perelstein3085de62007-10-23 15:14:42 -040062 */
Thomas Petazzoni3904a392012-09-11 14:27:21 +020063 orion_gpio_init(NULL, 0, 32, GPIO_VIRT_BASE, 0,
Andrew Lunn278b45b2012-06-27 13:40:04 +020064 IRQ_ORION5X_GPIO_START, gpio0_irqs);
Tzachi Perelstein3085de62007-10-23 15:14:42 -040065}