Merge git://git.infradead.org/~dedekind/ubi-2.6
[sfrench/cifs-2.6.git] / arch / sh / boards / renesas / r7780rp / irq-r7780mp.c
1 /*
2  * Renesas Solutions Highlander R7780MP Support.
3  *
4  * Copyright (C) 2002  Atom Create Engineering Co., Ltd.
5  * Copyright (C) 2006  Paul Mundt
6  * Copyright (C) 2007  Magnus Damm
7  *
8  * This file is subject to the terms and conditions of the GNU General Public
9  * License.  See the file "COPYING" in the main directory of this archive
10  * for more details.
11  */
12 #include <linux/init.h>
13 #include <linux/irq.h>
14 #include <linux/io.h>
15 #include <asm/r7780rp.h>
16
17 enum {
18         UNUSED = 0,
19
20         /* board specific interrupt sources */
21         AX88796,          /* Ethernet controller */
22         CF,               /* Compact Flash */
23         PSW,              /* Push Switch */
24         EXT1,             /* EXT1n IRQ */
25         EXT4,             /* EXT4n IRQ */
26 };
27
28 static struct intc_vect vectors[] __initdata = {
29         INTC_IRQ(CF, IRQ_CF),
30         INTC_IRQ(PSW, IRQ_PSW),
31         INTC_IRQ(AX88796, IRQ_AX88796),
32         INTC_IRQ(EXT1, IRQ_EXT1),
33         INTC_IRQ(EXT4, IRQ_EXT4),
34 };
35
36 static struct intc_mask_reg mask_registers[] __initdata = {
37         { 0xa4000000, 0, 16, /* IRLMSK */
38           { 0, 0, 0, 0, CF, 0, 0, 0,
39             0, 0, 0, EXT4, 0, EXT1, PSW, AX88796 } },
40 };
41
42 static unsigned char irl2irq[HL_NR_IRL] __initdata = {
43         0, IRQ_CF, 0, 0,
44         0, 0, 0, 0,
45         0, IRQ_EXT4, 0, IRQ_EXT1,
46         0, IRQ_AX88796, IRQ_PSW,
47 };
48
49 static DECLARE_INTC_DESC(intc_desc, "r7780mp", vectors,
50                          NULL, mask_registers, NULL, NULL);
51
52 unsigned char * __init highlander_init_irq_r7780mp(void)
53 {
54         if ((ctrl_inw(0xa4000700) & 0xf000) == 0x2000) {
55                 printk(KERN_INFO "Using r7780mp interrupt controller.\n");
56                 register_intc_controller(&intc_desc);
57                 return irl2irq;
58         }
59
60         return NULL;
61 }