From c87dc38d8f860710f5f624d9dae6cefded285b8d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 22 May 2017 05:05:23 -0600 Subject: bootstage: Require timer_get_boot_us() to be defined At present we provide a default version of this function for use by bootstage. However it uses the system timer and therefore likely requires driver model. This makes it impossible to time driver-model init. Drop the function and require boards to provide their own. Add a sandbox version also. There is a default implememtation in lib/time.c for boards which use CONFIG_SYS_TIMER_COUNTER. Signed-off-by: Simon Glass --- arch/sandbox/cpu/cpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'arch/sandbox') diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 3fe99b853d5..eefed2ebd96 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -139,3 +139,14 @@ done: return 0; } + +ulong timer_get_boot_us(void) +{ + static uint64_t base_count; + uint64_t count = os_get_nsec(); + + if (!base_count) + base_count = count; + + return (count - base_count) / 1000; +} -- cgit v1.2.3