From e74984e46e899c22137a385869fb4f3ae756e3df Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Tue, 29 Mar 2011 15:54:48 -0700 Subject: omap: Set separate timer init functions to avoid cpu_is_omap tests This is needed for the following patches so we can initialize the rest of the hardware timers later on. As with the init_irq calls, there's no need to do cpu_is_omap calls during the timer init as we only care about the major omap generation. This means that we can initialize the sys_timer with the .timer entries alone. Note that for now we just set stubs for the various sys_timer entries that will get populated in a later patch. The following patches will also remove the omap_dm_timer_init calls and change the init for the rest of the hardware timers to happen with an arch_initcall. Signed-off-by: Tony Lindgren Reviewed-by: Kevin Hilman --- arch/arm/mach-omap2/timer-gp.c | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'arch/arm/mach-omap2/timer-gp.c') diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c index 3b9cf85f4bb9..a0d8e83594eb 100644 --- a/arch/arm/mach-omap2/timer-gp.c +++ b/arch/arm/mach-omap2/timer-gp.c @@ -247,20 +247,41 @@ static void __init omap2_gp_clocksource_init(void) } #endif -static void __init omap2_gp_timer_init(void) +#define OMAP_SYS_TIMER_INIT(name) \ +static void __init omap##name##_timer_init(void) \ +{ \ + omap_dm_timer_init(); \ + omap2_gp_clockevent_init(); \ + omap2_gp_clocksource_init(); \ +} + +#define OMAP_SYS_TIMER(name) \ +struct sys_timer omap##name##_timer = { \ + .init = omap##name##_timer_init, \ +}; + +#ifdef CONFIG_ARCH_OMAP2 +OMAP_SYS_TIMER_INIT(2) +OMAP_SYS_TIMER(2) +#endif + +#ifdef CONFIG_ARCH_OMAP3 +OMAP_SYS_TIMER_INIT(3) +OMAP_SYS_TIMER(3) +OMAP_SYS_TIMER_INIT(3_secure) +OMAP_SYS_TIMER(3_secure) +#endif + +#ifdef CONFIG_ARCH_OMAP4 +static void __init omap4_timer_init(void) { #ifdef CONFIG_LOCAL_TIMERS - if (cpu_is_omap44xx()) { - twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256); - BUG_ON(!twd_base); - } + twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256); + BUG_ON(!twd_base); #endif omap_dm_timer_init(); - omap2_gp_clockevent_init(); omap2_gp_clocksource_init(); } - -struct sys_timer omap_timer = { - .init = omap2_gp_timer_init, -}; +OMAP_SYS_TIMER(4) +#endif -- cgit v1.2.3-58-ga151