aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2007-09-09 23:06:03 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-09-20 22:57:52 -0400
commit897cfcd878ccc9c2b0f1b3bb00a2368c43feafc0 (patch)
tree4bfd5d6d6194e88509527990f45cf71a6907bfbe
parent5cbc3af521a85aab8ae72c25afcf2698a7547cbd (diff)
sh: intc - rework higlander irq code for r7780mp and r7785rp
This patch reworks the highlander irq code for r7780mp and r7785rp. The same strategy as for the new R2D code is used here - the board specific interrupts are now starting from HL_FPGA_IRQ_BASE. The code for r7780rp is not touched due to lack of hardware. Tested with CF, AX88796 on r7780mp and r7785rp. The touch switch interrupt has also been tested on r7780mp. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/boards/renesas/r7780rp/Makefile5
-rw-r--r--arch/sh/boards/renesas/r7780rp/irq-r7780mp.c61
-rw-r--r--arch/sh/boards/renesas/r7780rp/irq-r7780rp.c5
-rw-r--r--arch/sh/boards/renesas/r7780rp/irq-r7785rp.c46
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c54
-rw-r--r--include/asm-sh/r7780rp.h33
6 files changed, 166 insertions, 38 deletions
diff --git a/arch/sh/boards/renesas/r7780rp/Makefile b/arch/sh/boards/renesas/r7780rp/Makefile
index b1d20afb4eb3..dd26182fbf58 100644
--- a/arch/sh/boards/renesas/r7780rp/Makefile
+++ b/arch/sh/boards/renesas/r7780rp/Makefile
@@ -1,9 +1,10 @@
1# 1#
2# Makefile for the R7780RP-1 specific parts of the kernel 2# Makefile for the R7780RP-1 specific parts of the kernel
3# 3#
4irqinit-y := irq-r7780rp.o 4irqinit-$(CONFIG_SH_R7780MP) := irq-r7780mp.o
5irqinit-$(CONFIG_SH_R7785RP) := irq-r7785rp.o 5irqinit-$(CONFIG_SH_R7785RP) := irq-r7785rp.o
6obj-y := setup.o irq.o $(irqinit-y) 6irqinit-$(CONFIG_SH_R7780RP) := irq-r7780rp.o irq.o
7obj-y := setup.o $(irqinit-y)
7 8
8ifneq ($(CONFIG_SH_R7785RP),y) 9ifneq ($(CONFIG_SH_R7785RP),y)
9obj-$(CONFIG_PUSH_SWITCH) += psw.o 10obj-$(CONFIG_PUSH_SWITCH) += psw.o
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c b/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c
new file mode 100644
index 000000000000..59b47fe061f9
--- /dev/null
+++ b/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c
@@ -0,0 +1,61 @@
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
17enum {
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
28static 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
36static 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
42static 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
49static DECLARE_INTC_DESC(intc_desc, "r7780mp", vectors,
50 NULL, NULL, mask_registers, NULL, NULL);
51
52unsigned 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}
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c b/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c
index f5f358746c9e..d6b107a2e0b5 100644
--- a/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c
+++ b/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c
@@ -9,13 +9,14 @@
9 * for more details. 9 * for more details.
10 */ 10 */
11#include <linux/init.h> 11#include <linux/init.h>
12#include <asm/io.h>
13#include <asm/r7780rp.h> 12#include <asm/r7780rp.h>
14 13
15void __init highlander_init_irq(void) 14unsigned char * __init highlander_init_irq_r7780rp(void)
16{ 15{
17 int i; 16 int i;
18 17
19 for (i = 0; i < 15; i++) 18 for (i = 0; i < 15; i++)
20 make_r7780rp_irq(i); 19 make_r7780rp_irq(i);
20
21 return NULL;
21} 22}
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c b/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c
index dd6ec4ce44dc..b2c6a84673bd 100644
--- a/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c
+++ b/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c
@@ -1,19 +1,55 @@
1/* 1/*
2 * Renesas Solutions Highlander R7780RP-1 Support. 2 * Renesas Solutions Highlander R7785RP Support.
3 * 3 *
4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd. 4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
5 * Copyright (C) 2006 Paul Mundt 5 * Copyright (C) 2006 Paul Mundt
6 * Copyright (C) 2007 Magnus Damm
6 * 7 *
7 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
9 * for more details. 10 * for more details.
10 */ 11 */
11#include <linux/init.h> 12#include <linux/init.h>
12#include <asm/io.h> 13#include <linux/irq.h>
14#include <linux/io.h>
13#include <asm/r7780rp.h> 15#include <asm/r7780rp.h>
14 16
15void __init highlander_init_irq(void) 17enum {
18 UNUSED = 0,
19
20 /* board specific interrupt sources */
21 AX88796, /* Ethernet controller */
22 CF, /* Compact Flash */
23};
24
25static struct intc_vect vectors[] __initdata = {
26 INTC_IRQ(CF, IRQ_CF),
27 INTC_IRQ(AX88796, IRQ_AX88796),
28};
29
30static struct intc_mask_reg mask_registers[] __initdata = {
31 { 0xa4000010, 0, 16, /* IRLMCR1 */
32 { 0, 0, 0, 0, CF, AX88796, 0, 0,
33 0, 0, 0, 0, 0, 0, 0, 0 } },
34};
35
36static unsigned char irl2irq[HL_NR_IRL] __initdata = {
37 0, IRQ_CF, 0, 0,
38 0, 0, 0, 0,
39 0, 0, IRQ_AX88796, 0,
40 0, 0, 0,
41};
42
43static DECLARE_INTC_DESC(intc_desc, "r7785rp", vectors,
44 NULL, NULL, mask_registers, NULL, NULL);
45
46unsigned char * __init highlander_init_irq_r7785rp(void)
16{ 47{
48 if ((ctrl_inw(0xa4000158) & 0xf000) != 0x1000)
49 return NULL;
50
51 printk(KERN_INFO "Using r7785rp interrupt controller.\n");
52
17 ctrl_outw(0x0000, PA_IRLSSR1); /* FPGA IRLSSR1(CF_CD clear) */ 53 ctrl_outw(0x0000, PA_IRLSSR1); /* FPGA IRLSSR1(CF_CD clear) */
18 54
19 /* Setup the FPGA IRL */ 55 /* Setup the FPGA IRL */
@@ -24,6 +60,6 @@ void __init highlander_init_irq(void)
24 ctrl_outw(0x4321, PA_IRLPRE); /* FPGA IRLE */ 60 ctrl_outw(0x4321, PA_IRLPRE); /* FPGA IRLE */
25 ctrl_outw(0x0000, PA_IRLPRF); /* FPGA IRLF */ 61 ctrl_outw(0x0000, PA_IRLPRF); /* FPGA IRLF */
26 62
27 make_r7780rp_irq(1); /* CF card */ 63 register_intc_controller(&intc_desc);
28 make_r7780rp_irq(10); /* On-board ethernet */ 64 return irl2irq;
29} 65}
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c
index 3ab5fc4b55b7..afe9de73666a 100644
--- a/arch/sh/boards/renesas/r7780rp/setup.c
+++ b/arch/sh/boards/renesas/r7780rp/setup.c
@@ -31,8 +31,8 @@ static struct resource r8a66597_usb_host_resources[] = {
31 }, 31 },
32 [1] = { 32 [1] = {
33 .name = "r8a66597_hcd", 33 .name = "r8a66597_hcd",
34 .start = 11, /* irq number */ 34 .start = IRQ_EXT1, /* irq number */
35 .end = 11, 35 .end = IRQ_EXT1,
36 .flags = IORESOURCE_IRQ, 36 .flags = IORESOURCE_IRQ,
37 }, 37 },
38}; 38};
@@ -57,8 +57,8 @@ static struct resource m66592_usb_peripheral_resources[] = {
57 }, 57 },
58 [1] = { 58 [1] = {
59 .name = "m66592_udc", 59 .name = "m66592_udc",
60 .start = 9, /* irq number */ 60 .start = IRQ_EXT4, /* irq number */
61 .end = 9, 61 .end = IRQ_EXT4,
62 .flags = IORESOURCE_IRQ, 62 .flags = IORESOURCE_IRQ,
63 }, 63 },
64}; 64};
@@ -86,11 +86,7 @@ static struct resource cf_ide_resources[] = {
86 .flags = IORESOURCE_MEM, 86 .flags = IORESOURCE_MEM,
87 }, 87 },
88 [2] = { 88 [2] = {
89#ifdef CONFIG_SH_R7780RP 89 .start = IRQ_CF,
90 .start = 4,
91#else
92 .start = 1,
93#endif
94 .flags = IORESOURCE_IRQ, 90 .flags = IORESOURCE_IRQ,
95 }, 91 },
96}; 92};
@@ -225,12 +221,50 @@ static void __init highlander_setup(char **cmdline_p)
225 pm_power_off = r7780rp_power_off; 221 pm_power_off = r7780rp_power_off;
226} 222}
227 223
224static unsigned char irl2irq[HL_NR_IRL];
225
226int highlander_irq_demux(int irq)
227{
228 if (irq >= HL_NR_IRL || !irl2irq[irq])
229 return irq;
230
231 return irl2irq[irq];
232}
233
234void __init highlander_init_irq(void)
235{
236 unsigned char *ucp = NULL;
237
238 do {
239#ifdef CONFIG_SH_R7780MP
240 ucp = highlander_init_irq_r7780mp();
241 if (ucp)
242 break;
243#endif
244#ifdef CONFIG_SH_R7785RP
245 ucp = highlander_init_irq_r7785rp();
246 if (ucp)
247 break;
248#endif
249#ifdef CONFIG_SH_R7780RP
250 highlander_init_irq_r7780rp();
251 ucp = irl2irq;
252 break;
253#endif
254 } while (0);
255
256 if (ucp) {
257 plat_irq_setup_pins(IRQ_MODE_IRL3210);
258 memcpy(irl2irq, ucp, HL_NR_IRL);
259 }
260}
261
228/* 262/*
229 * The Machine Vector 263 * The Machine Vector
230 */ 264 */
231static struct sh_machine_vector mv_highlander __initmv = { 265static struct sh_machine_vector mv_highlander __initmv = {
232 .mv_name = "Highlander", 266 .mv_name = "Highlander",
233 .mv_nr_irqs = 109,
234 .mv_setup = highlander_setup, 267 .mv_setup = highlander_setup,
235 .mv_init_irq = highlander_init_irq, 268 .mv_init_irq = highlander_init_irq,
269 .mv_irq_demux = highlander_irq_demux,
236}; 270};
diff --git a/include/asm-sh/r7780rp.h b/include/asm-sh/r7780rp.h
index 4083b5949928..de37f933aa42 100644
--- a/include/asm-sh/r7780rp.h
+++ b/include/asm-sh/r7780rp.h
@@ -65,24 +65,6 @@
65#define PA_PMR (PA_BCR+0x0900) /* */ 65#define PA_PMR (PA_BCR+0x0900) /* */
66 66
67#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */ 67#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */
68
69#define IRQ_PCISLOT1 65 /* PCI Slot #1 IRQ */
70#define IRQ_PCISLOT2 66 /* PCI Slot #2 IRQ */
71#define IRQ_PCISLOT3 67 /* PCI Slot #3 IRQ */
72#define IRQ_PCISLOT4 68 /* PCI Slot #4 IRQ */
73#define IRQ_TP 2 /* Touch Panel IRQ */
74#define IRQ_SCI1 3 /* SCI1 IRQ */
75#define IRQ_SCI0 4 /* SCI0 IRQ */
76#define IRQ_2SERIAL 5 /* Serial IRQ */
77#define IRQ_RTC 6 /* RTC A / B IRQ */
78#define IRQ_EXTENTION6 7 /* EXT6n IRQ */
79#define IRQ_EXTENTION5 8 /* EXT5n IRQ */
80#define IRQ_EXTENTION4 9 /* EXT4n IRQ */
81#define IRQ_EXTENTION2 10 /* EXT2n IRQ */
82#define IRQ_EXTENTION1 11 /* EXT1n IRQ */
83#define IRQ_ONETH 13 /* On board Ethernet IRQ */
84#define IRQ_PSW 14 /* Push Switch IRQ */
85
86#define IVDR_CK_ON 8 /* iVDR Clock ON */ 68#define IVDR_CK_ON 8 /* iVDR Clock ON */
87 69
88#elif defined(CONFIG_SH_R7780RP) 70#elif defined(CONFIG_SH_R7780RP)
@@ -203,11 +185,24 @@
203#define PA_MMSR (PA_BCR+0x0400) 185#define PA_MMSR (PA_BCR+0x0400)
204 186
205#define IVDR_CK_ON 4 /* iVDR Clock ON */ 187#define IVDR_CK_ON 4 /* iVDR Clock ON */
188#endif
206 189
190#define HL_FPGA_IRQ_BASE 200
191#define HL_NR_IRL 15
192
193#define IRQ_AX88796 (HL_FPGA_IRQ_BASE + 0)
194#define IRQ_CF (HL_FPGA_IRQ_BASE + 1)
195#ifndef IRQ_PSW
196#define IRQ_PSW (HL_FPGA_IRQ_BASE + 2)
207#endif 197#endif
198#define IRQ_EXT1 (HL_FPGA_IRQ_BASE + 3)
199#define IRQ_EXT4 (HL_FPGA_IRQ_BASE + 4)
208 200
209void make_r7780rp_irq(unsigned int irq); 201void make_r7780rp_irq(unsigned int irq);
210void highlander_init_irq(void); 202
203unsigned char *highlander_init_irq_r7780mp(void);
204unsigned char *highlander_init_irq_r7780rp(void);
205unsigned char *highlander_init_irq_r7785rp(void);
211 206
212#define __IO_PREFIX r7780rp 207#define __IO_PREFIX r7780rp
213#include <asm/io_generic.h> 208#include <asm/io_generic.h>