xref: /openbmc/linux/arch/sh/kernel/cpu/sh4a/intc-shx3.c (revision e15f6870)
1e15f6870SPaul Mundt /*
2e15f6870SPaul Mundt  * Shared support for SH-X3 interrupt controllers.
3e15f6870SPaul Mundt  *
4e15f6870SPaul Mundt  *  Copyright (C) 2009 - 2010  Paul Mundt
5e15f6870SPaul Mundt  *
6e15f6870SPaul Mundt  * This file is subject to the terms and conditions of the GNU General Public
7e15f6870SPaul Mundt  * License.  See the file "COPYING" in the main directory of this archive
8e15f6870SPaul Mundt  * for more details.
9e15f6870SPaul Mundt  */
10e15f6870SPaul Mundt #include <linux/irq.h>
11e15f6870SPaul Mundt #include <linux/io.h>
12e15f6870SPaul Mundt #include <linux/init.h>
13e15f6870SPaul Mundt 
14e15f6870SPaul Mundt #define INTACK		0xfe4100b8
15e15f6870SPaul Mundt #define INTACKCLR	0xfe4100bc
16e15f6870SPaul Mundt #define INTC_USERIMASK	0xfe411000
17e15f6870SPaul Mundt 
18e15f6870SPaul Mundt #ifdef CONFIG_INTC_BALANCING
19e15f6870SPaul Mundt unsigned int irq_lookup(unsigned int irq)
20e15f6870SPaul Mundt {
21e15f6870SPaul Mundt 	return __raw_readl(INTACK) & 1 ? irq : NO_IRQ_IGNORE;
22e15f6870SPaul Mundt }
23e15f6870SPaul Mundt 
24e15f6870SPaul Mundt void irq_finish(unsigned int irq)
25e15f6870SPaul Mundt {
26e15f6870SPaul Mundt 	__raw_writel(irq2evt(irq), INTACKCLR);
27e15f6870SPaul Mundt }
28e15f6870SPaul Mundt #endif
29e15f6870SPaul Mundt 
30e15f6870SPaul Mundt static int __init shx3_irq_setup(void)
31e15f6870SPaul Mundt {
32e15f6870SPaul Mundt 	return register_intc_userimask(INTC_USERIMASK);
33e15f6870SPaul Mundt }
34e15f6870SPaul Mundt arch_initcall(shx3_irq_setup);
35