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 <tony@atomide.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
This commit is contained in:
Tony Lindgren 2011-03-29 15:54:48 -07:00
parent 741e3a89de
commit e74984e46e
46 changed files with 86 additions and 62 deletions

View File

@ -391,7 +391,7 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
.reserve = omap_reserve,
.init_irq = ams_delta_init_irq,
.init_machine = ams_delta_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END
EXPORT_SYMBOL(ams_delta_latch1_write);

View File

@ -394,5 +394,5 @@ MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
.reserve = omap_reserve,
.init_irq = omap_fsample_init_irq,
.init_machine = omap_fsample_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -99,5 +99,5 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
.reserve = omap_reserve,
.init_irq = omap_generic_init_irq,
.init_machine = omap_generic_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -466,5 +466,5 @@ MACHINE_START(OMAP_H2, "TI-H2")
.reserve = omap_reserve,
.init_irq = h2_init_irq,
.init_machine = h2_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -454,5 +454,5 @@ MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
.reserve = omap_reserve,
.init_irq = h3_init_irq,
.init_machine = h3_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -616,5 +616,5 @@ MACHINE_START(HERALD, "HTC Herald")
.reserve = omap_reserve,
.init_irq = htcherald_init_irq,
.init_machine = htcherald_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -464,5 +464,5 @@ MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
.reserve = omap_reserve,
.init_irq = innovator_init_irq,
.init_machine = innovator_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -269,5 +269,5 @@ MACHINE_START(NOKIA770, "Nokia 770")
.reserve = omap_reserve,
.init_irq = omap_nokia770_init_irq,
.init_machine = omap_nokia770_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -588,5 +588,5 @@ MACHINE_START(OMAP_OSK, "TI-OSK")
.reserve = omap_reserve,
.init_irq = osk_init_irq,
.init_machine = osk_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -280,5 +280,5 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
.reserve = omap_reserve,
.init_irq = omap_palmte_init_irq,
.init_machine = omap_palmte_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -326,5 +326,5 @@ MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
.reserve = omap_reserve,
.init_irq = omap_palmtt_init_irq,
.init_machine = omap_palmtt_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -346,5 +346,5 @@ MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
.reserve = omap_reserve,
.init_irq = omap_palmz71_init_irq,
.init_machine = omap_palmz71_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -355,5 +355,5 @@ MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
.reserve = omap_reserve,
.init_irq = omap_perseus2_init_irq,
.init_machine = omap_perseus2_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -426,5 +426,5 @@ MACHINE_START(SX1, "OMAP310 based Siemens SX1")
.reserve = omap_reserve,
.init_irq = omap_sx1_init_irq,
.init_machine = omap_sx1_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -306,5 +306,5 @@ MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
.reserve = omap_reserve,
.init_irq = voiceblue_init_irq,
.init_machine = voiceblue_init,
.timer = &omap_timer,
.timer = &omap1_timer,
MACHINE_END

View File

