Return the saved TSC frequency in get_tbclk_mhz().
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
uint64_t tsc_base; /* Initial value returned by rdtsc() */
uint32_t tsc_base_kclocks; /* Initial tsc as a kclocks value */
uint32_t tsc_prev; /* For show_boot_progress() */
+ uint32_t tsc_mhz; /* TSC frequency in MHz */
void *new_fdt; /* Relocated FDT */
uint32_t bist; /* Built-in self test value */
};
{
unsigned long fast_calibrate;
+ if (gd->arch.tsc_mhz)
+ return gd->arch.tsc_mhz;
+
fast_calibrate = try_msr_calibrate_tsc();
if (fast_calibrate)
return fast_calibrate;
if (!fast_calibrate)
panic("TSC frequency is ZERO");
+ gd->arch.tsc_mhz = fast_calibrate;
return fast_calibrate;
}