summaryrefslogtreecommitdiff
path: root/src/soc/intel/baytrail/tsc_freq.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel/baytrail/tsc_freq.c')
-rw-r--r--src/soc/intel/baytrail/tsc_freq.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/soc/intel/baytrail/tsc_freq.c b/src/soc/intel/baytrail/tsc_freq.c
index 0cf7273b74..e4327318da 100644
--- a/src/soc/intel/baytrail/tsc_freq.c
+++ b/src/soc/intel/baytrail/tsc_freq.c
@@ -27,14 +27,29 @@
#include <baytrail/romstage.h>
#endif
-
-#define BCLK 100 /* 100 MHz */
unsigned long tsc_freq_mhz(void)
{
msr_t platform_info;
+ msr_t clk_info;
+ unsigned long bclk_khz;
platform_info = rdmsr(MSR_PLATFORM_INFO);
- return BCLK * ((platform_info.lo >> 8) & 0xff);
+ clk_info = rdmsr(MSR_BSEL_CR_OVERCLOCK_CONTROL);
+ switch (clk_info.lo & 0x3) {
+ case 0:
+ bclk_khz = 83333;
+ break;
+ case 1:
+ bclk_khz = 100000;
+ break;
+ case 2:
+ bclk_khz = 133333;
+ break;
+ case 3:
+ bclk_khz = 116666;
+ break;
+ }
+ return (bclk_khz * ((platform_info.lo >> 8) & 0xff)) / 1000;
}
void set_max_freq(void)