summaryrefslogtreecommitdiff
path: root/drivers/timer
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-10-21 06:37:47 +0300
committerBin Meng <bmeng.cn@gmail.com>2019-11-03 02:20:27 +0300
commita478a26cd00bbe14d51952b9ae3620415fbdf2b2 (patch)
tree1032cb4ead808bfe33fc84ed63fdf4886115eb20 /drivers/timer
parent096c71e34bac7551aa228bbcb9e1c867ad9e5d07 (diff)
downloadu-boot-a478a26cd00bbe14d51952b9ae3620415fbdf2b2.tar.xz
x86: timer: Use a separate flag for whether timer is inited
At present the value of the timer base is used to determine whether the timer has been set up or not. It is true that the timer is essentially never exactly 0 when it is read. However 'time 0' may indicate the time that the machine was reset so it is useful to be able to denote that. Update the code to use a separate flag instead. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Aiden Park <aiden.park@intel.com> Reviewed-by: Aiden Park <aiden.park@intel.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/timer')
-rw-r--r--drivers/timer/tsc_timer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index f19d2237e4..637c8ff25a 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -394,7 +394,7 @@ static int tsc_timer_get_count(struct udevice *dev, u64 *count)
static void tsc_timer_ensure_setup(bool early)
{
- if (gd->arch.tsc_base)
+ if (gd->arch.tsc_inited)
return;
gd->arch.tsc_base = rdtsc();
@@ -425,6 +425,7 @@ static void tsc_timer_ensure_setup(bool early)
done:
gd->arch.clock_rate = fast_calibrate * 1000000;
}
+ gd->arch.tsc_inited = true;
}
static int tsc_timer_probe(struct udevice *dev)