mfld.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * mfld.c: Intel Medfield platform setup code
  3. *
  4. * (C) Copyright 2013 Intel Corporation
  5. *
  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
  9. * of the License.
  10. */
  11. #include <linux/init.h>
  12. #include <asm/apic.h>
  13. #include <asm/intel-mid.h>
  14. #include <asm/intel_mid_vrtc.h>
  15. #include "intel_mid_weak_decls.h"
  16. static unsigned long __init mfld_calibrate_tsc(void)
  17. {
  18. unsigned long fast_calibrate;
  19. u32 lo, hi, ratio, fsb;
  20. rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
  21. pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi);
  22. ratio = (hi >> 8) & 0x1f;
  23. pr_debug("ratio is %d\n", ratio);
  24. if (!ratio) {
  25. pr_err("read a zero ratio, should be incorrect!\n");
  26. pr_err("force tsc ratio to 16 ...\n");
  27. ratio = 16;
  28. }
  29. rdmsr(MSR_FSB_FREQ, lo, hi);
  30. if ((lo & 0x7) == 0x7)
  31. fsb = FSB_FREQ_83SKU;
  32. else
  33. fsb = FSB_FREQ_100SKU;
  34. fast_calibrate = ratio * fsb;
  35. pr_debug("read penwell tsc %lu khz\n", fast_calibrate);
  36. lapic_timer_frequency = fsb * 1000 / HZ;
  37. /*
  38. * TSC on Intel Atom SoCs is reliable and of known frequency.
  39. * See tsc_msr.c for details.
  40. */
  41. setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
  42. setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE);
  43. return fast_calibrate;
  44. }
  45. static void __init penwell_arch_setup(void)
  46. {
  47. x86_platform.calibrate_tsc = mfld_calibrate_tsc;
  48. }
  49. static struct intel_mid_ops penwell_ops = {
  50. .arch_setup = penwell_arch_setup,
  51. };
  52. void *get_penwell_ops(void)
  53. {
  54. return &penwell_ops;
  55. }
  56. void *get_cloverview_ops(void)
  57. {
  58. return &penwell_ops;
  59. }