aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-04-30 03:06:26 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-05-03 04:38:07 -0400
commitda107c6ef919b3afd9c9b405a4f71e03b5725b04 (patch)
tree156284403aa3fa99d8c7b09bce618d8bc803b0ac /arch
parentd5ed4c2e5ce9f5f6fd6a5a39ee1196a1f8a46eed (diff)
sh: sh2a MTU2 platform data
This patch adds MTU2 platform data for the following cpus: - sh7201 (3/5 channels) - sh7203/sh7263 (2/4 channels) - sh7206 (3/5 channels) - MXG (3/5 channels) 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/Kconfig5
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-mxg.c111
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7201.c115
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7203.c71
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7206.c104
5 files changed, 405 insertions, 1 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 6d0dd378ecad..2061488cc17c 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -214,27 +214,32 @@ config CPU_SUBTYPE_SH7201
214 bool "Support SH7201 processor" 214 bool "Support SH7201 processor"
215 select CPU_SH2A 215 select CPU_SH2A
216 select CPU_HAS_FPU 216 select CPU_HAS_FPU
217 select SYS_SUPPORTS_MTU2
217 218
218config CPU_SUBTYPE_SH7203 219config CPU_SUBTYPE_SH7203
219 bool "Support SH7203 processor" 220 bool "Support SH7203 processor"
220 select CPU_SH2A 221 select CPU_SH2A
221 select CPU_HAS_FPU 222 select CPU_HAS_FPU
222 select SYS_SUPPORTS_CMT 223 select SYS_SUPPORTS_CMT
224 select SYS_SUPPORTS_MTU2
223 225
224config CPU_SUBTYPE_SH7206 226config CPU_SUBTYPE_SH7206
225 bool "Support SH7206 processor" 227 bool "Support SH7206 processor"
226 select CPU_SH2A 228 select CPU_SH2A
227 select SYS_SUPPORTS_CMT 229 select SYS_SUPPORTS_CMT
230 select SYS_SUPPORTS_MTU2
228 231
229config CPU_SUBTYPE_SH7263 232config CPU_SUBTYPE_SH7263
230 bool "Support SH7263 processor" 233 bool "Support SH7263 processor"
231 select CPU_SH2A 234 select CPU_SH2A
232 select CPU_HAS_FPU 235 select CPU_HAS_FPU
233 select SYS_SUPPORTS_CMT 236 select SYS_SUPPORTS_CMT
237 select SYS_SUPPORTS_MTU2
234 238
235config CPU_SUBTYPE_MXG 239config CPU_SUBTYPE_MXG
236 bool "Support MX-G processor" 240 bool "Support MX-G processor"
237 select CPU_SH2A 241 select CPU_SH2A
242 select SYS_SUPPORTS_MTU2
238 help 243 help
239 Select MX-G if running on an R8A03022BG part. 244 Select MX-G if running on an R8A03022BG part.
240 245
diff --git a/arch/sh/kernel/cpu/sh2a/setup-mxg.c b/arch/sh/kernel/cpu/sh2a/setup-mxg.c
index 844293723cfc..870030aa05bc 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-mxg.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-mxg.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/serial_sci.h> 13#include <linux/serial_sci.h>
14#include <linux/sh_mtu2.h>
14 15
15enum { 16enum {
16 UNUSED = 0, 17 UNUSED = 0,
@@ -24,7 +25,7 @@ enum {
24 25
25 SCIF0, SCIF1, 26 SCIF0, SCIF1,
26 27
27 MTU2_GROUP1, MTU2_GROUP2, MTU2_GROUP3, MTU2_GROUP4, MTU2_GROUP5 28 MTU2_GROUP1, MTU2_GROUP2, MTU2_GROUP3, MTU2_GROUP4, MTU2_GROUP5,
28 MTU2_TGI3B, MTU2_TGI3C, 29 MTU2_TGI3B, MTU2_TGI3C,
29 30
30 /* interrupt groups */ 31 /* interrupt groups */
@@ -113,6 +114,99 @@ static struct intc_mask_reg mask_registers[] __initdata = {
113static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups, 114static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups,
114 mask_registers, prio_registers, NULL); 115 mask_registers, prio_registers, NULL);
115 116
117static struct sh_mtu2_config mtu2_0_platform_data = {
118 .name = "MTU2_0",
119 .channel_offset = -0x80,
120 .timer_bit = 0,
121 .clk = "module_clk",
122 .clockevent_rating = 200,
123};
124
125static struct resource mtu2_0_resources[] = {
126 [0] = {
127 .name = "MTU2_0",
128 .start = 0xff801300,
129 .end = 0xff801326,
130 .flags = IORESOURCE_MEM,
131 },
132 [1] = {
133 .start = 228,
134 .flags = IORESOURCE_IRQ,
135 },
136};
137
138static struct platform_device mtu2_0_device = {
139 .name = "sh_mtu2",
140 .id = 0,
141 .dev = {
142 .platform_data = &mtu2_0_platform_data,
143 },
144 .resource = mtu2_0_resources,
145 .num_resources = ARRAY_SIZE(mtu2_0_resources),
146};
147
148static struct sh_mtu2_config mtu2_1_platform_data = {
149 .name = "MTU2_1",
150 .channel_offset = -0x100,
151 .timer_bit = 1,
152 .clk = "module_clk",
153 .clockevent_rating = 200,
154};
155
156static struct resource mtu2_1_resources[] = {
157 [0] = {
158 .name = "MTU2_1",
159 .start = 0xff801380,
160 .end = 0xff801390,
161 .flags = IORESOURCE_MEM,
162 },
163 [1] = {
164 .start = 234,
165 .flags = IORESOURCE_IRQ,
166 },
167};
168
169static struct platform_device mtu2_1_device = {
170 .name = "sh_mtu2",
171 .id = 1,
172 .dev = {
173 .platform_data = &mtu2_1_platform_data,
174 },
175 .resource = mtu2_1_resources,
176 .num_resources = ARRAY_SIZE(mtu2_1_resources),
177};
178
179static struct sh_mtu2_config mtu2_2_platform_data = {
180 .name = "MTU2_2",
181 .channel_offset = 0x80,
182 .timer_bit = 2,
183 .clk = "module_clk",
184 .clockevent_rating = 200,
185};
186
187static struct resource mtu2_2_resources[] = {
188 [0] = {
189 .name = "MTU2_2",
190 .start = 0xff801000,
191 .end = 0xff80100a,
192 .flags = IORESOURCE_MEM,
193 },
194 [1] = {
195 .start = 240,
196 .flags = IORESOURCE_IRQ,
197 },
198};
199
200static struct platform_device mtu2_2_device = {
201 .name = "sh_mtu2",
202 .id = 2,
203 .dev = {
204 .platform_data = &mtu2_2_platform_data,
205 },
206 .resource = mtu2_2_resources,
207 .num_resources = ARRAY_SIZE(mtu2_2_resources),
208};
209
116static struct plat_sci_port sci_platform_data[] = { 210static struct plat_sci_port sci_platform_data[] = {
117 { 211 {
118 .mapbase = 0xff804000, 212 .mapbase = 0xff804000,
@@ -134,6 +228,9 @@ static struct platform_device sci_device = {
134 228
135static struct platform_device *mxg_devices[] __initdata = { 229static struct platform_device *mxg_devices[] __initdata = {
136 &sci_device, 230 &sci_device,
231 &mtu2_0_device,
232 &mtu2_1_device,
233 &mtu2_2_device,
137}; 234};
138 235
139static int __init mxg_devices_setup(void) 236static int __init mxg_devices_setup(void)
@@ -147,3 +244,15 @@ void __init plat_irq_setup(void)
147{ 244{
148 register_intc_controller(&intc_desc); 245 register_intc_controller(&intc_desc);
149} 246}
247
248static struct platform_device *mxg_early_devices[] __initdata = {
249 &mtu2_0_device,
250 &mtu2_1_device,
251 &mtu2_2_device,
252};
253
254void __init plat_early_device_setup(void)
255{
256 early_platform_add_devices(mxg_early_devices,
257 ARRAY_SIZE(mxg_early_devices));
258}
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
index 00f42f9e3f5c..074aa9062e4b 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
@@ -12,6 +12,8 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/serial.h> 13#include <linux/serial.h>
14#include <linux/serial_sci.h> 14#include <linux/serial_sci.h>
15#include <linux/sh_mtu2.h>
16#include <linux/io.h>
15 17
16enum { 18enum {
17 UNUSED = 0, 19 UNUSED = 0,
@@ -249,9 +251,105 @@ static struct platform_device rtc_device = {
249 .resource = rtc_resources, 251 .resource = rtc_resources,
250}; 252};
251 253
254static struct sh_mtu2_config mtu2_0_platform_data = {
255 .name = "MTU2_0",
256 .channel_offset = -0x80,
257 .timer_bit = 0,
258 .clk = "module_clk",
259 .clockevent_rating = 200,
260};
261
262static struct resource mtu2_0_resources[] = {
263 [0] = {
264 .name = "MTU2_0",
265 .start = 0xfffe4300,
266 .end = 0xfffe4326,
267 .flags = IORESOURCE_MEM,
268 },
269 [1] = {
270 .start = 108,
271 .flags = IORESOURCE_IRQ,
272 },
273};
274
275static struct platform_device mtu2_0_device = {
276 .name = "sh_mtu2",
277 .id = 0,
278 .dev = {
279 .platform_data = &mtu2_0_platform_data,
280 },
281 .resource = mtu2_0_resources,
282 .num_resources = ARRAY_SIZE(mtu2_0_resources),
283};
284
285static struct sh_mtu2_config mtu2_1_platform_data = {
286 .name = "MTU2_1",
287 .channel_offset = -0x100,
288 .timer_bit = 1,
289 .clk = "module_clk",
290 .clockevent_rating = 200,
291};
292
293static struct resource mtu2_1_resources[] = {
294 [0] = {
295 .name = "MTU2_1",
296 .start = 0xfffe4380,
297 .end = 0xfffe4390,
298 .flags = IORESOURCE_MEM,
299 },
300 [1] = {
301 .start = 116,
302 .flags = IORESOURCE_IRQ,
303 },
304};
305
306static struct platform_device mtu2_1_device = {
307 .name = "sh_mtu2",
308 .id = 1,
309 .dev = {
310 .platform_data = &mtu2_1_platform_data,
311 },
312 .resource = mtu2_1_resources,
313 .num_resources = ARRAY_SIZE(mtu2_1_resources),
314};
315
316static struct sh_mtu2_config mtu2_2_platform_data = {
317 .name = "MTU2_2",
318 .channel_offset = 0x80,
319 .timer_bit = 2,
320 .clk = "module_clk",
321 .clockevent_rating = 200,
322};
323
324static struct resource mtu2_2_resources[] = {
325 [0] = {
326 .name = "MTU2_2",
327 .start = 0xfffe4000,
328 .end = 0xfffe400a,
329 .flags = IORESOURCE_MEM,
330 },
331 [1] = {
332 .start = 124,
333 .flags = IORESOURCE_IRQ,
334 },
335};
336
337static struct platform_device mtu2_2_device = {
338 .name = "sh_mtu2",
339 .id = 2,
340 .dev = {
341 .platform_data = &mtu2_2_platform_data,
342 },
343 .resource = mtu2_2_resources,
344 .num_resources = ARRAY_SIZE(mtu2_2_resources),
345};
346
252static struct platform_device *sh7201_devices[] __initdata = { 347static struct platform_device *sh7201_devices[] __initdata = {
253 &sci_device, 348 &sci_device,
254 &rtc_device, 349 &rtc_device,
350 &mtu2_0_device,
351 &mtu2_1_device,
352 &mtu2_2_device,
255}; 353};
256 354
257static int __init sh7201_devices_setup(void) 355static int __init sh7201_devices_setup(void)
@@ -265,3 +363,20 @@ void __init plat_irq_setup(void)
265{ 363{
266 register_intc_controller(&intc_desc); 364 register_intc_controller(&intc_desc);
267} 365}
366
367static struct platform_device *sh7201_early_devices[] __initdata = {
368 &mtu2_0_device,
369 &mtu2_1_device,
370 &mtu2_2_device,
371};
372
373#define STBCR3 0xfffe0408
374
375void __init plat_early_device_setup(void)
376{
377 /* enable MTU2 clock */
378 __raw_writeb(__raw_readb(STBCR3) & ~0x20, STBCR3);
379
380 early_platform_add_devices(sh7201_early_devices,
381 ARRAY_SIZE(sh7201_early_devices));
382}
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
index 0836acee2289..3448164b5734 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
@@ -12,6 +12,7 @@
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/serial_sci.h> 13#include <linux/serial_sci.h>
14#include <linux/sh_cmt.h> 14#include <linux/sh_cmt.h>
15#include <linux/sh_mtu2.h>
15#include <linux/io.h> 16#include <linux/io.h>
16 17
17enum { 18enum {
@@ -271,6 +272,68 @@ static struct platform_device cmt1_device = {
271 .num_resources = ARRAY_SIZE(cmt1_resources), 272 .num_resources = ARRAY_SIZE(cmt1_resources),
272}; 273};
273 274
275static struct sh_mtu2_config mtu2_0_platform_data = {
276 .name = "MTU2_0",
277 .channel_offset = -0x80,
278 .timer_bit = 0,
279 .clk = "module_clk",
280 .clockevent_rating = 200,
281};
282
283static struct resource mtu2_0_resources[] = {
284 [0] = {
285 .name = "MTU2_0",
286 .start = 0xfffe4300,
287 .end = 0xfffe4326,
288 .flags = IORESOURCE_MEM,
289 },
290 [1] = {
291 .start = 146,
292 .flags = IORESOURCE_IRQ,
293 },
294};
295
296static struct platform_device mtu2_0_device = {
297 .name = "sh_mtu2",
298 .id = 0,
299 .dev = {
300 .platform_data = &mtu2_0_platform_data,
301 },
302 .resource = mtu2_0_resources,
303 .num_resources = ARRAY_SIZE(mtu2_0_resources),
304};
305
306static struct sh_mtu2_config mtu2_1_platform_data = {
307 .name = "MTU2_1",
308 .channel_offset = -0x100,
309 .timer_bit = 1,
310 .clk = "module_clk",
311 .clockevent_rating = 200,
312};
313
314static struct resource mtu2_1_resources[] = {
315 [0] = {
316 .name = "MTU2_1",
317 .start = 0xfffe4380,
318 .end = 0xfffe4390,
319 .flags = IORESOURCE_MEM,
320 },
321 [1] = {
322 .start = 153,
323 .flags = IORESOURCE_IRQ,
324 },
325};
326
327static struct platform_device mtu2_1_device = {
328 .name = "sh_mtu2",
329 .id = 1,
330 .dev = {
331 .platform_data = &mtu2_1_platform_data,
332 },
333 .resource = mtu2_1_resources,
334 .num_resources = ARRAY_SIZE(mtu2_1_resources),
335};
336
274static struct resource rtc_resources[] = { 337static struct resource rtc_resources[] = {
275 [0] = { 338 [0] = {
276 .start = 0xffff2000, 339 .start = 0xffff2000,
@@ -295,6 +358,8 @@ static struct platform_device *sh7203_devices[] __initdata = {
295 &sci_device, 358 &sci_device,
296 &cmt0_device, 359 &cmt0_device,
297 &cmt1_device, 360 &cmt1_device,
361 &mtu2_0_device,
362 &mtu2_1_device,
298 &rtc_device, 363 &rtc_device,
299}; 364};
300 365
@@ -313,8 +378,11 @@ void __init plat_irq_setup(void)
313static struct platform_device *sh7203_early_devices[] __initdata = { 378static struct platform_device *sh7203_early_devices[] __initdata = {
314 &cmt0_device, 379 &cmt0_device,
315 &cmt1_device, 380 &cmt1_device,
381 &mtu2_0_device,
382 &mtu2_1_device,
316}; 383};
317 384
385#define STBCR3 0xfffe0408
318#define STBCR4 0xfffe040c 386#define STBCR4 0xfffe040c
319 387
320void __init plat_early_device_setup(void) 388void __init plat_early_device_setup(void)
@@ -322,6 +390,9 @@ void __init plat_early_device_setup(void)
322 /* enable CMT clock */ 390 /* enable CMT clock */
323 __raw_writeb(__raw_readb(STBCR4) & ~0x04, STBCR4); 391 __raw_writeb(__raw_readb(STBCR4) & ~0x04, STBCR4);
324 392
393 /* enable MTU2 clock */
394 __raw_writeb(__raw_readb(STBCR3) & ~0x20, STBCR3);
395
325 early_platform_add_devices(sh7203_early_devices, 396 early_platform_add_devices(sh7203_early_devices,
326 ARRAY_SIZE(sh7203_early_devices)); 397 ARRAY_SIZE(sh7203_early_devices));
327} 398}
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
index f9606e3d2515..e700559b6b89 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
@@ -13,6 +13,7 @@
13#include <linux/serial.h> 13#include <linux/serial.h>
14#include <linux/serial_sci.h> 14#include <linux/serial_sci.h>
15#include <linux/sh_cmt.h> 15#include <linux/sh_cmt.h>
16#include <linux/sh_mtu2.h>
16#include <linux/io.h> 17#include <linux/io.h>
17 18
18enum { 19enum {
@@ -231,10 +232,106 @@ static struct platform_device cmt1_device = {
231 .num_resources = ARRAY_SIZE(cmt1_resources), 232 .num_resources = ARRAY_SIZE(cmt1_resources),
232}; 233};
233 234
235static struct sh_mtu2_config mtu2_0_platform_data = {
236 .name = "MTU2_0",
237 .channel_offset = -0x80,
238 .timer_bit = 0,
239 .clk = "module_clk",
240 .clockevent_rating = 200,
241};
242
243static struct resource mtu2_0_resources[] = {
244 [0] = {
245 .name = "MTU2_0",
246 .start = 0xfffe4300,
247 .end = 0xfffe4326,
248 .flags = IORESOURCE_MEM,
249 },
250 [1] = {
251 .start = 156,
252 .flags = IORESOURCE_IRQ,
253 },
254};
255
256static struct platform_device mtu2_0_device = {
257 .name = "sh_mtu2",
258 .id = 0,
259 .dev = {
260 .platform_data = &mtu2_0_platform_data,
261 },
262 .resource = mtu2_0_resources,
263 .num_resources = ARRAY_SIZE(mtu2_0_resources),
264};
265
266static struct sh_mtu2_config mtu2_1_platform_data = {
267 .name = "MTU2_1",
268 .channel_offset = -0x100,
269 .timer_bit = 1,
270 .clk = "module_clk",
271 .clockevent_rating = 200,
272};
273
274static struct resource mtu2_1_resources[] = {
275 [0] = {
276 .name = "MTU2_1",
277 .start = 0xfffe4380,
278 .end = 0xfffe4390,
279 .flags = IORESOURCE_MEM,
280 },
281 [1] = {
282 .start = 164,
283 .flags = IORESOURCE_IRQ,
284 },
285};
286
287static struct platform_device mtu2_1_device = {
288 .name = "sh_mtu2",
289 .id = 1,
290 .dev = {
291 .platform_data = &mtu2_1_platform_data,
292 },
293 .resource = mtu2_1_resources,
294 .num_resources = ARRAY_SIZE(mtu2_1_resources),
295};
296
297static struct sh_mtu2_config mtu2_2_platform_data = {
298 .name = "MTU2_2",
299 .channel_offset = 0x80,
300 .timer_bit = 2,
301 .clk = "module_clk",
302 .clockevent_rating = 200,
303};
304
305static struct resource mtu2_2_resources[] = {
306 [0] = {
307 .name = "MTU2_2",
308 .start = 0xfffe4000,
309 .end = 0xfffe400a,
310 .flags = IORESOURCE_MEM,
311 },
312 [1] = {
313 .start = 180,
314 .flags = IORESOURCE_IRQ,
315 },
316};
317
318static struct platform_device mtu2_2_device = {
319 .name = "sh_mtu2",
320 .id = 2,
321 .dev = {
322 .platform_data = &mtu2_2_platform_data,
323 },
324 .resource = mtu2_2_resources,
325 .num_resources = ARRAY_SIZE(mtu2_2_resources),
326};
327
234static struct platform_device *sh7206_devices[] __initdata = { 328static struct platform_device *sh7206_devices[] __initdata = {
235 &sci_device, 329 &sci_device,
236 &cmt0_device, 330 &cmt0_device,
237 &cmt1_device, 331 &cmt1_device,
332 &mtu2_0_device,
333 &mtu2_1_device,
334 &mtu2_2_device,
238}; 335};
239 336
240static int __init sh7206_devices_setup(void) 337static int __init sh7206_devices_setup(void)
@@ -252,8 +349,12 @@ void __init plat_irq_setup(void)
252static struct platform_device *sh7206_early_devices[] __initdata = { 349static struct platform_device *sh7206_early_devices[] __initdata = {
253 &cmt0_device, 350 &cmt0_device,
254 &cmt1_device, 351 &cmt1_device,
352 &mtu2_0_device,
353 &mtu2_1_device,
354 &mtu2_2_device,
255}; 355};
256 356
357#define STBCR3 0xfffe0408
257#define STBCR4 0xfffe040c 358#define STBCR4 0xfffe040c
258 359
259void __init plat_early_device_setup(void) 360void __init plat_early_device_setup(void)
@@ -261,6 +362,9 @@ void __init plat_early_device_setup(void)
261 /* enable CMT clock */ 362 /* enable CMT clock */
262 __raw_writeb(__raw_readb(STBCR4) & ~0x04, STBCR4); 363 __raw_writeb(__raw_readb(STBCR4) & ~0x04, STBCR4);
263 364
365 /* enable MTU2 clock */
366 __raw_writeb(__raw_readb(STBCR3) & ~0x20, STBCR3);
367
264 early_platform_add_devices(sh7206_early_devices, 368 early_platform_add_devices(sh7206_early_devices,
265 ARRAY_SIZE(sh7206_early_devices)); 369 ARRAY_SIZE(sh7206_early_devices));
266} 370}