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