2 * mfld.c: Intel Medfield platform setup code
4 * (C) Copyright 2013 Intel Corporation
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; version 2
12 #include <linux/init.h>
15 #include <asm/intel-mid.h>
16 #include <asm/intel_mid_vrtc.h>
18 #include "intel_mid_weak_decls.h"
20 static void penwell_arch_setup(void);
21 /* penwell arch ops */
22 static struct intel_mid_ops penwell_ops = {
23 .arch_setup = penwell_arch_setup,
26 static void mfld_power_off(void)
30 static unsigned long __init mfld_calibrate_tsc(void)
32 unsigned long fast_calibrate;
33 u32 lo, hi, ratio, fsb;
35 rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
36 pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi);
37 ratio = (hi >> 8) & 0x1f;
38 pr_debug("ratio is %d\n", ratio);
40 pr_err("read a zero ratio, should be incorrect!\n");
41 pr_err("force tsc ratio to 16 ...\n");
44 rdmsr(MSR_FSB_FREQ, lo, hi);
45 if ((lo & 0x7) == 0x7)
48 fsb = FSB_FREQ_100SKU;
49 fast_calibrate = ratio * fsb;
50 pr_debug("read penwell tsc %lu khz\n", fast_calibrate);
51 lapic_timer_frequency = fsb * 1000 / HZ;
54 * TSC on Intel Atom SoCs is reliable and of known frequency.
55 * See tsc_msr.c for details.
57 setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
58 setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE);
60 return fast_calibrate;
63 static void __init penwell_arch_setup(void)
65 x86_platform.calibrate_tsc = mfld_calibrate_tsc;
66 pm_power_off = mfld_power_off;
69 void *get_penwell_ops(void)
74 void *get_cloverview_ops(void)