aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>2013-12-16 15:07:37 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2014-01-15 17:38:58 -0500
commit85611e3febe78955a519f5f9eb47b941525c8c76 (patch)
tree86195f07a8e4afd24501a93c11b64c7122265d01
parentecd6910db979bc40ac19f0e71e027132fc906068 (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>
-rw-r--r--arch/x86/include/asm/intel-mid.h46
-rw-r--r--arch/x86/platform/intel-mid/intel-mid.c39
-rw-r--r--arch/x86/platform/intel-mid/intel_mid_weak_decls.h7
-rw-r--r--arch/x86/platform/intel-mid/mfld.c32
4 files changed, 113 insertions, 11 deletions
diff --git a/arch/x86/include/asm/intel-mid.h b/arch/x86/include/asm/intel-mid.h
index 459769d39263..f8a831431fe0 100644
--- a/arch/x86/include/asm/intel-mid.h
+++ b/arch/x86/include/asm/intel-mid.h
@@ -51,10 +51,39 @@ struct devs_id {
51enum intel_mid_cpu_type { 51enum intel_mid_cpu_type {
52 /* 1 was Moorestown */ 52 /* 1 was Moorestown */
53 INTEL_MID_CPU_CHIP_PENWELL = 2, 53 INTEL_MID_CPU_CHIP_PENWELL = 2,
54 INTEL_MID_CPU_CHIP_CLOVERVIEW,
54}; 55};
55 56
56extern enum intel_mid_cpu_type __intel_mid_cpu_chip; 57extern enum intel_mid_cpu_type __intel_mid_cpu_chip;
57 58
59/**
60 * struct intel_mid_ops - Interface between intel-mid & sub archs
61 * @arch_setup: arch_setup function to re-initialize platform
62 * structures (x86_init, x86_platform_init)
63 *
64 * This structure can be extended if any new interface is required
65 * between intel-mid & its sub arch files.
66 */
67struct intel_mid_ops {
68 void (*arch_setup)(void);
69};
70
71/* Helper API's for INTEL_MID_OPS_INIT */
72#define DECLARE_INTEL_MID_OPS_INIT(cpuname, cpuid) \
73 [cpuid] = get_##cpuname##_ops
74
75/* Maximum number of CPU ops */
76#define MAX_CPU_OPS(a) (sizeof(a)/sizeof(void *))
77
78/*
79 * For every new cpu addition, a weak get_<cpuname>_ops() function needs be
80 * declared in arch/x86/platform/intel_mid/intel_mid_weak_decls.h.
81 */
82#define INTEL_MID_OPS_INIT {\
83 DECLARE_INTEL_MID_OPS_INIT(penwell, INTEL_MID_CPU_CHIP_PENWELL), \
84 DECLARE_INTEL_MID_OPS_INIT(cloverview, INTEL_MID_CPU_CHIP_CLOVERVIEW), \
85};
86
58#ifdef CONFIG_X86_INTEL_MID 87#ifdef CONFIG_X86_INTEL_MID
59 88
60static inline enum intel_mid_cpu_type intel_mid_identify_cpu(void) 89static inline enum intel_mid_cpu_type intel_mid_identify_cpu(void)
@@ -86,8 +115,21 @@ extern enum intel_mid_timer_options intel_mid_timer_options;
86 * Penwell uses spread spectrum clock, so the freq number is not exactly 115 * Penwell uses spread spectrum clock, so the freq number is not exactly
87 * the same as reported by MSR based on SDM. 116 * the same as reported by MSR based on SDM.
88 */ 117 */
89#define PENWELL_FSB_FREQ_83SKU 83200 118#define FSB_FREQ_83SKU 83200
90#define PENWELL_FSB_FREQ_100SKU 99840 119#define FSB_FREQ_100SKU 99840
120#define FSB_FREQ_133SKU 133000
121
122#define FSB_FREQ_167SKU 167000
123#define FSB_FREQ_200SKU 200000
124#define FSB_FREQ_267SKU 267000
125#define FSB_FREQ_333SKU 333000
126#define FSB_FREQ_400SKU 400000
127
128/* Bus Select SoC Fuse value */
129#define BSEL_SOC_FUSE_MASK 0x7
130#define BSEL_SOC_FUSE_001 0x1 /* FSB 133MHz */
131#define BSEL_SOC_FUSE_101 0x5 /* FSB 100MHz */
132#define BSEL_SOC_FUSE_111 0x7 /* FSB 83MHz */
91 133
92#define SFI_MTMR_MAX_NUM 8 134#define SFI_MTMR_MAX_NUM 8
93#define SFI_MRTC_MAX 8 135#define SFI_MRTC_MAX 8
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
61enum intel_mid_timer_options intel_mid_timer_options; 61enum intel_mid_timer_options intel_mid_timer_options;
62 62
63/* intel_mid_ops to store sub arch ops */
64struct intel_mid_ops *intel_mid_ops;
65/* getter function for sub arch ops*/
66static void *(*get_intel_mid_ops[])(void) = INTEL_MID_OPS_INIT;
63enum intel_mid_cpu_type __intel_mid_cpu_chip; 67enum intel_mid_cpu_type __intel_mid_cpu_chip;
64EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip); 68EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip);
65 69
70static void intel_mid_power_off(void)
71{
72};
73
66static void intel_mid_reboot(void) 74static 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
79static unsigned long __init intel_mid_calibrate_tsc(void)
80{
81 return 0;
82}
83
71static void __init intel_mid_time_init(void) 84static 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
93static void intel_mid_arch_setup(void) 106static 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
132out:
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 */
14extern void intel_mid_power_off(void) __attribute__((weak)); 14/* For every CPU addition a new get_<cpuname>_ops interface needs
15extern unsigned long __init intel_mid_calibrate_tsc(void) __attribute__((weak)); 15 * to be added.
16 */
17extern void * __cpuinit get_penwell_ops(void) __attribute__((weak));
18extern 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
18void intel_mid_power_off(void) 18#include "intel_mid_weak_decls.h"
19
20static void penwell_arch_setup(void);
21/* penwell arch ops */
22static struct intel_mid_ops penwell_ops = {
23 .arch_setup = penwell_arch_setup,
24};
25
26static void mfld_power_off(void)
19{ 27{
20} 28}
21 29
22unsigned long __init intel_mid_calibrate_tsc(void) 30static 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
61static void __init penwell_arch_setup()
62{
63 x86_platform.calibrate_tsc = mfld_calibrate_tsc;
64 pm_power_off = mfld_power_off;
65}
66
67void * __cpuinit get_penwell_ops()
68{
69 return &penwell_ops;
70}
71
72void * __cpuinit get_cloverview_ops()
73{
74 return &penwell_ops;
75}