xref: /linux/arch/sh/boards/mach-highlander/irq-r7780mp.c (revision 597473720f4dc69749542bfcfed4a927a43d935e)
1*aaf9128aSKuninori Morimoto // SPDX-License-Identifier: GPL-2.0
2da2014a2SPaul Mundt /*
3da2014a2SPaul Mundt  * Renesas Solutions Highlander R7780MP Support.
4da2014a2SPaul Mundt  *
5da2014a2SPaul Mundt  * Copyright (C) 2002  Atom Create Engineering Co., Ltd.
6da2014a2SPaul Mundt  * Copyright (C) 2006  Paul Mundt
7da2014a2SPaul Mundt  * Copyright (C) 2007  Magnus Damm
8da2014a2SPaul Mundt  */
9da2014a2SPaul Mundt #include <linux/init.h>
10da2014a2SPaul Mundt #include <linux/irq.h>
11da2014a2SPaul Mundt #include <linux/io.h>
127639a454SPaul Mundt #include <mach/highlander.h>
13da2014a2SPaul Mundt 
14da2014a2SPaul Mundt enum {
15da2014a2SPaul Mundt 	UNUSED = 0,
16da2014a2SPaul Mundt 
17da2014a2SPaul Mundt 	/* board specific interrupt sources */
18da2014a2SPaul Mundt 	CF,		/* Compact Flash */
19da2014a2SPaul Mundt 	TP,		/* Touch panel */
20da2014a2SPaul Mundt 	SCIF1,		/* FPGA SCIF1 */
21da2014a2SPaul Mundt 	SCIF0,		/* FPGA SCIF0 */
22da2014a2SPaul Mundt 	SMBUS,		/* SMBUS */
23da2014a2SPaul Mundt 	RTC,		/* RTC Alarm */
24da2014a2SPaul Mundt 	AX88796,	/* Ethernet controller */
25da2014a2SPaul Mundt 	PSW,		/* Push Switch */
26da2014a2SPaul Mundt 
27da2014a2SPaul Mundt 	/* external bus connector */
28da2014a2SPaul Mundt 	EXT1, EXT2, EXT4, EXT5, EXT6,
29da2014a2SPaul Mundt };
30da2014a2SPaul Mundt 
31da2014a2SPaul Mundt static struct intc_vect vectors[] __initdata = {
32da2014a2SPaul Mundt 	INTC_IRQ(CF, IRQ_CF),
33da2014a2SPaul Mundt 	INTC_IRQ(TP, IRQ_TP),
34da2014a2SPaul Mundt 	INTC_IRQ(SCIF1, IRQ_SCIF1),
35da2014a2SPaul Mundt 	INTC_IRQ(SCIF0, IRQ_SCIF0),
36da2014a2SPaul Mundt 	INTC_IRQ(SMBUS, IRQ_SMBUS),
37da2014a2SPaul Mundt 	INTC_IRQ(RTC, IRQ_RTC),
38da2014a2SPaul Mundt 	INTC_IRQ(AX88796, IRQ_AX88796),
39da2014a2SPaul Mundt 	INTC_IRQ(PSW, IRQ_PSW),
40da2014a2SPaul Mundt 
41da2014a2SPaul Mundt 	INTC_IRQ(EXT1, IRQ_EXT1), INTC_IRQ(EXT2, IRQ_EXT2),
42da2014a2SPaul Mundt 	INTC_IRQ(EXT4, IRQ_EXT4), INTC_IRQ(EXT5, IRQ_EXT5),
43da2014a2SPaul Mundt 	INTC_IRQ(EXT6, IRQ_EXT6),
44da2014a2SPaul Mundt };
45da2014a2SPaul Mundt 
46da2014a2SPaul Mundt static struct intc_mask_reg mask_registers[] __initdata = {
47da2014a2SPaul Mundt 	{ 0xa4000000, 0, 16, /* IRLMSK */
48da2014a2SPaul Mundt 	  { SCIF0, SCIF1, RTC, 0, CF, 0, TP, SMBUS,
49da2014a2SPaul Mundt 	    0, EXT6, EXT5, EXT4, EXT2, EXT1, PSW, AX88796 } },
50da2014a2SPaul Mundt };
51da2014a2SPaul Mundt 
52da2014a2SPaul Mundt static unsigned char irl2irq[HL_NR_IRL] __initdata = {
53da2014a2SPaul Mundt 	0, IRQ_CF, IRQ_TP, IRQ_SCIF1,
54da2014a2SPaul Mundt 	IRQ_SCIF0, IRQ_SMBUS, IRQ_RTC, IRQ_EXT6,
55da2014a2SPaul Mundt 	IRQ_EXT5, IRQ_EXT4, IRQ_EXT2, IRQ_EXT1,
56da2014a2SPaul Mundt 	0, IRQ_AX88796, IRQ_PSW,
57da2014a2SPaul Mundt };
58da2014a2SPaul Mundt 
59da2014a2SPaul Mundt static DECLARE_INTC_DESC(intc_desc, "r7780mp", vectors,
60da2014a2SPaul Mundt 			 NULL, mask_registers, NULL, NULL);
61da2014a2SPaul Mundt 
highlander_plat_irq_setup(void)62da2014a2SPaul Mundt unsigned char * __init highlander_plat_irq_setup(void)
63da2014a2SPaul Mundt {
649d56dd3bSPaul Mundt 	if ((__raw_readw(0xa4000700) & 0xf000) == 0x2000) {
65da2014a2SPaul Mundt 		printk(KERN_INFO "Using r7780mp interrupt controller.\n");
66da2014a2SPaul Mundt 		register_intc_controller(&intc_desc);
67da2014a2SPaul Mundt 		return irl2irq;
68da2014a2SPaul Mundt 	}
69da2014a2SPaul Mundt 
70da2014a2SPaul Mundt 	return NULL;
71da2014a2SPaul Mundt }
72