aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-05-11 04:54:54 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-05-11 05:45:49 -0400
commit03f408f1aad8d0f5eb6380732bffc0f72b250fa7 (patch)
tree90990f042d353531f283fb7a4c94888cee3c679d
parent53c0054c3f11b49fc09f24e46f58661def952728 (diff)
sh: TMU platform data for sh775x
This patch adds TMU platform data for sh775x. Both clockevent and clocksource support is enabled. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7750.c187
1 files changed, 187 insertions, 0 deletions
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
index a1c80d909cd6..09da0c187d4c 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/serial.h> 13#include <linux/serial.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/sh_timer.h>
15#include <linux/serial_sci.h> 16#include <linux/serial_sci.h>
16 17
17static struct resource rtc_resources[] = { 18static struct resource rtc_resources[] = {
@@ -60,9 +61,177 @@ static struct platform_device sci_device = {
60 }, 61 },
61}; 62};
62 63
64static struct sh_timer_config tmu0_platform_data = {
65 .name = "TMU0",
66 .channel_offset = 0x04,
67 .timer_bit = 0,
68 .clk = "module_clk",
69 .clockevent_rating = 200,
70};
71
72static struct resource tmu0_resources[] = {
73 [0] = {
74 .name = "TMU0",
75 .start = 0xffd80008,
76 .end = 0xffd80013,
77 .flags = IORESOURCE_MEM,
78 },
79 [1] = {
80 .start = 16,
81 .flags = IORESOURCE_IRQ,
82 },
83};
84
85static struct platform_device tmu0_device = {
86 .name = "sh_tmu",
87 .id = 0,
88 .dev = {
89 .platform_data = &tmu0_platform_data,
90 },
91 .resource = tmu0_resources,
92 .num_resources = ARRAY_SIZE(tmu0_resources),
93};
94
95static struct sh_timer_config tmu1_platform_data = {
96 .name = "TMU1",
97 .channel_offset = 0x10,
98 .timer_bit = 1,
99 .clk = "module_clk",
100 .clocksource_rating = 200,
101};
102
103static struct resource tmu1_resources[] = {
104 [0] = {
105 .name = "TMU1",
106 .start = 0xffd80014,
107 .end = 0xffd8001f,
108 .flags = IORESOURCE_MEM,
109 },
110 [1] = {
111 .start = 17,
112 .flags = IORESOURCE_IRQ,
113 },
114};
115
116static struct platform_device tmu1_device = {
117 .name = "sh_tmu",
118 .id = 1,
119 .dev = {
120 .platform_data = &tmu1_platform_data,
121 },
122 .resource = tmu1_resources,
123 .num_resources = ARRAY_SIZE(tmu1_resources),
124};
125
126static struct sh_timer_config tmu2_platform_data = {
127 .name = "TMU2",
128 .channel_offset = 0x1c,
129 .timer_bit = 2,
130 .clk = "module_clk",
131};
132
133static struct resource tmu2_resources[] = {
134 [0] = {
135 .name = "TMU2",
136 .start = 0xffd80020,
137 .end = 0xffd8002f,
138 .flags = IORESOURCE_MEM,
139 },
140 [1] = {
141 .start = 18,
142 .flags = IORESOURCE_IRQ,
143 },
144};
145
146static struct platform_device tmu2_device = {
147 .name = "sh_tmu",
148 .id = 2,
149 .dev = {
150 .platform_data = &tmu2_platform_data,
151 },
152 .resource = tmu2_resources,
153 .num_resources = ARRAY_SIZE(tmu2_resources),
154};
155
156/* SH7750R, SH7751 and SH7751R all have two extra timer channels */
157#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
158 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
159 defined(CONFIG_CPU_SUBTYPE_SH7751R)
160
161static struct sh_timer_config tmu3_platform_data = {
162 .name = "TMU3",
163 .channel_offset = 0x04,
164 .timer_bit = 0,
165 .clk = "module_clk",
166};
167
168static struct resource tmu3_resources[] = {
169 [0] = {
170 .name = "TMU3",
171 .start = 0xfe100008,
172 .end = 0xfe100013,
173 .flags = IORESOURCE_MEM,
174 },
175 [1] = {
176 .start = 72,
177 .flags = IORESOURCE_IRQ,
178 },
179};
180
181static struct platform_device tmu3_device = {
182 .name = "sh_tmu",
183 .id = 3,
184 .dev = {
185 .platform_data = &tmu3_platform_data,
186 },
187 .resource = tmu3_resources,
188 .num_resources = ARRAY_SIZE(tmu3_resources),
189};
190
191static struct sh_timer_config tmu4_platform_data = {
192 .name = "TMU4",
193 .channel_offset = 0x10,
194 .timer_bit = 1,
195 .clk = "module_clk",
196};
197
198static struct resource tmu4_resources[] = {
199 [0] = {
200 .name = "TMU4",
201 .start = 0xfe100014,
202 .end = 0xfe10001f,
203 .flags = IORESOURCE_MEM,
204 },
205 [1] = {
206 .start = 76,
207 .flags = IORESOURCE_IRQ,
208 },
209};
210
211static struct platform_device tmu4_device = {
212 .name = "sh_tmu",
213 .id = 4,
214 .dev = {
215 .platform_data = &tmu4_platform_data,
216 },
217 .resource = tmu4_resources,
218 .num_resources = ARRAY_SIZE(tmu4_resources),
219};
220
221#endif
222
63static struct platform_device *sh7750_devices[] __initdata = { 223static struct platform_device *sh7750_devices[] __initdata = {
64 &rtc_device, 224 &rtc_device,
65 &sci_device, 225 &sci_device,
226 &tmu0_device,
227 &tmu1_device,
228 &tmu2_device,
229#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
230 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
231 defined(CONFIG_CPU_SUBTYPE_SH7751R)
232 &tmu3_device,
233 &tmu4_device,
234#endif
66}; 235};
67 236
68static int __init sh7750_devices_setup(void) 237static int __init sh7750_devices_setup(void)
@@ -72,6 +241,24 @@ static int __init sh7750_devices_setup(void)
72} 241}
73__initcall(sh7750_devices_setup); 242__initcall(sh7750_devices_setup);
74 243
244static struct platform_device *sh7750_early_devices[] __initdata = {
245 &tmu0_device,
246 &tmu1_device,
247 &tmu2_device,
248#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
249 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
250 defined(CONFIG_CPU_SUBTYPE_SH7751R)
251 &tmu3_device,
252 &tmu4_device,
253#endif
254};
255
256void __init plat_early_device_setup(void)
257{
258 early_platform_add_devices(sh7750_early_devices,
259 ARRAY_SIZE(sh7750_early_devices));
260}
261
75enum { 262enum {
76 UNUSED = 0, 263 UNUSED = 0,
77 264