aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/cpu/sh2a/setup-sh7203.c')
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7203.c154
1 files changed, 154 insertions, 0 deletions
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
index 820dfb2e8656..d7493418ba60 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
@@ -11,6 +11,8 @@
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_timer.h>
15#include <linux/io.h>
14 16
15enum { 17enum {
16 UNUSED = 0, 18 UNUSED = 0,
@@ -205,6 +207,132 @@ static struct platform_device sci_device = {
205 }, 207 },
206}; 208};
207 209
210static struct sh_timer_config cmt0_platform_data = {
211 .name = "CMT0",
212 .channel_offset = 0x02,
213 .timer_bit = 0,
214 .clk = "module_clk",
215 .clockevent_rating = 125,
216 .clocksource_rating = 0, /* disabled due to code generation issues */
217};
218
219static struct resource cmt0_resources[] = {
220 [0] = {
221 .name = "CMT0",
222 .start = 0xfffec002,
223 .end = 0xfffec007,
224 .flags = IORESOURCE_MEM,
225 },
226 [1] = {
227 .start = 142,
228 .flags = IORESOURCE_IRQ,
229 },
230};
231
232static struct platform_device cmt0_device = {
233 .name = "sh_cmt",
234 .id = 0,
235 .dev = {
236 .platform_data = &cmt0_platform_data,
237 },
238 .resource = cmt0_resources,
239 .num_resources = ARRAY_SIZE(cmt0_resources),
240};
241
242static struct sh_timer_config cmt1_platform_data = {
243 .name = "CMT1",
244 .channel_offset = 0x08,
245 .timer_bit = 1,
246 .clk = "module_clk",
247 .clockevent_rating = 125,
248 .clocksource_rating = 0, /* disabled due to code generation issues */
249};
250
251static struct resource cmt1_resources[] = {
252 [0] = {
253 .name = "CMT1",
254 .start = 0xfffec008,
255 .end = 0xfffec00d,
256 .flags = IORESOURCE_MEM,
257 },
258 [1] = {
259 .start = 143,
260 .flags = IORESOURCE_IRQ,
261 },
262};
263
264static struct platform_device cmt1_device = {
265 .name = "sh_cmt",
266 .id = 1,
267 .dev = {
268 .platform_data = &cmt1_platform_data,
269 },
270 .resource = cmt1_resources,
271 .num_resources = ARRAY_SIZE(cmt1_resources),
272};
273
274static struct sh_timer_config mtu2_0_platform_data = {
275 .name = "MTU2_0",
276 .channel_offset = -0x80,
277 .timer_bit = 0,
278 .clk = "module_clk",
279 .clockevent_rating = 200,
280};
281
282static struct resource mtu2_0_resources[] = {
283 [0] = {
284 .name = "MTU2_0",
285 .start = 0xfffe4300,
286 .end = 0xfffe4326,
287 .flags = IORESOURCE_MEM,
288 },
289 [1] = {
290 .start = 146,
291 .flags = IORESOURCE_IRQ,
292 },
293};
294
295static struct platform_device mtu2_0_device = {
296 .name = "sh_mtu2",
297 .id = 0,
298 .dev = {
299 .platform_data = &mtu2_0_platform_data,
300 },
301 .resource = mtu2_0_resources,
302 .num_resources = ARRAY_SIZE(mtu2_0_resources),
303};
304
305static struct sh_timer_config mtu2_1_platform_data = {
306 .name = "MTU2_1",
307 .channel_offset = -0x100,
308 .timer_bit = 1,
309 .clk = "module_clk",
310 .clockevent_rating = 200,
311};
312
313static struct resource mtu2_1_resources[] = {
314 [0] = {
315 .name = "MTU2_1",
316 .start = 0xfffe4380,
317 .end = 0xfffe4390,
318 .flags = IORESOURCE_MEM,
319 },
320 [1] = {
321 .start = 153,
322 .flags = IORESOURCE_IRQ,
323 },
324};
325
326static struct platform_device mtu2_1_device = {
327 .name = "sh_mtu2",
328 .id = 1,
329 .dev = {
330 .platform_data = &mtu2_1_platform_data,
331 },
332 .resource = mtu2_1_resources,
333 .num_resources = ARRAY_SIZE(mtu2_1_resources),
334};
335
208static struct resource rtc_resources[] = { 336static struct resource rtc_resources[] = {
209 [0] = { 337 [0] = {
210 .start = 0xffff2000, 338 .start = 0xffff2000,
@@ -227,6 +355,10 @@ static struct platform_device rtc_device = {
227 355
228static struct platform_device *sh7203_devices[] __initdata = { 356static struct platform_device *sh7203_devices[] __initdata = {
229 &sci_device, 357 &sci_device,
358 &cmt0_device,
359 &cmt1_device,
360 &mtu2_0_device,
361 &mtu2_1_device,
230 &rtc_device, 362 &rtc_device,
231}; 363};
232 364
@@ -241,3 +373,25 @@ void __init plat_irq_setup(void)
241{ 373{
242 register_intc_controller(&intc_desc); 374 register_intc_controller(&intc_desc);
243} 375}
376
377static struct platform_device *sh7203_early_devices[] __initdata = {
378 &cmt0_device,
379 &cmt1_device,
380 &mtu2_0_device,
381 &mtu2_1_device,
382};
383
384#define STBCR3 0xfffe0408
385#define STBCR4 0xfffe040c
386
387void __init plat_early_device_setup(void)
388{
389 /* enable CMT clock */
390 __raw_writeb(__raw_readb(STBCR4) & ~0x04, STBCR4);
391
392 /* enable MTU2 clock */
393 __raw_writeb(__raw_readb(STBCR3) & ~0x20, STBCR3);
394
395 early_platform_add_devices(sh7203_early_devices,
396 ARRAY_SIZE(sh7203_early_devices));
397}