diff options
author | Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> | 2013-12-16 15:07:37 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-01-15 17:38:58 -0500 |
commit | 85611e3febe78955a519f5f9eb47b941525c8c76 (patch) | |
tree | 86195f07a8e4afd24501a93c11b64c7122265d01 /arch/x86/platform | |
parent | ecd6910db979bc40ac19f0e71e027132fc906068 (diff) |
x86, intel-mid: Add Clovertrail platform support
This patch adds Clovertrail support on intel-mid and makes it more
flexible to support other SoCs.
Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Link: http://lkml.kernel.org/r/1387224459-25746-3-git-send-email-david.a.cohen@linux.intel.com
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Fei Yang <fei.yang@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/platform')
-rw-r--r-- | arch/x86/platform/intel-mid/intel-mid.c | 39 | ||||
-rw-r--r-- | arch/x86/platform/intel-mid/intel_mid_weak_decls.h | 7 | ||||
-rw-r--r-- | arch/x86/platform/intel-mid/mfld.c | 32 |
3 files changed, 69 insertions, 9 deletions
diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c index 527d6d50643d..40955841bb32 100644 --- a/arch/x86/platform/intel-mid/intel-mid.c +++ b/arch/x86/platform/intel-mid/intel-mid.c | |||
@@ -60,14 +60,27 @@ | |||
60 | 60 | ||
61 | enum intel_mid_timer_options intel_mid_timer_options; | 61 | enum intel_mid_timer_options intel_mid_timer_options; |
62 | 62 | ||
63 | /* intel_mid_ops to store sub arch ops */ | ||
64 | struct intel_mid_ops *intel_mid_ops; | ||
65 | /* getter function for sub arch ops*/ | ||
66 | static void *(*get_intel_mid_ops[])(void) = INTEL_MID_OPS_INIT; | ||
63 | enum intel_mid_cpu_type __intel_mid_cpu_chip; | 67 | enum intel_mid_cpu_type __intel_mid_cpu_chip; |
64 | EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip); | 68 | EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip); |
65 | 69 | ||
70 | static void intel_mid_power_off(void) | ||
71 | { | ||
72 | }; | ||
73 | |||
66 | static void intel_mid_reboot(void) | 74 | static void intel_mid_reboot(void) |
67 | { | 75 | { |
68 | intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0); | 76 | intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0); |
69 | } | 77 | } |
70 | 78 | ||
79 | static unsigned long __init intel_mid_calibrate_tsc(void) | ||
80 | { | ||
81 | return 0; | ||
82 | } | ||
83 | |||
71 | static void __init intel_mid_time_init(void) | 84 | static void __init intel_mid_time_init(void) |
72 | { | 85 | { |
73 | sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr); | 86 | sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr); |
@@ -92,13 +105,33 @@ static void __init intel_mid_time_init(void) | |||
92 | 105 | ||
93 | static void intel_mid_arch_setup(void) | 106 | static void intel_mid_arch_setup(void) |
94 | { | 107 | { |
95 | if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27) | 108 | if (boot_cpu_data.x86 != 6) { |
96 | __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL; | ||
97 | else { | ||
98 | pr_err("Unknown Intel MID CPU (%d:%d), default to Penwell\n", | 109 | pr_err("Unknown Intel MID CPU (%d:%d), default to Penwell\n", |
99 | boot_cpu_data.x86, boot_cpu_data.x86_model); | 110 | boot_cpu_data.x86, boot_cpu_data.x86_model); |
100 | __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL; | 111 | __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL; |
112 | goto out; | ||
113 | } | ||
114 | |||
115 | switch (boot_cpu_data.x86_model) { | ||
116 | case 0x35: | ||
117 | __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_CLOVERVIEW; | ||
118 | break; | ||
119 | case 0x27: | ||
120 | default: | ||
121 | __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL; | ||
122 | break; | ||
101 | } | 123 | } |
124 | |||
125 | if (__intel_mid_cpu_chip < MAX_CPU_OPS(get_intel_mid_ops)) | ||
126 | intel_mid_ops = get_intel_mid_ops[__intel_mid_cpu_chip](); | ||
127 | else { | ||
128 | intel_mid_ops = get_intel_mid_ops[INTEL_MID_CPU_CHIP_PENWELL](); | ||
129 | pr_info("ARCH: Uknown SoC, assuming PENWELL!\n"); | ||
130 | } | ||
131 | |||
132 | out: | ||
133 | if (intel_mid_ops->arch_setup) | ||
134 | intel_mid_ops->arch_setup(); | ||
102 | } | 135 | } |
103 | 136 | ||
104 | /* MID systems don't have i8042 controller */ | 137 | /* MID systems don't have i8042 controller */ |
diff --git a/arch/x86/platform/intel-mid/intel_mid_weak_decls.h b/arch/x86/platform/intel-mid/intel_mid_weak_decls.h index 519beb75ba4c..9ebce0447edf 100644 --- a/arch/x86/platform/intel-mid/intel_mid_weak_decls.h +++ b/arch/x86/platform/intel-mid/intel_mid_weak_decls.h | |||
@@ -11,5 +11,8 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | /* __attribute__((weak)) makes these declarations overridable */ | 13 | /* __attribute__((weak)) makes these declarations overridable */ |
14 | extern void intel_mid_power_off(void) __attribute__((weak)); | 14 | /* For every CPU addition a new get_<cpuname>_ops interface needs |
15 | extern unsigned long __init intel_mid_calibrate_tsc(void) __attribute__((weak)); | 15 | * to be added. |
16 | */ | ||
17 | extern void * __cpuinit get_penwell_ops(void) __attribute__((weak)); | ||
18 | extern void * __cpuinit get_cloverview_ops(void) __attribute__((weak)); | ||
diff --git a/arch/x86/platform/intel-mid/mfld.c b/arch/x86/platform/intel-mid/mfld.c index c7ff83c4576d..4f7884eebc14 100644 --- a/arch/x86/platform/intel-mid/mfld.c +++ b/arch/x86/platform/intel-mid/mfld.c | |||
@@ -15,11 +15,19 @@ | |||
15 | #include <asm/intel-mid.h> | 15 | #include <asm/intel-mid.h> |
16 | #include <asm/intel_mid_vrtc.h> | 16 | #include <asm/intel_mid_vrtc.h> |
17 | 17 | ||
18 | void intel_mid_power_off(void) | 18 | #include "intel_mid_weak_decls.h" |
19 | |||
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, | ||
24 | }; | ||
25 | |||
26 | static void mfld_power_off(void) | ||
19 | { | 27 | { |
20 | } | 28 | } |
21 | 29 | ||
22 | unsigned long __init intel_mid_calibrate_tsc(void) | 30 | static unsigned long __init mfld_calibrate_tsc(void) |
23 | { | 31 | { |
24 | unsigned long fast_calibrate; | 32 | unsigned long fast_calibrate; |
25 | u32 lo, hi, ratio, fsb; | 33 | u32 lo, hi, ratio, fsb; |
@@ -35,9 +43,9 @@ unsigned long __init intel_mid_calibrate_tsc(void) | |||
35 | } | 43 | } |
36 | rdmsr(MSR_FSB_FREQ, lo, hi); | 44 | rdmsr(MSR_FSB_FREQ, lo, hi); |
37 | if ((lo & 0x7) == 0x7) | 45 | if ((lo & 0x7) == 0x7) |
38 | fsb = PENWELL_FSB_FREQ_83SKU; | 46 | fsb = FSB_FREQ_83SKU; |
39 | else | 47 | else |
40 | fsb = PENWELL_FSB_FREQ_100SKU; | 48 | fsb = FSB_FREQ_100SKU; |
41 | fast_calibrate = ratio * fsb; | 49 | fast_calibrate = ratio * fsb; |
42 | pr_debug("read penwell tsc %lu khz\n", fast_calibrate); | 50 | pr_debug("read penwell tsc %lu khz\n", fast_calibrate); |
43 | lapic_timer_frequency = fsb * 1000 / HZ; | 51 | lapic_timer_frequency = fsb * 1000 / HZ; |
@@ -49,3 +57,19 @@ unsigned long __init intel_mid_calibrate_tsc(void) | |||
49 | 57 | ||
50 | return 0; | 58 | return 0; |
51 | } | 59 | } |
60 | |||
61 | static void __init penwell_arch_setup() | ||
62 | { | ||
63 | x86_platform.calibrate_tsc = mfld_calibrate_tsc; | ||
64 | pm_power_off = mfld_power_off; | ||
65 | } | ||
66 | |||
67 | void * __cpuinit get_penwell_ops() | ||
68 | { | ||
69 | return &penwell_ops; | ||
70 | } | ||
71 | |||
72 | void * __cpuinit get_cloverview_ops() | ||
73 | { | ||
74 | return &penwell_ops; | ||
75 | } | ||