blob: ac4af2283bef9959b23601c666ee4bb6e724d3e0 [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>
Rob Herringce915742012-08-29 10:16:55 -050016#include <plat/orion-gpio.h>
Lennert Buytenhek6f088f12008-08-09 13:44:58 +020017#include <plat/irq.h>
Thomas Petazzoniab5ab9d2014-04-22 23:26:27 +020018#include <asm/exception.h>
Arnd Bergmannc22c2c62015-12-02 22:27:08 +010019#include "bridge-regs.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
Ben Dooksfc05c242016-06-09 10:59:05 +010029static asmlinkage void
Thomas Petazzoniab5ab9d2014-04-22 23:26:27 +020030__exception_irq_entry orion5x_legacy_handle_irq(struct pt_regs *regs)
31{
32 u32 stat;
33
34 stat = readl_relaxed(MAIN_IRQ_CAUSE);
35 stat &= readl_relaxed(MAIN_IRQ_MASK);
36 if (stat) {
Benjamin Cama5be9fc22015-07-14 16:25:58 +020037 unsigned int hwirq = 1 + __fls(stat);
Thomas Petazzoniab5ab9d2014-04-22 23:26:27 +020038 handle_IRQ(hwirq, regs);
39 return;
40 }
41}
Thomas Petazzoniab5ab9d2014-04-22 23:26:27 +020042
Lennert Buytenhek07332312008-10-20 01:51:03 +020043void __init orion5x_init_irq(void)
Tzachi Perelstein3085de62007-10-23 15:14:42 -040044{
Benjamin Cama5be9fc22015-07-14 16:25:58 +020045 orion_irq_init(1, MAIN_IRQ_MASK);
Tzachi Perelstein3085de62007-10-23 15:14:42 -040046
Thomas Petazzoniab5ab9d2014-04-22 23:26:27 +020047 set_handle_irq(orion5x_legacy_handle_irq);
Thomas Petazzoniab5ab9d2014-04-22 23:26:27 +020048
Tzachi Perelstein3085de62007-10-23 15:14:42 -040049 /*
Lennert Buytenhek9eac6d02010-12-14 12:54:03 +010050 * Initialize gpiolib for GPIOs 0-31.
Tzachi Perelstein3085de62007-10-23 15:14:42 -040051 */
Thomas Petazzoni3904a392012-09-11 14:27:21 +020052 orion_gpio_init(NULL, 0, 32, GPIO_VIRT_BASE, 0,
Andrew Lunn278b45b2012-06-27 13:40:04 +020053 IRQ_ORION5X_GPIO_START, gpio0_irqs);
Tzachi Perelstein3085de62007-10-23 15:14:42 -040054}