Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-dove/irq.c |
| 3 | * |
| 4 | * Dove 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 | */ |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 10 | #include <linux/init.h> |
| 11 | #include <linux/irq.h> |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 12 | #include <linux/io.h> |
Arnd Bergmann | b8cd337 | 2015-12-02 22:27:04 +0100 | [diff] [blame] | 13 | #include <asm/exception.h> |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 14 | #include <plat/irq.h> |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 15 | #include <mach/bridge-regs.h> |
Rob Herring | ce91574 | 2012-08-29 10:16:55 -0500 | [diff] [blame] | 16 | #include <plat/orion-gpio.h> |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 17 | #include "common.h" |
| 18 | |
Andrew Lunn | 278b45b | 2012-06-27 13:40:04 +0200 | [diff] [blame] | 19 | static int __initdata gpio0_irqs[4] = { |
| 20 | IRQ_DOVE_GPIO_0_7, |
| 21 | IRQ_DOVE_GPIO_8_15, |
| 22 | IRQ_DOVE_GPIO_16_23, |
| 23 | IRQ_DOVE_GPIO_24_31, |
| 24 | }; |
| 25 | |
| 26 | static int __initdata gpio1_irqs[4] = { |
| 27 | IRQ_DOVE_HIGH_GPIO, |
| 28 | 0, |
| 29 | 0, |
| 30 | 0, |
| 31 | }; |
| 32 | |
| 33 | static int __initdata gpio2_irqs[4] = { |
| 34 | 0, |
| 35 | 0, |
| 36 | 0, |
| 37 | 0, |
| 38 | }; |
| 39 | |
Thomas Petazzoni | deac3d8 | 2014-04-22 23:26:26 +0200 | [diff] [blame] | 40 | static void __iomem *dove_irq_base = IRQ_VIRT_BASE; |
| 41 | |
| 42 | static asmlinkage void |
| 43 | __exception_irq_entry dove_legacy_handle_irq(struct pt_regs *regs) |
| 44 | { |
| 45 | u32 stat; |
| 46 | |
| 47 | stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_LOW_OFF); |
| 48 | stat &= readl_relaxed(dove_irq_base + IRQ_MASK_LOW_OFF); |
| 49 | if (stat) { |
Russell King | 5d6bed2 | 2015-06-22 18:39:43 +0100 | [diff] [blame] | 50 | unsigned int hwirq = 1 + __fls(stat); |
Thomas Petazzoni | deac3d8 | 2014-04-22 23:26:26 +0200 | [diff] [blame] | 51 | handle_IRQ(hwirq, regs); |
| 52 | return; |
| 53 | } |
| 54 | stat = readl_relaxed(dove_irq_base + IRQ_CAUSE_HIGH_OFF); |
| 55 | stat &= readl_relaxed(dove_irq_base + IRQ_MASK_HIGH_OFF); |
| 56 | if (stat) { |
Russell King | 5d6bed2 | 2015-06-22 18:39:43 +0100 | [diff] [blame] | 57 | unsigned int hwirq = 33 + __fls(stat); |
Thomas Petazzoni | deac3d8 | 2014-04-22 23:26:26 +0200 | [diff] [blame] | 58 | handle_IRQ(hwirq, regs); |
| 59 | return; |
| 60 | } |
| 61 | } |
Thomas Petazzoni | deac3d8 | 2014-04-22 23:26:26 +0200 | [diff] [blame] | 62 | |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 63 | void __init dove_init_irq(void) |
| 64 | { |
Russell King | 5d6bed2 | 2015-06-22 18:39:43 +0100 | [diff] [blame] | 65 | orion_irq_init(1, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF); |
| 66 | orion_irq_init(33, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF); |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 67 | |
Thomas Petazzoni | deac3d8 | 2014-04-22 23:26:26 +0200 | [diff] [blame] | 68 | set_handle_irq(dove_legacy_handle_irq); |
Thomas Petazzoni | deac3d8 | 2014-04-22 23:26:26 +0200 | [diff] [blame] | 69 | |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 70 | /* |
Lennert Buytenhek | 9eac6d0 | 2010-12-14 12:54:03 +0100 | [diff] [blame] | 71 | * Initialize gpiolib for GPIOs 0-71. |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 72 | */ |
Thomas Petazzoni | c3c5a28 | 2012-09-11 14:27:18 +0200 | [diff] [blame] | 73 | orion_gpio_init(NULL, 0, 32, DOVE_GPIO_LO_VIRT_BASE, 0, |
Andrew Lunn | 278b45b | 2012-06-27 13:40:04 +0200 | [diff] [blame] | 74 | IRQ_DOVE_GPIO_START, gpio0_irqs); |
Lennert Buytenhek | 9eac6d0 | 2010-12-14 12:54:03 +0100 | [diff] [blame] | 75 | |
Thomas Petazzoni | c3c5a28 | 2012-09-11 14:27:18 +0200 | [diff] [blame] | 76 | orion_gpio_init(NULL, 32, 32, DOVE_GPIO_HI_VIRT_BASE, 0, |
Andrew Lunn | 278b45b | 2012-06-27 13:40:04 +0200 | [diff] [blame] | 77 | IRQ_DOVE_GPIO_START + 32, gpio1_irqs); |
Lennert Buytenhek | 9eac6d0 | 2010-12-14 12:54:03 +0100 | [diff] [blame] | 78 | |
Thomas Petazzoni | c3c5a28 | 2012-09-11 14:27:18 +0200 | [diff] [blame] | 79 | orion_gpio_init(NULL, 64, 8, DOVE_GPIO2_VIRT_BASE, 0, |
Andrew Lunn | 278b45b | 2012-06-27 13:40:04 +0200 | [diff] [blame] | 80 | IRQ_DOVE_GPIO_START + 64, gpio2_irqs); |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 81 | } |