diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2018-10-13 20:52:10 -0700 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2018-10-22 17:51:45 +0800 |
commit | 6ce383640cf09d0fff9d6bddccf81dd37b2f344f (patch) | |
tree | af621a8b5056f42d34c2af4adbd16ca666cc7861 /drivers/timer/tsc_timer.c | |
parent | 49d5ff439c9ddc0ac124ea117fd33b194dca3142 (diff) |
x86: tsc: Introduce config option for early timer frequency
So far the TSC timer driver supports trying hardware calibration first
and using device tree as last resort for its running frequency as the
normal timer.
However when it is used as the early timer, it only supports hardware
calibration and if it fails, the driver just panics. This introduces
a new config option to specify the early timer frequency in MHz and
it should be equal to the value described in the device tree.
Without this patch, the travis-ci testing on QEMU x86_64 target fails
each time after it finishes the 'bootefi selftest' as the test.py see
an error was emitted on the console like this:
TSC frequency is ZERO
resetting ...
### ERROR ### Please RESET the board ###
It's strange that this error is consistently seen on the travis-ci
machine, but only occasionally seen on my local machine (maybe 1 out
of 10). Since QEMU x86_64 target enables BOOTSTAGE support which uses
early timer, with this fix it should work without any failure.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/timer/tsc_timer.c')
-rw-r--r-- | drivers/timer/tsc_timer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c index 6473de20f1..da7c812908 100644 --- a/drivers/timer/tsc_timer.c +++ b/drivers/timer/tsc_timer.c @@ -341,7 +341,7 @@ static int tsc_timer_get_count(struct udevice *dev, u64 *count) return 0; } -static void tsc_timer_ensure_setup(bool stop) +static void tsc_timer_ensure_setup(bool early) { if (gd->arch.tsc_base) return; @@ -362,8 +362,8 @@ static void tsc_timer_ensure_setup(bool stop) if (fast_calibrate) goto done; - if (stop) - panic("TSC frequency is ZERO"); + if (early) + fast_calibrate = CONFIG_X86_TSC_TIMER_EARLY_FREQ; else return; |