1
2
3
4
5
6
7
8
9
10
11
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/io.h>
15#include <mach/highlander.h>
16
17enum {
18 UNUSED = 0,
19
20
21 CF,
22 SMBUS,
23 TP,
24 RTC,
25 TH_ALERT,
26 AX88796,
27
28
29 EXT0, EXT1, EXT2, EXT3, EXT4, EXT5, EXT6, EXT7,
30};
31
32static struct intc_vect vectors[] __initdata = {
33 INTC_IRQ(CF, IRQ_CF),
34 INTC_IRQ(SMBUS, IRQ_SMBUS),
35 INTC_IRQ(TP, IRQ_TP),
36 INTC_IRQ(RTC, IRQ_RTC),
37 INTC_IRQ(TH_ALERT, IRQ_TH_ALERT),
38
39 INTC_IRQ(EXT0, IRQ_EXT0), INTC_IRQ(EXT1, IRQ_EXT1),
40 INTC_IRQ(EXT2, IRQ_EXT2), INTC_IRQ(EXT3, IRQ_EXT3),
41
42 INTC_IRQ(EXT4, IRQ_EXT4), INTC_IRQ(EXT5, IRQ_EXT5),
43 INTC_IRQ(EXT6, IRQ_EXT6), INTC_IRQ(EXT7, IRQ_EXT7),
44
45 INTC_IRQ(AX88796, IRQ_AX88796),
46};
47
48static struct intc_mask_reg mask_registers[] __initdata = {
49 { 0xa4000010, 0, 16,
50 { 0, 0, 0, 0, CF, AX88796, SMBUS, TP,
51 RTC, 0, TH_ALERT, 0, 0, 0, 0, 0 } },
52 { 0xa4000012, 0, 16,
53 { 0, 0, 0, 0, 0, 0, 0, 0,
54 EXT7, EXT6, EXT5, EXT4, EXT3, EXT2, EXT1, EXT0 } },
55};
56
57static unsigned char irl2irq[HL_NR_IRL] __initdata = {
58 0, IRQ_CF, IRQ_EXT4, IRQ_EXT5,
59 IRQ_EXT6, IRQ_EXT7, IRQ_SMBUS, IRQ_TP,
60 IRQ_RTC, IRQ_TH_ALERT, IRQ_AX88796, IRQ_EXT0,
61 IRQ_EXT1, IRQ_EXT2, IRQ_EXT3,
62};
63
64static DECLARE_INTC_DESC(intc_desc, "r7785rp", vectors,
65 NULL, mask_registers, NULL, NULL);
66
67unsigned char * __init highlander_plat_irq_setup(void)
68{
69 if ((__raw_readw(0xa4000158) & 0xf000) != 0x1000)
70 return NULL;
71
72 printk(KERN_INFO "Using r7785rp interrupt controller.\n");
73
74 __raw_writew(0x0000, PA_IRLSSR1);
75
76
77 __raw_writew(0x0000, PA_IRLPRA);
78 __raw_writew(0xe598, PA_IRLPRB);
79 __raw_writew(0x7060, PA_IRLPRC);
80 __raw_writew(0x0000, PA_IRLPRD);
81 __raw_writew(0x4321, PA_IRLPRE);
82 __raw_writew(0xdcba, PA_IRLPRF);
83
84 register_intc_controller(&intc_desc);
85 return irl2irq;
86}
87