summaryrefslogtreecommitdiff
path: root/arch/sandbox
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-05-22 11:05:23 (GMT)
committerTom Rini <trini@konsulko.com>2017-06-05 18:13:04 (GMT)
commitc87dc38d8f860710f5f624d9dae6cefded285b8d (patch)
treee109a9299c541839a03867320941ae098f9c7975 /arch/sandbox
parent9fb34b01f7757ed772b77dd90e463c6e7499fef8 (diff)
downloadu-boot-fsl-qoriq-c87dc38d8f860710f5f624d9dae6cefded285b8d.tar.xz
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.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index 3fe99b8..eefed2e 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;
+}