@ -297,7 +297,7 @@ static inline int omap_32k_timer_usable(void)
* Timer initialization
* ---------------------------------------------------------------------------
*/
static void __init omap_timer_init(void)
static void __init omap1_timer_init(void)
{
if (omap_32k_timer_usable()) {
preferred_sched_clock_init(1);
@ -307,6 +307,6 @@ static void __init omap_timer_init(void)
}
}
struct sys_timer omap_timer = {
.init = omap_timer_init,
struct sys_timer omap1_timer = {
.init = omap1_timer_init,
};

View File

@ -262,5 +262,5 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
.init_early = omap_2430sdp_init_early,
.init_irq = omap2_init_irq,
.init_machine = omap_2430sdp_init,
.timer = &omap_timer,
.timer = &omap2_timer,
MACHINE_END

View File

@ -806,5 +806,5 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
.init_early = omap_3430sdp_init_early,
.init_irq = omap3_init_irq,
.init_machine = omap_3430sdp_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -221,5 +221,5 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
.init_early = omap_sdp_init_early,
.init_irq = omap3_init_irq,
.init_machine = omap_sdp_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -773,5 +773,5 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
.init_early = omap_4430sdp_init_early,
.init_irq = gic_init_irq,
.init_machine = omap_4430sdp_init,
.timer = &omap_timer,
.timer = &omap4_timer,
MACHINE_END

View File

@ -106,5 +106,5 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
.init_early = am3517_crane_init_early,
.init_irq = omap3_init_irq,
.init_machine = am3517_crane_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -496,5 +496,5 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
.init_early = am3517_evm_init_early,
.init_irq = omap3_init_irq,
.init_machine = am3517_evm_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -356,5 +356,5 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
.init_early = omap_apollon_init_early,
.init_irq = omap2_init_irq,
.init_machine = omap_apollon_init,
.timer = &omap_timer,
.timer = &omap2_timer,
MACHINE_END

View File

@ -648,5 +648,5 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
.init_early = cm_t35_init_early,
.init_irq = omap3_init_irq,
.init_machine = cm_t35_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -306,5 +306,5 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
.init_early = cm_t3517_init_early,
.init_irq = omap3_init_irq,
.init_machine = cm_t3517_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -707,5 +707,5 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
.init_early = devkit8000_init_early,
.init_irq = devkit8000_init_irq,
.init_machine = devkit8000_init,
.timer = &omap_timer,
.timer = &omap3_secure_timer,
MACHINE_END

View File

@ -72,5 +72,5 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
.init_early = omap_generic_init_early,
.init_irq = omap2_init_irq,
.init_machine = omap_generic_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -388,5 +388,5 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
.init_early = omap_h4_init_early,
.init_irq = omap_h4_init_irq,
.init_machine = omap_h4_init,
.timer = &omap_timer,
.timer = &omap2_timer,
MACHINE_END

View File

@ -705,7 +705,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
.init_early = igep_init_early,
.init_irq = omap3_init_irq,
.init_machine = igep_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END
MACHINE_START(IGEP0030, "IGEP OMAP3 module")
@ -715,5 +715,5 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 module")
.init_early = igep_init_early,
.init_irq = omap3_init_irq,
.init_machine = igep_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -352,5 +352,5 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
.init_early = omap_ldp_init_early,
.init_irq = omap3_init_irq,
.init_machine = omap_ldp_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -701,7 +701,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
.init_early = n8x0_init_early,
.init_irq = omap2_init_irq,
.init_machine = n8x0_init_machine,
.timer = &omap_timer,
.timer = &omap2_timer,
MACHINE_END
MACHINE_START(NOKIA_N810, "Nokia N810")
@ -711,7 +711,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
.init_early = n8x0_init_early,
.init_irq = omap2_init_irq,
.init_machine = n8x0_init_machine,
.timer = &omap_timer,
.timer = &omap2_timer,
MACHINE_END
MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
@ -721,5 +721,5 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
.init_early = n8x0_init_early,
.init_irq = omap2_init_irq,
.init_machine = n8x0_init_machine,
.timer = &omap_timer,
.timer = &omap2_timer,
MACHINE_END

View File

@ -599,5 +599,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
.init_early = omap3_beagle_init_early,
.init_irq = omap3_beagle_init_irq,
.init_machine = omap3_beagle_init,
.timer = &omap_timer,
.timer = &omap3_secure_timer,
MACHINE_END

View File

@ -742,5 +742,5 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
.init_early = omap3_evm_init_early,
.init_irq = omap3_init_irq,
.init_machine = omap3_evm_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -217,7 +217,7 @@ MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
.init_early = omap3logic_init_early,
.init_irq = omap3_init_irq,
.init_machine = omap3logic_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END
MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
@ -226,5 +226,5 @@ MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
.init_early = omap3logic_init_early,
.init_irq = omap3_init_irq,
.init_machine = omap3logic_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -644,5 +644,5 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
.init_early = omap3pandora_init_early,
.init_irq = omap3_init_irq,
.init_machine = omap3pandora_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -560,5 +560,5 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
.init_early = omap3_stalker_init_early,
.init_irq = omap3_stalker_init_irq,
.init_machine = omap3_stalker_init,
.timer = &omap_timer,
.timer = &omap3_secure_timer,
MACHINE_END

View File

@ -449,5 +449,5 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
.init_early = omap3_touchbook_init_early,
.init_irq = omap3_touchbook_init_irq,
.init_machine = omap3_touchbook_init,
.timer = &omap_timer,
.timer = &omap3_secure_timer,
MACHINE_END

View File

@ -716,5 +716,5 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
.init_early = omap4_panda_init_early,
.init_irq = gic_init_irq,
.init_machine = omap4_panda_init,
.timer = &omap_timer,
.timer = &omap4_timer,
MACHINE_END

View File

@ -617,5 +617,5 @@ MACHINE_START(OVERO, "Gumstix Overo")
.init_early = overo_init_early,
.init_irq = omap3_init_irq,
.init_machine = overo_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -165,5 +165,5 @@ MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
.init_early = rm680_init_early,
.init_irq = omap3_init_irq,
.init_machine = rm680_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -162,5 +162,5 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
.init_early = rx51_init_early,
.init_irq = omap3_init_irq,
.init_machine = rx51_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -52,6 +52,6 @@ MACHINE_START(TI8168EVM, "ti8168evm")
.map_io = ti8168_evm_map_io,
.init_early = ti8168_init_early,
.init_irq = ti816x_init_irq,
.timer = &omap_timer,
.timer = &omap3_timer,
.init_machine = ti8168_evm_init,
MACHINE_END

View File

@ -139,7 +139,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
.init_early = omap_zoom_init_early,
.init_irq = omap3_init_irq,
.init_machine = omap_zoom_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END
MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
@ -149,5 +149,5 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
.init_early = omap_zoom_init_early,
.init_irq = omap3_init_irq,
.init_machine = omap_zoom_init,
.timer = &omap_timer,
.timer = &omap3_timer,
MACHINE_END

View File

@ -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

View File

@ -34,7 +34,11 @@
struct sys_timer;
extern void omap_map_common_io(void);
extern struct sys_timer omap_timer;
extern struct sys_timer omap1_timer;
extern struct sys_timer omap2_timer;
extern struct sys_timer omap3_timer;
extern struct sys_timer omap3_secure_timer;
extern struct sys_timer omap4_timer;
extern bool omap_32k_timer_init(void);
extern int __init omap_init_clocksource_32k(void);
extern unsigned long long notrace omap_32k_sched_clock(void);

View File

@ -57,7 +57,6 @@
#define OMAP_TIMER_IP_VERSION_1 0x1
struct omap_dm_timer;
extern struct omap_dm_timer *gptimer_wakeup;
extern struct sys_timer omap_timer;
struct clk;
int omap_dm_timer_init(void);