Stanislav Samsonov | 794d15b | 2008-06-22 22:45:10 +0200 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-mv78xx0/irq.c |
| 3 | * |
| 4 | * MV78xx0 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 King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 10 | #include <linux/gpio.h> |
Stanislav Samsonov | 794d15b | 2008-06-22 22:45:10 +0200 | [diff] [blame] | 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/pci.h> |
Lennert Buytenhek | b95a13d | 2008-10-20 01:51:04 +0200 | [diff] [blame] | 14 | #include <linux/irq.h> |
Nicolas Pitre | fdd8b07 | 2009-04-22 20:08:17 +0100 | [diff] [blame] | 15 | #include <mach/bridge-regs.h> |
Lennert Buytenhek | 6f088f1 | 2008-08-09 13:44:58 +0200 | [diff] [blame] | 16 | #include <plat/irq.h> |
Stanislav Samsonov | 794d15b | 2008-06-22 22:45:10 +0200 | [diff] [blame] | 17 | #include "common.h" |
| 18 | |
Lennert Buytenhek | b95a13d | 2008-10-20 01:51:04 +0200 | [diff] [blame] | 19 | static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) |
| 20 | { |
| 21 | BUG_ON(irq < IRQ_MV78XX0_GPIO_0_7 || irq > IRQ_MV78XX0_GPIO_24_31); |
| 22 | |
| 23 | orion_gpio_irq_handler((irq - IRQ_MV78XX0_GPIO_0_7) << 3); |
| 24 | } |
| 25 | |
Stanislav Samsonov | 794d15b | 2008-06-22 22:45:10 +0200 | [diff] [blame] | 26 | void __init mv78xx0_init_irq(void) |
| 27 | { |
| 28 | orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); |
| 29 | orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); |
Lennert Buytenhek | 1f8081f | 2008-08-26 16:04:05 +0200 | [diff] [blame] | 30 | orion_irq_init(64, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_ERR_OFF)); |
Lennert Buytenhek | b95a13d | 2008-10-20 01:51:04 +0200 | [diff] [blame] | 31 | |
| 32 | /* |
Lennert Buytenhek | 9eac6d0 | 2010-12-14 12:54:03 +0100 | [diff] [blame] | 33 | * Initialize gpiolib for GPIOs 0-31. (The GPIO interrupt mask |
| 34 | * registers for core #1 are at an offset of 0x18 from those of |
| 35 | * core #0.) |
Lennert Buytenhek | b95a13d | 2008-10-20 01:51:04 +0200 | [diff] [blame] | 36 | */ |
Lennert Buytenhek | 9eac6d0 | 2010-12-14 12:54:03 +0100 | [diff] [blame] | 37 | orion_gpio_init(0, 32, GPIO_VIRT_BASE, |
| 38 | mv78xx0_core_index() ? 0x18 : 0, |
| 39 | IRQ_MV78XX0_GPIO_START); |
Thomas Gleixner | 6845664a | 2011-03-24 13:25:22 +0100 | [diff] [blame] | 40 | irq_set_chained_handler(IRQ_MV78XX0_GPIO_0_7, gpio_irq_handler); |
| 41 | irq_set_chained_handler(IRQ_MV78XX0_GPIO_8_15, gpio_irq_handler); |
| 42 | irq_set_chained_handler(IRQ_MV78XX0_GPIO_16_23, gpio_irq_handler); |
| 43 | irq_set_chained_handler(IRQ_MV78XX0_GPIO_24_31, gpio_irq_handler); |
Stanislav Samsonov | 794d15b | 2008-06-22 22:45:10 +0200 | [diff] [blame] | 44 | } |