Skip to content
Snippets Groups Projects
Commit a478a26c authored by Simon Glass's avatar Simon Glass Committed by Bin Meng
Browse files

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: default avatarSimon Glass <sjg@chromium.org>
Tested-by: default avatarAiden Park <aiden.park@intel.com>
Reviewed-by: default avatarAiden Park <aiden.park@intel.com>
Reviewed-by: default avatarBin Meng <bmeng.cn@gmail.com>
parent 096c71e3
No related branches found
No related tags found
No related merge requests found
......@@ -76,6 +76,7 @@ struct arch_global_data {
uint8_t x86_mask;
uint32_t x86_device;
uint64_t tsc_base; /* Initial value returned by rdtsc() */
bool tsc_inited; /* true if tsc is ready for use */
unsigned long clock_rate; /* Clock rate of timer in Hz */
void *new_fdt; /* Relocated FDT */
uint32_t bist; /* Built-in self test value */
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment