xref: /openbmc/linux/arch/arm/mach-orion5x/irq.c (revision 2f8163ba)
19dd0b194SLennert Buytenhek /*
29dd0b194SLennert Buytenhek  * arch/arm/mach-orion5x/irq.c
39dd0b194SLennert Buytenhek  *
49dd0b194SLennert Buytenhek  * Core IRQ functions for Marvell Orion System On Chip
59dd0b194SLennert Buytenhek  *
69dd0b194SLennert Buytenhek  * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
79dd0b194SLennert Buytenhek  *
89dd0b194SLennert Buytenhek  * This file is licensed under the terms of the GNU General Public
99dd0b194SLennert Buytenhek  * License version 2.  This program is licensed "as is" without any
109dd0b194SLennert Buytenhek  * warranty of any kind, whether express or implied.
119dd0b194SLennert Buytenhek  */
122f8163baSRussell King #include <linux/gpio.h>
139dd0b194SLennert Buytenhek #include <linux/kernel.h>
149dd0b194SLennert Buytenhek #include <linux/init.h>
159dd0b194SLennert Buytenhek #include <linux/irq.h>
16fced80c7SRussell King #include <linux/io.h>
17fdd8b079SNicolas Pitre #include <mach/bridge-regs.h>
186f088f1dSLennert Buytenhek #include <plat/irq.h>
199dd0b194SLennert Buytenhek #include "common.h"
209dd0b194SLennert Buytenhek 
2107332318SLennert Buytenhek static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
229dd0b194SLennert Buytenhek {
239dd0b194SLennert Buytenhek 	BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31);
249dd0b194SLennert Buytenhek 
2507332318SLennert Buytenhek 	orion_gpio_irq_handler((irq - IRQ_ORION5X_GPIO_0_7) << 3);
269dd0b194SLennert Buytenhek }
279dd0b194SLennert Buytenhek 
2807332318SLennert Buytenhek void __init orion5x_init_irq(void)
299dd0b194SLennert Buytenhek {
3007332318SLennert Buytenhek 	orion_irq_init(0, (void __iomem *)MAIN_IRQ_MASK);
319dd0b194SLennert Buytenhek 
329dd0b194SLennert Buytenhek 	/*
339eac6d0aSLennert Buytenhek 	 * Initialize gpiolib for GPIOs 0-31.
349dd0b194SLennert Buytenhek 	 */
359eac6d0aSLennert Buytenhek 	orion_gpio_init(0, 32, GPIO_VIRT_BASE, 0, IRQ_ORION5X_GPIO_START);
366845664aSThomas Gleixner 	irq_set_chained_handler(IRQ_ORION5X_GPIO_0_7, gpio_irq_handler);
376845664aSThomas Gleixner 	irq_set_chained_handler(IRQ_ORION5X_GPIO_8_15, gpio_irq_handler);
386845664aSThomas Gleixner 	irq_set_chained_handler(IRQ_ORION5X_GPIO_16_23, gpio_irq_handler);
396845664aSThomas Gleixner 	irq_set_chained_handler(IRQ_ORION5X_GPIO_24_31, gpio_irq_handler);
409dd0b194SLennert Buytenhek }
41