diff options
author | Simon Glass <sjg@chromium.org> | 2017-05-22 05:05:23 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-06-05 14:13:04 -0400 |
commit | c87dc38d8f860710f5f624d9dae6cefded285b8d (patch) | |
tree | e109a9299c541839a03867320941ae098f9c7975 /arch/sandbox | |
parent | 9fb34b01f7757ed772b77dd90e463c6e7499fef8 (diff) |
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 <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox')
-rw-r--r-- | arch/sandbox/cpu/cpu.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 3fe99b853d..eefed2ebd9 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; +} |