aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-05-08 02:39:25 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-05-08 02:39:25 -0400
commitc2ecb4c4a7da16288062a057b693b7b1e16aaf88 (patch)
tree3c9a339738a9ad6d244a37aab0f42b69e1c39c49 /arch
parent4fa48e1774992fd03a4cd83a0f2adecb288c46f8 (diff)
sh: Move out rtc-sh registration from time_64.c to setup-sh5.c
Now that the onchip_remap() mess is sorted out, the rtc-sh support code for SH-5 can follow the same approach as the other CPUs. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/sh/kernel/cpu/sh5/setup-sh5.c31
-rw-r--r--arch/sh/kernel/time_64.c52
2 files changed, 32 insertions, 51 deletions
diff --git a/arch/sh/kernel/cpu/sh5/setup-sh5.c b/arch/sh/kernel/cpu/sh5/setup-sh5.c
index d8d59fea1082..9a362c8f3fe9 100644
--- a/arch/sh/kernel/cpu/sh5/setup-sh5.c
+++ b/arch/sh/kernel/cpu/sh5/setup-sh5.c
@@ -34,8 +34,39 @@ static struct platform_device sci_device = {
34 }, 34 },
35}; 35};
36 36
37static struct resource rtc_resources[] = {
38 [0] = {
39 .start = PHYS_PERIPHERAL_BLOCK + 0x01040000,
40 .end = PHYS_PERIPHERAL_BLOCK + 0x01040000 + 0x58 - 1,
41 .flags = IORESOURCE_IO,
42 },
43 [1] = {
44 /* Period IRQ */
45 .start = IRQ_PRI,
46 .flags = IORESOURCE_IRQ,
47 },
48 [2] = {
49 /* Carry IRQ */
50 .start = IRQ_CUI,
51 .flags = IORESOURCE_IRQ,
52 },
53 [3] = {
54 /* Alarm IRQ */
55 .start = IRQ_ATI,
56 .flags = IORESOURCE_IRQ,
57 },
58};
59
60static struct platform_device rtc_device = {
61 .name = "sh-rtc",
62 .id = -1,
63 .num_resources = ARRAY_SIZE(rtc_resources),
64 .resource = rtc_resources,
65};
66
37static struct platform_device *sh5_devices[] __initdata = { 67static struct platform_device *sh5_devices[] __initdata = {
38 &sci_device, 68 &sci_device,
69 &rtc_device,
39}; 70};
40 71
41static int __init sh5_devices_setup(void) 72static int __init sh5_devices_setup(void)
diff --git a/arch/sh/kernel/time_64.c b/arch/sh/kernel/time_64.c
index 7bfeaa09b947..b4fe770e2a3f 100644
--- a/arch/sh/kernel/time_64.c
+++ b/arch/sh/kernel/time_64.c
@@ -46,12 +46,6 @@
46#define TMU_TSTR_INIT 1 46#define TMU_TSTR_INIT 1
47#define TMU_TSTR_OFF 0 47#define TMU_TSTR_OFF 0
48 48
49/* Real Time Clock */
50#define RTC_BLOCK_OFF 0x01040000
51#define RTC_BASE PHYS_PERIPHERAL_BLOCK + RTC_BLOCK_OFF
52#define RTC_RCR1_CIE 0x10 /* Carry Interrupt Enable */
53#define RTC_RCR1 (rtc_base + 0x38)
54
55/* Time Management Unit */ 49/* Time Management Unit */
56#define TMU_BLOCK_OFF 0x01020000 50#define TMU_BLOCK_OFF 0x01020000
57#define TMU_BASE PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF 51#define TMU_BASE PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF
@@ -68,8 +62,7 @@
68 62
69#define TICK_SIZE (tick_nsec / 1000) 63#define TICK_SIZE (tick_nsec / 1000)
70 64
71static unsigned long tmu_base, rtc_base; 65static unsigned long tmu_base;
72unsigned long cprc_base;
73 66
74/* Variables to allow interpolation of time of day to resolution better than a 67/* Variables to allow interpolation of time of day to resolution better than a
75 * jiffy. */ 68 * jiffy. */
@@ -248,11 +241,6 @@ void __init time_init(void)
248 panic("Unable to remap TMU\n"); 241 panic("Unable to remap TMU\n");
249 } 242 }
250 243
251 rtc_base = (unsigned long)ioremap_nocache(RTC_BASE, 1024);
252 if (!rtc_base) {
253 panic("Unable to remap RTC\n");
254 }
255
256 clk = clk_get(NULL, "cpu_clk"); 244 clk = clk_get(NULL, "cpu_clk");
257 scaled_recip_ctc_ticks_per_jiffy = ((1ULL << CTC_JIFFY_SCALE_SHIFT) / 245 scaled_recip_ctc_ticks_per_jiffy = ((1ULL << CTC_JIFFY_SCALE_SHIFT) /
258 (unsigned long long)(clk_get_rate(clk) / HZ)); 246 (unsigned long long)(clk_get_rate(clk) / HZ));
@@ -274,41 +262,3 @@ void __init time_init(void)
274 ctrl_outl(interval, TMU0_TCNT); 262 ctrl_outl(interval, TMU0_TCNT);
275 ctrl_outb(TMU_TSTR_INIT, TMU_TSTR); 263 ctrl_outb(TMU_TSTR_INIT, TMU_TSTR);
276} 264}
277
278static struct resource rtc_resources[] = {
279 [0] = {
280 /* RTC base, filled in by rtc_init */
281 .flags = IORESOURCE_IO,
282 },
283 [1] = {
284 /* Period IRQ */
285 .start = IRQ_PRI,
286 .flags = IORESOURCE_IRQ,
287 },
288 [2] = {
289 /* Carry IRQ */
290 .start = IRQ_CUI,
291 .flags = IORESOURCE_IRQ,
292 },
293 [3] = {
294 /* Alarm IRQ */
295 .start = IRQ_ATI,
296 .flags = IORESOURCE_IRQ,
297 },
298};
299
300static struct platform_device rtc_device = {
301 .name = "sh-rtc",
302 .id = -1,
303 .num_resources = ARRAY_SIZE(rtc_resources),
304 .resource = rtc_resources,
305};
306
307static int __init rtc_init(void)
308{
309 rtc_resources[0].start = rtc_base;
310 rtc_resources[0].end = rtc_resources[0].start + 0x58 - 1;
311
312 return platform_device_register(&rtc_device);
313}
314device_initcall(rtc_init);