diff options
author | David Cohen <david.a.cohen@linux.intel.com> | 2013-12-16 15:07:36 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-01-15 17:38:58 -0500 |
commit | ecd6910db979bc40ac19f0e71e027132fc906068 (patch) | |
tree | 3e1ddd039bb730b0adfa9686fd5dbcf59aebc268 /arch/x86/platform | |
parent | 7e22e91102c6b9df7c4ae2168910e19d2bb14cd6 (diff) |
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>
Diffstat (limited to 'arch/x86/platform')
-rw-r--r-- | arch/x86/platform/intel-mid/Makefile | 4 | ||||
-rw-r--r-- | arch/x86/platform/intel-mid/intel-mid.c | 37 | ||||
-rw-r--r-- | arch/x86/platform/intel-mid/intel_mid_weak_decls.h | 15 | ||||
-rw-r--r-- | arch/x86/platform/intel-mid/mfld.c | 51 |
4 files changed, 70 insertions, 37 deletions
diff --git a/arch/x86/platform/intel-mid/Makefile b/arch/x86/platform/intel-mid/Makefile index 01cc29ea5ff7..78a14ba0e0db 100644 --- a/arch/x86/platform/intel-mid/Makefile +++ b/arch/x86/platform/intel-mid/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o | 1 | obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o intel_mid_vrtc.o mfld.o |
2 | obj-$(CONFIG_X86_INTEL_MID) += intel_mid_vrtc.o | ||
3 | obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_intel_mid.o | 2 | obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_intel_mid.o |
3 | |||
4 | # SFI specific code | 4 | # SFI specific code |
5 | ifdef CONFIG_X86_INTEL_MID | 5 | ifdef CONFIG_X86_INTEL_MID |
6 | obj-$(CONFIG_SFI) += sfi.o device_libs/ | 6 | obj-$(CONFIG_SFI) += sfi.o device_libs/ |
diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c index f90e290f689f..527d6d50643d 100644 --- a/arch/x86/platform/intel-mid/intel-mid.c +++ b/arch/x86/platform/intel-mid/intel-mid.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include <asm/apb_timer.h> | 35 | #include <asm/apb_timer.h> |
36 | #include <asm/reboot.h> | 36 | #include <asm/reboot.h> |
37 | 37 | ||
38 | #include "intel_mid_weak_decls.h" | ||
39 | |||
38 | /* | 40 | /* |
39 | * the clockevent devices on Moorestown/Medfield can be APBT or LAPIC clock, | 41 | * the clockevent devices on Moorestown/Medfield can be APBT or LAPIC clock, |
40 | * cmdline option x86_intel_mid_timer can be used to override the configuration | 42 | * cmdline option x86_intel_mid_timer can be used to override the configuration |
@@ -61,46 +63,11 @@ enum intel_mid_timer_options intel_mid_timer_options; | |||
61 | enum intel_mid_cpu_type __intel_mid_cpu_chip; | 63 | enum intel_mid_cpu_type __intel_mid_cpu_chip; |
62 | EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip); | 64 | EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip); |
63 | 65 | ||
64 | static void intel_mid_power_off(void) | ||
65 | { | ||
66 | } | ||
67 | |||
68 | static void intel_mid_reboot(void) | 66 | static void intel_mid_reboot(void) |
69 | { | 67 | { |
70 | intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0); | 68 | intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0); |
71 | } | 69 | } |
72 | 70 | ||
73 | static unsigned long __init intel_mid_calibrate_tsc(void) | ||
74 | { | ||
75 | unsigned long fast_calibrate; | ||
76 | u32 lo, hi, ratio, fsb; | ||
77 | |||
78 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); | ||
79 | pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi); | ||
80 | ratio = (hi >> 8) & 0x1f; | ||
81 | pr_debug("ratio is %d\n", ratio); | ||
82 | if (!ratio) { | ||
83 | pr_err("read a zero ratio, should be incorrect!\n"); | ||
84 | pr_err("force tsc ratio to 16 ...\n"); | ||
85 | ratio = 16; | ||
86 | } | ||
87 | rdmsr(MSR_FSB_FREQ, lo, hi); | ||
88 | if ((lo & 0x7) == 0x7) | ||
89 | fsb = PENWELL_FSB_FREQ_83SKU; | ||
90 | else | ||
91 | fsb = PENWELL_FSB_FREQ_100SKU; | ||
92 | fast_calibrate = ratio * fsb; | ||
93 | pr_debug("read penwell tsc %lu khz\n", fast_calibrate); | ||
94 | lapic_timer_frequency = fsb * 1000 / HZ; | ||
95 | /* mark tsc clocksource as reliable */ | ||
96 | set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE); | ||
97 | |||
98 | if (fast_calibrate) | ||
99 | return fast_calibrate; | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static void __init intel_mid_time_init(void) | 71 | static void __init intel_mid_time_init(void) |
105 | { | 72 | { |
106 | sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr); | 73 | sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr); |
diff --git a/arch/x86/platform/intel-mid/intel_mid_weak_decls.h b/arch/x86/platform/intel-mid/intel_mid_weak_decls.h new file mode 100644 index 000000000000..519beb75ba4c --- /dev/null +++ b/arch/x86/platform/intel-mid/intel_mid_weak_decls.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | * intel_mid_weak_decls.h: Weak declarations of intel-mid.c | ||
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 | |||
12 | |||
13 | /* __attribute__((weak)) makes these declarations overridable */ | ||
14 | extern void intel_mid_power_off(void) __attribute__((weak)); | ||
15 | extern unsigned long __init intel_mid_calibrate_tsc(void) __attribute__((weak)); | ||
diff --git a/arch/x86/platform/intel-mid/mfld.c b/arch/x86/platform/intel-mid/mfld.c new file mode 100644 index 000000000000..c7ff83c4576d --- /dev/null +++ b/arch/x86/platform/intel-mid/mfld.c | |||
@@ -0,0 +1,51 @@ | |||
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 | |||
12 | #include <linux/init.h> | ||
13 | |||
14 | #include <asm/apic.h> | ||
15 | #include <asm/intel-mid.h> | ||
16 | #include <asm/intel_mid_vrtc.h> | ||
17 | |||
18 | void intel_mid_power_off(void) | ||
19 | { | ||
20 | } | ||
21 | |||
22 | unsigned long __init intel_mid_calibrate_tsc(void) | ||
23 | { | ||
24 | unsigned long fast_calibrate; | ||
25 | u32 lo, hi, ratio, fsb; | ||
26 | |||
27 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); | ||
28 | pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi); | ||
29 | ratio = (hi >> 8) & 0x1f; | ||
30 | pr_debug("ratio is %d\n", ratio); | ||
31 | if (!ratio) { | ||
32 | pr_err("read a zero ratio, should be incorrect!\n"); | ||
33 | pr_err("force tsc ratio to 16 ...\n"); | ||
34 | ratio = 16; | ||
35 | } | ||
36 | rdmsr(MSR_FSB_FREQ, lo, hi); | ||
37 | if ((lo & 0x7) == 0x7) | ||
38 | fsb = PENWELL_FSB_FREQ_83SKU; | ||
39 | else | ||
40 | fsb = PENWELL_FSB_FREQ_100SKU; | ||
41 | fast_calibrate = ratio * fsb; | ||
42 | pr_debug("read penwell tsc %lu khz\n", fast_calibrate); | ||
43 | lapic_timer_frequency = fsb * 1000 / HZ; | ||
44 | /* mark tsc clocksource as reliable */ | ||
45 | set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE); | ||
46 | |||
47 | if (fast_calibrate) | ||
48 | return fast_calibrate; | ||
49 | |||
50 | return 0; | ||
51 | } | ||