sh: Move out rtc-sh registration from time_64.c to setup-sh5.c
authorPaul Mundt <lethal@linux-sh.org>
Fri, 8 May 2009 06:39:25 +0000 (15:39 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Fri, 8 May 2009 06:39:25 +0000 (15:39 +0900)
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>
arch/sh/kernel/cpu/sh5/setup-sh5.c
arch/sh/kernel/time_64.c

index d8d59fe..9a362c8 100644 (file)
@@ -34,8 +34,39 @@ static struct platform_device sci_device = {
        },
 };
 
+static struct resource rtc_resources[] = {
+       [0] = {
+               .start  = PHYS_PERIPHERAL_BLOCK + 0x01040000,
+               .end    = PHYS_PERIPHERAL_BLOCK + 0x01040000 + 0x58 - 1,
+               .flags  = IORESOURCE_IO,
+       },
+       [1] = {
+               /* Period IRQ */
+               .start  = IRQ_PRI,
+               .flags  = IORESOURCE_IRQ,
+       },
+       [2] = {
+               /* Carry IRQ */
+               .start  = IRQ_CUI,
+               .flags  = IORESOURCE_IRQ,
+       },
+       [3] = {
+               /* Alarm IRQ */
+               .start  = IRQ_ATI,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device rtc_device = {
+       .name           = "sh-rtc",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(rtc_resources),
+       .resource       = rtc_resources,
+};
+
 static struct platform_device *sh5_devices[] __initdata = {
        &sci_device,
+       &rtc_device,
 };
 
 static int __init sh5_devices_setup(void)
index 7bfeaa0..b4fe770 100644 (file)
 #define TMU_TSTR_INIT  1
 #define TMU_TSTR_OFF   0
 
-/* Real Time Clock */
-#define        RTC_BLOCK_OFF   0x01040000
-#define RTC_BASE       PHYS_PERIPHERAL_BLOCK + RTC_BLOCK_OFF
-#define RTC_RCR1_CIE   0x10    /* Carry Interrupt Enable */
-#define RTC_RCR1       (rtc_base + 0x38)
-
 /* Time Management Unit */
 #define        TMU_BLOCK_OFF   0x01020000
 #define TMU_BASE       PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF
@@ -68,8 +62,7 @@
 
 #define TICK_SIZE (tick_nsec / 1000)
 
-static unsigned long tmu_base, rtc_base;
-unsigned long cprc_base;
+static unsigned long tmu_base;
 
 /* Variables to allow interpolation of time of day to resolution better than a
  * jiffy. */
@@ -248,11 +241,6 @@ void __init time_init(void)
                panic("Unable to remap TMU\n");
        }
 
-       rtc_base = (unsigned long)ioremap_nocache(RTC_BASE, 1024);
-       if (!rtc_base) {
-               panic("Unable to remap RTC\n");
-       }
-
        clk = clk_get(NULL, "cpu_clk");
        scaled_recip_ctc_ticks_per_jiffy = ((1ULL << CTC_JIFFY_SCALE_SHIFT) /
                        (unsigned long long)(clk_get_rate(clk) / HZ));
@@ -274,41 +262,3 @@ void __init time_init(void)
        ctrl_outl(interval, TMU0_TCNT);
        ctrl_outb(TMU_TSTR_INIT, TMU_TSTR);
 }
-
-static struct resource rtc_resources[] = {
-       [0] = {
-               /* RTC base, filled in by rtc_init */
-               .flags  = IORESOURCE_IO,
-       },
-       [1] = {
-               /* Period IRQ */
-               .start  = IRQ_PRI,
-               .flags  = IORESOURCE_IRQ,
-       },
-       [2] = {
-               /* Carry IRQ */
-               .start  = IRQ_CUI,
-               .flags  = IORESOURCE_IRQ,
-       },
-       [3] = {
-               /* Alarm IRQ */
-               .start  = IRQ_ATI,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device rtc_device = {
-       .name           = "sh-rtc",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(rtc_resources),
-       .resource       = rtc_resources,
-};
-
-static int __init rtc_init(void)
-{
-       rtc_resources[0].start  = rtc_base;
-       rtc_resources[0].end    = rtc_resources[0].start + 0x58 - 1;
-
-       return platform_device_register(&rtc_device);
-}
-device_initcall(rtc_init);