diff options
Diffstat (limited to 'arch/sh/kernel/cpu/sh2a/setup-sh7203.c')
-rw-r--r-- | arch/sh/kernel/cpu/sh2a/setup-sh7203.c | 71 |
1 files changed, 71 insertions, 0 deletions
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 | ||
17 | enum { | 18 | enum { |
@@ -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 | ||
275 | static 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 | |||
283 | static 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 | |||
296 | static 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 | |||
306 | static 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 | |||
314 | static 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 | |||
327 | static 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 | |||
274 | static struct resource rtc_resources[] = { | 337 | static 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) | |||
313 | static struct platform_device *sh7203_early_devices[] __initdata = { | 378 | static 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 | ||
320 | void __init plat_early_device_setup(void) | 388 | void __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 | } |