-
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: Add Merrifield platform support
This code was partially based on Mark Brown's previous work. Signed-off-by: David Cohen <david.a.cohen@linux.intel.com> Link: http://lkml.kernel.org/r/1387224459-25746-4-git-send-email-david.a.cohen@linux.intel.com Signed-off-by: Fei Yang <fei.yang@intel.com> Cc: Mark F. Brown <mark.f.brown@intel.com> Cc: 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
85611e3
commit bc20aa4
Showing
7 changed files
with
144 additions
and
8 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
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,103 @@ | ||
/* | ||
* mrfl.c: Intel Merrifield platform specific 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 "intel_mid_weak_decls.h" | ||
|
||
static unsigned long __init tangier_calibrate_tsc(void) | ||
{ | ||
unsigned long fast_calibrate; | ||
u32 lo, hi, ratio, fsb, bus_freq; | ||
|
||
/* *********************** */ | ||
/* Compute TSC:Ratio * FSB */ | ||
/* *********************** */ | ||
|
||
/* Compute Ratio */ | ||
rdmsr(MSR_PLATFORM_INFO, lo, hi); | ||
pr_debug("IA32 PLATFORM_INFO is 0x%x : %x\n", hi, lo); | ||
|
||
ratio = (lo >> 8) & 0xFF; | ||
pr_debug("ratio is %d\n", ratio); | ||
if (!ratio) { | ||
pr_err("Read a zero ratio, force tsc ratio to 4 ...\n"); | ||
ratio = 4; | ||
} | ||
|
||
/* Compute FSB */ | ||
rdmsr(MSR_FSB_FREQ, lo, hi); | ||
pr_debug("Actual FSB frequency detected by SOC 0x%x : %x\n", | ||
hi, lo); | ||
|
||
bus_freq = lo & 0x7; | ||
pr_debug("bus_freq = 0x%x\n", bus_freq); | ||
|
||
if (bus_freq == 0) | ||
fsb = FSB_FREQ_100SKU; | ||
else if (bus_freq == 1) | ||
fsb = FSB_FREQ_100SKU; | ||
else if (bus_freq == 2) | ||
fsb = FSB_FREQ_133SKU; | ||
else if (bus_freq == 3) | ||
fsb = FSB_FREQ_167SKU; | ||
else if (bus_freq == 4) | ||
fsb = FSB_FREQ_83SKU; | ||
else if (bus_freq == 5) | ||
fsb = FSB_FREQ_400SKU; | ||
else if (bus_freq == 6) | ||
fsb = FSB_FREQ_267SKU; | ||
else if (bus_freq == 7) | ||
fsb = FSB_FREQ_333SKU; | ||
else { | ||
BUG(); | ||
pr_err("Invalid bus_freq! Setting to minimal value!\n"); | ||
fsb = FSB_FREQ_100SKU; | ||
} | ||
|
||
/* TSC = FSB Freq * Resolved HFM Ratio */ | ||
fast_calibrate = ratio * fsb; | ||
pr_debug("calculate tangier tsc %lu KHz\n", fast_calibrate); | ||
|
||
/* ************************************ */ | ||
/* Calculate Local APIC Timer Frequency */ | ||
/* ************************************ */ | ||
lapic_timer_frequency = (fsb * 1000) / HZ; | ||
|
||
pr_debug("Setting lapic_timer_frequency = %d\n", | ||
lapic_timer_frequency); | ||
|
||
/* mark tsc clocksource as reliable */ | ||
set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE); | ||
|
||
if (fast_calibrate) | ||
return fast_calibrate; | ||
|
||
return 0; | ||
} | ||
|
||
static void __init tangier_arch_setup(void) | ||
{ | ||
x86_platform.calibrate_tsc = tangier_calibrate_tsc; | ||
} | ||
|
||
/* tangier arch ops */ | ||
static struct intel_mid_ops tangier_ops = { | ||
.arch_setup = tangier_arch_setup, | ||
}; | ||
|
||
void * __cpuinit get_tangier_ops() | ||
{ | ||
return &tangier_ops; | ||
} |
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