x86: timer: Set up the timer in timer_early_get_count()
authorSimon Glass <sjg@chromium.org>
Mon, 21 Oct 2019 03:31:54 +0000 (21:31 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Sat, 2 Nov 2019 23:20:27 +0000 (07:20 +0800)
This function can be called before the timer is set up. Make sure that the
init function is called so that it works correctly.

This is needed so that bootstage can work correctly in TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/timer/tsc_timer.c

index 919caba8a14ecb6776fb751549ece663c7f071ca..f19d2237e4f33818079592e1f27648aebd240b6e 100644 (file)
@@ -461,6 +461,8 @@ unsigned long notrace timer_early_get_rate(void)
 
 u64 notrace timer_early_get_count(void)
 {
+       tsc_timer_ensure_setup(true);
+
        return rdtsc() - gd->arch.tsc_base;
 }