aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2007-07-25 04:50:01 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-09-20 22:57:46 -0400
commitec58f1f32de0b6f9e83aada94c857a8fa9b00070 (patch)
tree612397e5bc717d630b177aa799d8e4e2f30cb824 /arch
parent28b146c84ed571043f473d2ac2f2a27e48fda7d1 (diff)
sh: intc - add support for SH7706, SH7707, SH7708, SH7709
This patch unifies the cpu specific interrupt setup code for sh7706, sh7707, sh7708 and sh7709 and moves the code into a new file called setup-sh770x.c. It makes sense to share the setup code between these processors because most hardware blocks are identical from a software point of view. With this patch the sh770x processors now have a complete set of vectors that match with the information provided by the data sheets. This is a big improvement for sh7708. Vectors for IRQ4 and IRQ5 are enabled by default. Use plat_irq_setup_pins() if pins IRQ0-3 should be used in IRQ mode. This patch also unifies the platform device setup code which means that the rtc driver now has platform data for all sh770x processors. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/sh/kernel/cpu/sh3/Makefile8
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7708.c43
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7709.c145
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh770x.c212
-rw-r--r--arch/sh/mm/Kconfig6
5 files changed, 220 insertions, 194 deletions
diff --git a/arch/sh/kernel/cpu/sh3/Makefile b/arch/sh/kernel/cpu/sh3/Makefile
index 55b750763f6..cd2a35270e3 100644
--- a/arch/sh/kernel/cpu/sh3/Makefile
+++ b/arch/sh/kernel/cpu/sh3/Makefile
@@ -6,10 +6,10 @@ obj-y := ex.o probe.o entry.o
6 6
7# CPU subtype setup 7# CPU subtype setup
8obj-$(CONFIG_CPU_SUBTYPE_SH7705) += setup-sh7705.o 8obj-$(CONFIG_CPU_SUBTYPE_SH7705) += setup-sh7705.o
9obj-$(CONFIG_CPU_SUBTYPE_SH7706) += setup-sh7709.o 9obj-$(CONFIG_CPU_SUBTYPE_SH7706) += setup-sh770x.o
10obj-$(CONFIG_CPU_SUBTYPE_SH7707) += setup-sh7709.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7707) += setup-sh770x.o
11obj-$(CONFIG_CPU_SUBTYPE_SH7708) += setup-sh7708.o 11obj-$(CONFIG_CPU_SUBTYPE_SH7708) += setup-sh770x.o
12obj-$(CONFIG_CPU_SUBTYPE_SH7709) += setup-sh7709.o 12obj-$(CONFIG_CPU_SUBTYPE_SH7709) += setup-sh770x.o
13obj-$(CONFIG_CPU_SUBTYPE_SH7710) += setup-sh7710.o 13obj-$(CONFIG_CPU_SUBTYPE_SH7710) += setup-sh7710.o
14obj-$(CONFIG_CPU_SUBTYPE_SH7712) += setup-sh7710.o 14obj-$(CONFIG_CPU_SUBTYPE_SH7712) += setup-sh7710.o
15 15
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7708.c b/arch/sh/kernel/cpu/sh3/setup-sh7708.c
deleted file mode 100644
index f933723911c..00000000000
--- a/arch/sh/kernel/cpu/sh3/setup-sh7708.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * SH7708 Setup
3 *
4 * Copyright (C) 2006 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/platform_device.h>
11#include <linux/init.h>
12#include <linux/serial.h>
13#include <asm/sci.h>
14
15static struct plat_sci_port sci_platform_data[] = {
16 {
17 .mapbase = 0xfffffe80,
18 .flags = UPF_BOOT_AUTOCONF,
19 .type = PORT_SCI,
20 .irqs = { 23, 24, 25, 0 },
21 }, {
22 .flags = 0,
23 }
24};
25
26static struct platform_device sci_device = {
27 .name = "sh-sci",
28 .id = -1,
29 .dev = {
30 .platform_data = sci_platform_data,
31 },
32};
33
34static struct platform_device *sh7708_devices[] __initdata = {
35 &sci_device,
36};
37
38static int __init sh7708_devices_setup(void)
39{
40 return platform_add_devices(sh7708_devices,
41 ARRAY_SIZE(sh7708_devices));
42}
43__initcall(sh7708_devices_setup);
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7709.c b/arch/sh/kernel/cpu/sh3/setup-sh7709.c
deleted file mode 100644
index 086f8e2545a..00000000000
--- a/arch/sh/kernel/cpu/sh3/setup-sh7709.c
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2 * SH7707/SH7709 Setup
3 *
4 * Copyright (C) 2006 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/platform_device.h>
11#include <linux/init.h>
12#include <linux/serial.h>
13#include <asm/sci.h>
14
15static struct resource rtc_resources[] = {
16 [0] = {
17 .start = 0xfffffec0,
18 .end = 0xfffffec0 + 0x1e,
19 .flags = IORESOURCE_IO,
20 },
21 [1] = {
22 .start = 20,
23 .flags = IORESOURCE_IRQ,
24 },
25 [2] = {
26 .start = 21,
27 .flags = IORESOURCE_IRQ,
28 },
29 [3] = {
30 .start = 22,
31 .flags = IORESOURCE_IRQ,
32 },
33};
34
35static struct plat_sci_port sci_platform_data[] = {
36 {
37 .mapbase = 0xfffffe80,
38 .flags = UPF_BOOT_AUTOCONF,
39 .type = PORT_SCI,
40 .irqs = { 23, 24, 25, 0 },
41 }, {
42 .mapbase = 0xa4000150,
43 .flags = UPF_BOOT_AUTOCONF,
44 .type = PORT_SCIF,
45 .irqs = { 56, 57, 59, 58 },
46 }, {
47 .mapbase = 0xa4000140,
48 .flags = UPF_BOOT_AUTOCONF,
49 .type = PORT_IRDA,
50 .irqs = { 52, 53, 55, 54 },
51 }, {
52 .flags = 0,
53 }
54};
55
56static struct platform_device sci_device = {
57 .name = "sh-sci",
58 .id = -1,
59 .dev = {
60 .platform_data = sci_platform_data,
61 },
62};
63
64static struct platform_device rtc_device = {
65 .name = "sh-rtc",
66 .id = -1,
67 .num_resources = ARRAY_SIZE(rtc_resources),
68 .resource = rtc_resources,
69};
70
71static struct platform_device *sh7709_devices[] __initdata = {
72 &sci_device,
73 &rtc_device,
74};
75
76static int __init sh7709_devices_setup(void)
77{
78 return platform_add_devices(sh7709_devices,
79 ARRAY_SIZE(sh7709_devices));
80}
81__initcall(sh7709_devices_setup);
82
83static struct ipr_data ipr_irq_table[] = {
84 { 16, 0, 12, 2 }, /* TMU TUNI0 */
85 { 17, 0, 8, 4 }, /* TMU TUNI1 */
86 { 18, 0, 4, 1 }, /* TMU TUNI1 */
87 { 19, 0, 4, 1 }, /* TMU TUNI1 */
88 { 20, 0, 0, 2 }, /* RTC CUI */
89 { 21, 0, 0, 2 }, /* RTC CUI */
90 { 22, 0, 0, 2 }, /* RTC CUI */
91
92 { 23, 1, 4, 3 }, /* SCI */
93 { 24, 1, 4, 3 }, /* SCI */
94 { 25, 1, 4, 3 }, /* SCI */
95 { 26, 1, 4, 3 }, /* SCI */
96 { 27, 1, 12, 3 }, /* WDT ITI */
97
98 { 32, 2, 0, 1 }, /* IRQ 0 */
99 { 33, 2, 4, 1 }, /* IRQ 1 */
100 { 34, 2, 8, 1 }, /* IRQ 2 APM */
101 { 35, 2, 12, 1 }, /* IRQ 3 TOUCHSCREEN */
102
103 { 36, 3, 0, 1 }, /* IRQ 4 */
104 { 37, 3, 4, 1 }, /* IRQ 5 */
105
106 { 48, 4, 12, 7 }, /* DMA */
107 { 49, 4, 12, 7 }, /* DMA */
108 { 50, 4, 12, 7 }, /* DMA */
109 { 51, 4, 12, 7 }, /* DMA */
110
111 { 52, 4, 8, 3 }, /* IRDA */
112 { 53, 4, 8, 3 }, /* IRDA */
113 { 54, 4, 8, 3 }, /* IRDA */
114 { 55, 4, 8, 3 }, /* IRDA */
115
116 { 56, 4, 4, 3 }, /* SCIF */
117 { 57, 4, 4, 3 }, /* SCIF */
118 { 58, 4, 4, 3 }, /* SCIF */
119 { 59, 4, 4, 3 }, /* SCIF */
120};
121
122static unsigned long ipr_offsets[] = {
123 0xfffffee2, /* 0: IPRA */
124 0xfffffee4, /* 1: IPRB */
125 0xa4000016, /* 2: IPRC */
126 0xa4000018, /* 3: IPRD */
127 0xa400001a, /* 4: IPRE */
128};
129
130static struct ipr_desc ipr_irq_desc = {
131 .ipr_offsets = ipr_offsets,
132 .nr_offsets = ARRAY_SIZE(ipr_offsets),
133
134 .ipr_data = ipr_irq_table,
135 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
136
137 .chip = {
138 .name = "IPR-sh7709",
139 },
140};
141
142void __init plat_irq_setup(void)
143{
144 register_ipr_controller(&ipr_irq_desc);
145}
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
new file mode 100644
index 00000000000..68fc037a6b5
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
@@ -0,0 +1,212 @@
1/*
2 * SH3 Setup code for SH7706, SH7707, SH7708, SH7709
3 *
4 * Copyright (C) 2007 Magnus Damm
5 *
6 * Based on setup-sh7709.c
7 *
8 * Copyright (C) 2006 Paul Mundt
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14#include <linux/init.h>
15#include <linux/io.h>
16#include <linux/irq.h>
17#include <linux/platform_device.h>
18#include <linux/serial.h>
19#include <asm/sci.h>
20
21enum {
22 UNUSED = 0,
23
24 /* interrupt sources */
25 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5,
26 PINT07, PINT815,
27 DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3,
28 SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI,
29 SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI,
30 SCI_ERI, SCI_RXI, SCI_TXI, SCI_TEI,
31 ADC_ADI,
32 TMU0, TMU1, TMU2_TUNI, TMU2_TICPI,
33 RTC_ATI, RTC_PRI, RTC_CUI,
34 WDT,
35 REF_RCMI, REF_ROVI,
36
37 /* interrupt groups */
38 RTC, REF, TMU2, DMAC, SCI, SCIF2, SCIF0,
39};
40
41static struct intc_vect vectors[] = {
42 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
43 INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460),
44 INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0),
45 INTC_VECT(RTC_CUI, 0x4c0),
46 INTC_VECT(SCI_ERI, 0x4e0), INTC_VECT(SCI_RXI, 0x500),
47 INTC_VECT(SCI_TXI, 0x520), INTC_VECT(SCI_TEI, 0x540),
48 INTC_VECT(WDT, 0x560),
49 INTC_VECT(REF_RCMI, 0x580),
50 INTC_VECT(REF_ROVI, 0x5a0),
51#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
52 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
53 defined(CONFIG_CPU_SUBTYPE_SH7709)
54 INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
55 INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820),
56 INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860),
57 INTC_VECT(ADC_ADI, 0x980),
58 INTC_VECT(SCIF2_ERI, 0x900), INTC_VECT(SCIF2_RXI, 0x920),
59 INTC_VECT(SCIF2_BRI, 0x940), INTC_VECT(SCIF2_TXI, 0x960),
60#endif
61#if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
62 defined(CONFIG_CPU_SUBTYPE_SH7709)
63 INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720),
64 INTC_VECT(SCIF0_ERI, 0x880), INTC_VECT(SCIF0_RXI, 0x8a0),
65 INTC_VECT(SCIF0_BRI, 0x8c0), INTC_VECT(SCIF0_TXI, 0x8e0),
66#endif
67};
68
69static struct intc_group groups[] = {
70 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
71 INTC_GROUP(TMU2, TMU2_TUNI, TMU2_TICPI),
72 INTC_GROUP(REF, REF_RCMI, REF_ROVI),
73 INTC_GROUP(DMAC, DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3),
74 INTC_GROUP(SCI, SCI_ERI, SCI_RXI, SCI_TXI, SCI_TEI),
75 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI),
76 INTC_GROUP(SCIF2, SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI),
77};
78
79static struct intc_prio priorities[] = {
80 INTC_PRIO(DMAC, 7),
81 INTC_PRIO(SCI, 3),
82 INTC_PRIO(SCIF2, 3),
83 INTC_PRIO(SCIF0, 3),
84};
85
86static struct intc_prio_reg prio_registers[] = {
87 { 0xfffffee2, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
88 { 0xfffffee4, 16, 4, /* IPRB */ { WDT, REF, SCI, 0 } },
89#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
90 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
91 defined(CONFIG_CPU_SUBTYPE_SH7709)
92 { 0xa4000016, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
93 { 0xa4000018, 16, 4, /* IPRD */ { 0, 0, IRQ4, IRQ5 } },
94 { 0xa400001a, 16, 4, /* IPRE */ { DMAC, 0, SCIF2, ADC_ADI } },
95#endif
96#if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
97 defined(CONFIG_CPU_SUBTYPE_SH7709)
98 { 0xa4000018, 16, 4, /* IPRD */ { PINT07, PINT815, } },
99 { 0xa400001a, 16, 4, /* IPRE */ { 0, SCIF0 } },
100#endif
101};
102
103static DECLARE_INTC_DESC(intc_desc, "sh770x", vectors, groups,
104 priorities, NULL, prio_registers, NULL);
105
106#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
107 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
108 defined(CONFIG_CPU_SUBTYPE_SH7709)
109static struct intc_vect vectors_irq[] = {
110 INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
111 INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
112};
113
114static DECLARE_INTC_DESC(intc_desc_irq, "sh770x-irq", vectors_irq, NULL,
115 priorities, NULL, prio_registers, NULL);
116#endif
117
118static struct resource rtc_resources[] = {
119 [0] = {
120 .start = 0xfffffec0,
121 .end = 0xfffffec0 + 0x1e,
122 .flags = IORESOURCE_IO,
123 },
124 [1] = {
125 .start = 20,
126 .flags = IORESOURCE_IRQ,
127 },
128 [2] = {
129 .start = 21,
130 .flags = IORESOURCE_IRQ,
131 },
132 [3] = {
133 .start = 22,
134 .flags = IORESOURCE_IRQ,
135 },
136};
137
138static struct platform_device rtc_device = {
139 .name = "sh-rtc",
140 .id = -1,
141 .num_resources = ARRAY_SIZE(rtc_resources),
142 .resource = rtc_resources,
143};
144
145static struct plat_sci_port sci_platform_data[] = {
146 {
147 .mapbase = 0xfffffe80,
148 .flags = UPF_BOOT_AUTOCONF,
149 .type = PORT_SCI,
150 .irqs = { 23, 24, 25, 0 },
151 },
152#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
153 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
154 defined(CONFIG_CPU_SUBTYPE_SH7709)
155 {
156 .mapbase = 0xa4000150,
157 .flags = UPF_BOOT_AUTOCONF,
158 .type = PORT_SCIF,
159 .irqs = { 56, 57, 59, 58 },
160 },
161#endif
162#if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
163 defined(CONFIG_CPU_SUBTYPE_SH7709)
164 {
165 .mapbase = 0xa4000140,
166 .flags = UPF_BOOT_AUTOCONF,
167 .type = PORT_IRDA,
168 .irqs = { 52, 53, 55, 54 },
169 },
170#endif
171 {
172 .flags = 0,
173 }
174};
175
176static struct platform_device sci_device = {
177 .name = "sh-sci",
178 .id = -1,
179 .dev = {
180 .platform_data = sci_platform_data,
181 },
182};
183
184static struct platform_device *sh770x_devices[] __initdata = {
185 &sci_device,
186 &rtc_device,
187};
188
189static int __init sh770x_devices_setup(void)
190{
191 return platform_add_devices(sh770x_devices,
192 ARRAY_SIZE(sh770x_devices));
193}
194__initcall(sh770x_devices_setup);
195
196void __init plat_irq_setup_pins(int mode)
197{
198 if (mode == IRQ_MODE_IRQ) {
199#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
200 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
201 defined(CONFIG_CPU_SUBTYPE_SH7709)
202 register_intc_controller(&intc_desc_irq);
203 return;
204#endif
205 }
206 BUG();
207}
208
209void __init plat_irq_setup(void)
210{
211 register_intc_controller(&intc_desc);
212}
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index a50636eb4ea..093d491424f 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -71,19 +71,21 @@ config CPU_SUBTYPE_SH7705
71config CPU_SUBTYPE_SH7706 71config CPU_SUBTYPE_SH7706
72 bool "Support SH7706 processor" 72 bool "Support SH7706 processor"
73 select CPU_SH3 73 select CPU_SH3
74 select CPU_HAS_IPR_IRQ 74 select CPU_HAS_INTC_IRQ
75 help 75 help
76 Select SH7706 if you have a 133 Mhz SH-3 HD6417706 CPU. 76 Select SH7706 if you have a 133 Mhz SH-3 HD6417706 CPU.
77 77
78config CPU_SUBTYPE_SH7707 78config CPU_SUBTYPE_SH7707
79 bool "Support SH7707 processor" 79 bool "Support SH7707 processor"
80 select CPU_SH3 80 select CPU_SH3
81 select CPU_HAS_INTC_IRQ
81 help 82 help
82 Select SH7707 if you have a 60 Mhz SH-3 HD6417707 CPU. 83 Select SH7707 if you have a 60 Mhz SH-3 HD6417707 CPU.
83 84
84config CPU_SUBTYPE_SH7708 85config CPU_SUBTYPE_SH7708
85 bool "Support SH7708 processor" 86 bool "Support SH7708 processor"
86 select CPU_SH3 87 select CPU_SH3
88 select CPU_HAS_INTC_IRQ
87 help 89 help
88 Select SH7708 if you have a 60 Mhz SH-3 HD6417708S or 90 Select SH7708 if you have a 60 Mhz SH-3 HD6417708S or
89 if you have a 100 Mhz SH-3 HD6417708R CPU. 91 if you have a 100 Mhz SH-3 HD6417708R CPU.
@@ -91,7 +93,7 @@ config CPU_SUBTYPE_SH7708
91config CPU_SUBTYPE_SH7709 93config CPU_SUBTYPE_SH7709
92 bool "Support SH7709 processor" 94 bool "Support SH7709 processor"
93 select CPU_SH3 95 select CPU_SH3
94 select CPU_HAS_IPR_IRQ 96 select CPU_HAS_INTC_IRQ
95 help 97 help
96 Select SH7709 if you have a 80 Mhz SH-3 HD6417709 CPU. 98 Select SH7709 if you have a 80 Mhz SH-3 HD6417709 CPU.
97 99