Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 1 | /* |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 2 | * arch/arm/mach-orion5x/irq.c |
Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 3 | * |
| 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 Buytenhek | 159ffb3 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 9 | * License version 2. This program is licensed "as is" without any |
Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 10 | * warranty of any kind, whether express or implied. |
| 11 | */ |
Russell King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 12 | #include <linux/gpio.h> |
Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 13 | #include <linux/kernel.h> |
Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 14 | #include <linux/irq.h> |
Thomas Petazzoni | 3904a39 | 2012-09-11 14:27:21 +0200 | [diff] [blame] | 15 | #include <linux/io.h> |
Nicolas Pitre | fdd8b07 | 2009-04-22 20:08:17 +0100 | [diff] [blame] | 16 | #include <mach/bridge-regs.h> |
Rob Herring | ce91574 | 2012-08-29 10:16:55 -0500 | [diff] [blame] | 17 | #include <plat/orion-gpio.h> |
Lennert Buytenhek | 6f088f1 | 2008-08-09 13:44:58 +0200 | [diff] [blame] | 18 | #include <plat/irq.h> |
Thomas Petazzoni | ab5ab9d | 2014-04-22 23:26:27 +0200 | [diff] [blame] | 19 | #include <asm/exception.h> |
Andrew Lunn | 4236666 | 2013-10-23 16:12:51 +0200 | [diff] [blame] | 20 | #include "common.h" |
Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 21 | |
Andrew Lunn | 278b45b | 2012-06-27 13:40:04 +0200 | [diff] [blame] | 22 | static 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 Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 28 | |
Thomas Petazzoni | ab5ab9d | 2014-04-22 23:26:27 +0200 | [diff] [blame] | 29 | #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 | |
| 37 | asmlinkage 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 Buytenhek | 0733231 | 2008-10-20 01:51:03 +0200 | [diff] [blame] | 52 | void __init orion5x_init_irq(void) |
Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 53 | { |
Thomas Petazzoni | 3904a39 | 2012-09-11 14:27:21 +0200 | [diff] [blame] | 54 | orion_irq_init(0, MAIN_IRQ_MASK); |
Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 55 | |
Thomas Petazzoni | ab5ab9d | 2014-04-22 23:26:27 +0200 | [diff] [blame] | 56 | #ifdef CONFIG_MULTI_IRQ_HANDLER |
| 57 | set_handle_irq(orion5x_legacy_handle_irq); |
| 58 | #endif |
| 59 | |
Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 60 | /* |
Lennert Buytenhek | 9eac6d0 | 2010-12-14 12:54:03 +0100 | [diff] [blame] | 61 | * Initialize gpiolib for GPIOs 0-31. |
Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 62 | */ |
Thomas Petazzoni | 3904a39 | 2012-09-11 14:27:21 +0200 | [diff] [blame] | 63 | orion_gpio_init(NULL, 0, 32, GPIO_VIRT_BASE, 0, |
Andrew Lunn | 278b45b | 2012-06-27 13:40:04 +0200 | [diff] [blame] | 64 | IRQ_ORION5X_GPIO_START, gpio0_irqs); |
Tzachi Perelstein | 3085de6 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 65 | } |