ARM: mach-shmobile: r8a7740 and Bonito timer rework
authorMagnus Damm <damm@opensource.se>
Tue, 6 Mar 2012 08:36:53 +0000 (17:36 +0900)
committerRafael J. Wysocki <rjw@sisk.pl>
Mon, 12 Mar 2012 21:19:45 +0000 (22:19 +0100)
Copy the SoC specific timer code from Bonito board code
to r8a7740 setup code. This makes is possible to share
the SoC specific timer code across boards. The Bonito
specific timer setup code tied to the FPGA is kept as-is.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
arch/arm/mach-shmobile/board-bonito.c
arch/arm/mach-shmobile/setup-r8a7740.c

index e39fa08731bf4f94eb7bced1d0dbc0ac3ce1a538..d062becd5460918f38d58b17c00bd7ed2944f7bb 100644 (file)
@@ -466,7 +466,7 @@ static void __init bonito_init(void)
        }
 }
 
-static void __init bonito_timer_init(void)
+static void __init bonito_earlytimer_init(void)
 {
        u16 val;
        u8 md_ck = 0;
@@ -481,18 +481,22 @@ static void __init bonito_timer_init(void)
                md_ck |= MD_CK0;
 
        r8a7740_clock_init(md_ck);
-       shmobile_timer.init();
+       shmobile_earlytimer_init();
 }
 
-struct sys_timer bonito_timer = {
-       .init   = bonito_timer_init,
-};
+void __init bonito_add_early_devices(void)
+{
+       r8a7740_add_early_devices();
+
+       /* override timer setup with board-specific code */
+       shmobile_timer.init = bonito_earlytimer_init;
+}
 
 MACHINE_START(BONITO, "bonito")
        .map_io         = bonito_map_io,
-       .init_early     = r8a7740_add_early_devices,
+       .init_early     = bonito_add_early_devices,
        .init_irq       = r8a7740_init_irq,
        .handle_irq     = shmobile_handle_irq_intc,
        .init_machine   = bonito_init,
-       .timer          = &bonito_timer,
+       .timer          = &shmobile_timer,
 MACHINE_END
index dbc30670a27ff36d9b771ad322b03d5a74ca57fc..74e52341dd1bda1352e70de479c75fa53a99356b 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
 #include <asm/mach/arch.h>
+#include <asm/mach/time.h>
 
 static struct map_desc r8a7740_io_desc[] __initdata = {
         /*
@@ -377,6 +378,12 @@ void __init r8a7740_add_standard_devices(void)
                             ARRAY_SIZE(r8a7740_late_devices));
 }
 
+static void __init r8a7740_earlytimer_init(void)
+{
+       r8a7740_clock_init(0);
+       shmobile_earlytimer_init();
+}
+
 void __init r8a7740_add_early_devices(void)
 {
        early_platform_add_devices(r8a7740_early_devices,
@@ -384,4 +391,7 @@ void __init r8a7740_add_early_devices(void)
 
        /* setup early console here as well */
        shmobile_setup_console();
+
+       /* override timer setup with soc-specific code */
+       shmobile_timer.init = r8a7740_earlytimer_init;
 }