From 44cf870cb08b48dacdd6652baa15dba93fbc6216 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Mon, 8 Dec 2014 13:39:14 -0800 Subject: timer: Reestablish init_timer(), consolidate timer initialization calls We have known for a while that the old x86 model of calling init_timer() in ramstage doesn't make sense on other archs (and is questionable in general), and finally removed it with CL:219719. However, now timer initialization is completely buried in the platform code, and it's hard to ensure it is done in time to set up timestamps. For three out of four non-x86 SoC vendors we have brought up for now, the timers need some kind of SoC-specific initialization. This patch reintroduces init_timer() as a weak function that can be overridden by platform code. The call in ramstage is restricted to x86 (and should probably eventually be removed from there as well), and other archs should call them at the earliest reasonable point in their bootblock. (Only changing arm for now since arm64 and mips bootblocks are still in very early state and should sync up to features in arm once their requirements are better understood.) This allows us to move timestamp_init() into arch code, so that we can rely on timestamps being available at a well-defined point and initialize our base value as early as possible. (Platforms who know that their timers start at zero can still safely call timestamp_init(0) again from platform code.) BRANCH=None BUG=None TEST=Booted Pinky, Blaze and Storm, compiled Daisy and Pit. Change-Id: I1b064ba3831c0c5b7965b1d88a6f4a590789c891 Signed-off-by: Patrick Georgi Original-Commit-Id: ffaebcd3785c4ce998ac1536e9fdd46ce3f52bfa Original-Change-Id: Iece1614b7442d4fa9ca981010e1c8497bdea308d Original-Signed-off-by: Julius Werner Original-Reviewed-on: https://chromium-review.googlesource.com/234062 Original-Reviewed-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/9606 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/soc/rockchip/rk3288/bootblock.c | 2 -- src/soc/rockchip/rk3288/include/soc/timer.h | 2 -- src/soc/rockchip/rk3288/timer.c | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) (limited to 'src/soc/rockchip') diff --git a/src/soc/rockchip/rk3288/bootblock.c b/src/soc/rockchip/rk3288/bootblock.c index 4a5b0d269f..9ea3ec02a4 100644 --- a/src/soc/rockchip/rk3288/bootblock.c +++ b/src/soc/rockchip/rk3288/bootblock.c @@ -29,8 +29,6 @@ static void bootblock_soc_init(void) { - rk3288_init_timer(); - rkclk_init(); mmu_init(); diff --git a/src/soc/rockchip/rk3288/include/soc/timer.h b/src/soc/rockchip/rk3288/include/soc/timer.h index 230168637c..248b150ab5 100644 --- a/src/soc/rockchip/rk3288/include/soc/timer.h +++ b/src/soc/rockchip/rk3288/include/soc/timer.h @@ -40,6 +40,4 @@ static struct rk3288_timer * const timer7_ptr = (void *)TIMER7_BASE; #define TIMER_LOAD_VAL 0xffffffff -void rk3288_init_timer(void); - #endif /* __SOC_ROCKCHIP_RK3288_TIMER_H__ */ diff --git a/src/soc/rockchip/rk3288/timer.c b/src/soc/rockchip/rk3288/timer.c index 47f99c23fd..253d145b44 100644 --- a/src/soc/rockchip/rk3288/timer.c +++ b/src/soc/rockchip/rk3288/timer.c @@ -39,7 +39,7 @@ void timer_monotonic_get(struct mono_time *mt) mono_time_set_usecs(mt, timer_raw_value() / clocks_per_usec); } -void rk3288_init_timer(void) +void init_timer(void) { write32(TIMER_LOAD_VAL, &timer7_ptr->timer_load_count0); write32(TIMER_LOAD_VAL, &timer7_ptr->timer_load_count1); -- cgit v1.2.3