aboutsummaryrefslogtreecommitdiff
path: root/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-04-30 07:06:26 +0000
committerPaul Mundt <lethal@linux-sh.org>2009-05-03 17:38:07 +0900
commitda107c6ef919b3afd9c9b405a4f71e03b5725b04 (patch)
tree156284403aa3fa99d8c7b09bce618d8bc803b0ac /arch/sh/kernel/cpu/sh2a/setup-sh7203.c
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/sh/kernel/cpu/sh2a/setup-sh7203.c')
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7203.c71
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 0836acee228..3448164b573 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
@@ -12,6 +12,7 @@
#include <linux/serial.h>
#include <linux/serial_sci.h>
#include <linux/sh_cmt.h>
+#include <linux/sh_mtu2.h>
#include <linux/io.h>
enum {
@@ -271,6 +272,68 @@ static struct platform_device cmt1_device = {
.num_resources = ARRAY_SIZE(cmt1_resources),
};
+static struct sh_mtu2_config mtu2_0_platform_data = {
+ .name = "MTU2_0",
+ .channel_offset = -0x80,
+ .timer_bit = 0,
+ .clk = "module_clk",
+ .clockevent_rating = 200,
+};
+
+static struct resource mtu2_0_resources[] = {
+ [0] = {
+ .name = "MTU2_0",
+ .start = 0xfffe4300,
+ .end = 0xfffe4326,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = 146,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device mtu2_0_device = {
+ .name = "sh_mtu2",
+ .id = 0,
+ .dev = {
+ .platform_data = &mtu2_0_platform_data,
+ },
+ .resource = mtu2_0_resources,
+ .num_resources = ARRAY_SIZE(mtu2_0_resources),
+};
+
+static struct sh_mtu2_config mtu2_1_platform_data = {
+ .name = "MTU2_1",
+ .channel_offset = -0x100,
+ .timer_bit = 1,
+ .clk = "module_clk",
+ .clockevent_rating = 200,
+};
+
+static struct resource mtu2_1_resources[] = {
+ [0] = {
+ .name = "MTU2_1",
+ .start = 0xfffe4380,
+ .end = 0xfffe4390,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = 153,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device mtu2_1_device = {
+ .name = "sh_mtu2",
+ .id = 1,
+ .dev = {
+ .platform_data = &mtu2_1_platform_data,
+ },
+ .resource = mtu2_1_resources,
+ .num_resources = ARRAY_SIZE(mtu2_1_resources),
+};
+
static struct resource rtc_resources[] = {
[0] = {
.start = 0xffff2000,
@@ -295,6 +358,8 @@ static struct platform_device *sh7203_devices[] __initdata = {
&sci_device,
&cmt0_device,
&cmt1_device,
+ &mtu2_0_device,
+ &mtu2_1_device,
&rtc_device,
};
@@ -313,8 +378,11 @@ void __init plat_irq_setup(void)
static struct platform_device *sh7203_early_devices[] __initdata = {
&cmt0_device,
&cmt1_device,
+ &mtu2_0_device,
+ &mtu2_1_device,
};
+#define STBCR3 0xfffe0408
#define STBCR4 0xfffe040c
void __init plat_early_device_setup(void)
@@ -322,6 +390,9 @@ void __init plat_early_device_setup(void)
/* enable CMT clock */
__raw_writeb(__raw_readb(STBCR4) & ~0x04, STBCR4);
+ /* enable MTU2 clock */
+ __raw_writeb(__raw_readb(STBCR3) & ~0x20, STBCR3);
+
early_platform_add_devices(sh7203_early_devices,
ARRAY_SIZE(sh7203_early_devices));
}