-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x86, intel-mid: Move Medfield code out of intel-mid.c core file
In order make the driver more portable and support other Intel MID (Mobile Internet Device) platforms we need to move Medfield code from intel-mid.c core to its own mfld.c file. This patch contains no functional changes. Signed-off-by: David Cohen <david.a.cohen@linux.intel.com> Link: http://lkml.kernel.org/r/1387224459-25746-2-git-send-email-david.a.cohen@linux.intel.com Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
- Loading branch information
David Cohen
authored and
H. Peter Anvin
committed
Jan 15, 2014
1 parent
7e22e91
commit ecd6910
Showing
4 changed files
with
70 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* intel_mid_weak_decls.h: Weak declarations of intel-mid.c | ||
* | ||
* (C) Copyright 2013 Intel Corporation | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; version 2 | ||
* of the License. | ||
*/ | ||
|
||
|
||
/* __attribute__((weak)) makes these declarations overridable */ | ||
extern void intel_mid_power_off(void) __attribute__((weak)); | ||
extern unsigned long __init intel_mid_calibrate_tsc(void) __attribute__((weak)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* mfld.c: Intel Medfield platform setup code | ||
* | ||
* (C) Copyright 2013 Intel Corporation | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; version 2 | ||
* of the License. | ||
*/ | ||
|
||
#include <linux/init.h> | ||
|
||
#include <asm/apic.h> | ||
#include <asm/intel-mid.h> | ||
#include <asm/intel_mid_vrtc.h> | ||
|
||
void intel_mid_power_off(void) | ||
{ | ||
} | ||
|
||
unsigned long __init intel_mid_calibrate_tsc(void) | ||
{ | ||
unsigned long fast_calibrate; | ||
u32 lo, hi, ratio, fsb; | ||
|
||
rdmsr(MSR_IA32_PERF_STATUS, lo, hi); | ||
pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi); | ||
ratio = (hi >> 8) & 0x1f; | ||
pr_debug("ratio is %d\n", ratio); | ||
if (!ratio) { | ||
pr_err("read a zero ratio, should be incorrect!\n"); | ||
pr_err("force tsc ratio to 16 ...\n"); | ||
ratio = 16; | ||
} | ||
rdmsr(MSR_FSB_FREQ, lo, hi); | ||
if ((lo & 0x7) == 0x7) | ||
fsb = PENWELL_FSB_FREQ_83SKU; | ||
else | ||
fsb = PENWELL_FSB_FREQ_100SKU; | ||
fast_calibrate = ratio * fsb; | ||
pr_debug("read penwell tsc %lu khz\n", fast_calibrate); | ||
lapic_timer_frequency = fsb * 1000 / HZ; | ||
/* mark tsc clocksource as reliable */ | ||
set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE); | ||
|
||
if (fast_calibrate) | ||
return fast_calibrate; | ||
|
||
return 0; | ||
} |