xref: /openbmc/linux/arch/sh/kernel/cpu/sh4a/intc-shx3.c (revision 0bf49ffb)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Shared support for SH-X3 interrupt controllers.
4  *
5  *  Copyright (C) 2009 - 2010  Paul Mundt
6  */
7 #include <linux/irq.h>
8 #include <linux/io.h>
9 #include <linux/init.h>
10 
11 #define INTACK		0xfe4100b8
12 #define INTACKCLR	0xfe4100bc
13 #define INTC_USERIMASK	0xfe411000
14 
15 #ifdef CONFIG_INTC_BALANCING
16 unsigned int irq_lookup(unsigned int irq)
17 {
18 	return __raw_readl(INTACK) & 1 ? irq : NO_IRQ_IGNORE;
19 }
20 
21 void irq_finish(unsigned int irq)
22 {
23 	__raw_writel(irq2evt(irq), INTACKCLR);
24 }
25 #endif
26 
27 static int __init shx3_irq_setup(void)
28 {
29 	return register_intc_userimask(INTC_USERIMASK);
30 }
31 arch_initcall(shx3_irq_setup);
32