diff options
Diffstat (limited to 'arch/x86/platform/mrst/mrst.c')
-rw-r--r-- | arch/x86/platform/mrst/mrst.c | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index 475e2cd0f3c3..e0a37233c0af 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/notifier.h> | 29 | #include <linux/notifier.h> |
30 | #include <linux/mfd/intel_msic.h> | 30 | #include <linux/mfd/intel_msic.h> |
31 | #include <linux/gpio.h> | ||
32 | #include <linux/i2c/tc35876x.h> | ||
31 | 33 | ||
32 | #include <asm/setup.h> | 34 | #include <asm/setup.h> |
33 | #include <asm/mpspec_def.h> | 35 | #include <asm/mpspec_def.h> |
@@ -78,16 +80,11 @@ int sfi_mrtc_num; | |||
78 | 80 | ||
79 | static void mrst_power_off(void) | 81 | static void mrst_power_off(void) |
80 | { | 82 | { |
81 | if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) | ||
82 | intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 1); | ||
83 | } | 83 | } |
84 | 84 | ||
85 | static void mrst_reboot(void) | 85 | static void mrst_reboot(void) |
86 | { | 86 | { |
87 | if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) | 87 | intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0); |
88 | intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 0); | ||
89 | else | ||
90 | intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0); | ||
91 | } | 88 | } |
92 | 89 | ||
93 | /* parse all the mtimer info to a static mtimer array */ | 90 | /* parse all the mtimer info to a static mtimer array */ |
@@ -200,34 +197,28 @@ int __init sfi_parse_mrtc(struct sfi_table_header *table) | |||
200 | 197 | ||
201 | static unsigned long __init mrst_calibrate_tsc(void) | 198 | static unsigned long __init mrst_calibrate_tsc(void) |
202 | { | 199 | { |
203 | unsigned long flags, fast_calibrate; | 200 | unsigned long fast_calibrate; |
204 | if (__mrst_cpu_chip == MRST_CPU_CHIP_PENWELL) { | 201 | u32 lo, hi, ratio, fsb; |
205 | u32 lo, hi, ratio, fsb; | 202 | |
206 | 203 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); | |
207 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); | 204 | pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi); |
208 | pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi); | 205 | ratio = (hi >> 8) & 0x1f; |
209 | ratio = (hi >> 8) & 0x1f; | 206 | pr_debug("ratio is %d\n", ratio); |
210 | pr_debug("ratio is %d\n", ratio); | 207 | if (!ratio) { |
211 | if (!ratio) { | 208 | pr_err("read a zero ratio, should be incorrect!\n"); |
212 | pr_err("read a zero ratio, should be incorrect!\n"); | 209 | pr_err("force tsc ratio to 16 ...\n"); |
213 | pr_err("force tsc ratio to 16 ...\n"); | 210 | ratio = 16; |
214 | ratio = 16; | ||
215 | } | ||
216 | rdmsr(MSR_FSB_FREQ, lo, hi); | ||
217 | if ((lo & 0x7) == 0x7) | ||
218 | fsb = PENWELL_FSB_FREQ_83SKU; | ||
219 | else | ||
220 | fsb = PENWELL_FSB_FREQ_100SKU; | ||
221 | fast_calibrate = ratio * fsb; | ||
222 | pr_debug("read penwell tsc %lu khz\n", fast_calibrate); | ||
223 | lapic_timer_frequency = fsb * 1000 / HZ; | ||
224 | /* mark tsc clocksource as reliable */ | ||
225 | set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE); | ||
226 | } else { | ||
227 | local_irq_save(flags); | ||
228 | fast_calibrate = apbt_quick_calibrate(); | ||
229 | local_irq_restore(flags); | ||
230 | } | 211 | } |
212 | rdmsr(MSR_FSB_FREQ, lo, hi); | ||
213 | if ((lo & 0x7) == 0x7) | ||
214 | fsb = PENWELL_FSB_FREQ_83SKU; | ||
215 | else | ||
216 | fsb = PENWELL_FSB_FREQ_100SKU; | ||
217 | fast_calibrate = ratio * fsb; | ||
218 | pr_debug("read penwell tsc %lu khz\n", fast_calibrate); | ||
219 | lapic_timer_frequency = fsb * 1000 / HZ; | ||
220 | /* mark tsc clocksource as reliable */ | ||
221 | set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE); | ||
231 | 222 | ||
232 | if (fast_calibrate) | 223 | if (fast_calibrate) |
233 | return fast_calibrate; | 224 | return fast_calibrate; |
@@ -261,16 +252,11 @@ static void __cpuinit mrst_arch_setup(void) | |||
261 | { | 252 | { |
262 | if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27) | 253 | if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27) |
263 | __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL; | 254 | __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL; |
264 | else if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x26) | ||
265 | __mrst_cpu_chip = MRST_CPU_CHIP_LINCROFT; | ||
266 | else { | 255 | else { |
267 | pr_err("Unknown Moorestown CPU (%d:%d), default to Lincroft\n", | 256 | pr_err("Unknown Intel MID CPU (%d:%d), default to Penwell\n", |
268 | boot_cpu_data.x86, boot_cpu_data.x86_model); | 257 | boot_cpu_data.x86, boot_cpu_data.x86_model); |
269 | __mrst_cpu_chip = MRST_CPU_CHIP_LINCROFT; | 258 | __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL; |
270 | } | 259 | } |
271 | pr_debug("Moorestown CPU %s identified\n", | ||
272 | (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) ? | ||
273 | "Lincroft" : "Penwell"); | ||
274 | } | 260 | } |
275 | 261 | ||
276 | /* MID systems don't have i8042 controller */ | 262 | /* MID systems don't have i8042 controller */ |
@@ -686,6 +672,24 @@ static void *msic_ocd_platform_data(void *info) | |||
686 | return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_OCD); | 672 | return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_OCD); |
687 | } | 673 | } |
688 | 674 | ||
675 | static void *msic_thermal_platform_data(void *info) | ||
676 | { | ||
677 | return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_THERMAL); | ||
678 | } | ||
679 | |||
680 | /* tc35876x DSI-LVDS bridge chip and panel platform data */ | ||
681 | static void *tc35876x_platform_data(void *data) | ||
682 | { | ||
683 | static struct tc35876x_platform_data pdata; | ||
684 | |||
685 | /* gpio pins set to -1 will not be used by the driver */ | ||
686 | pdata.gpio_bridge_reset = get_gpio_by_name("LCMB_RXEN"); | ||
687 | pdata.gpio_panel_bl_en = get_gpio_by_name("6S6P_BL_EN"); | ||
688 | pdata.gpio_panel_vadd = get_gpio_by_name("EN_VREG_LCD_V3P3"); | ||
689 | |||
690 | return &pdata; | ||
691 | } | ||
692 | |||
689 | static const struct devs_id __initconst device_ids[] = { | 693 | static const struct devs_id __initconst device_ids[] = { |
690 | {"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data}, | 694 | {"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data}, |
691 | {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, | 695 | {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, |
@@ -698,6 +702,7 @@ static const struct devs_id __initconst device_ids[] = { | |||
698 | {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, | 702 | {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, |
699 | {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, | 703 | {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, |
700 | {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data}, | 704 | {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data}, |
705 | {"i2c_disp_brig", SFI_DEV_TYPE_I2C, 0, &tc35876x_platform_data}, | ||
701 | 706 | ||
702 | /* MSIC subdevices */ | 707 | /* MSIC subdevices */ |
703 | {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data}, | 708 | {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data}, |
@@ -705,6 +710,7 @@ static const struct devs_id __initconst device_ids[] = { | |||
705 | {"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data}, | 710 | {"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data}, |
706 | {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data}, | 711 | {"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data}, |
707 | {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data}, | 712 | {"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data}, |
713 | {"msic_thermal", SFI_DEV_TYPE_IPC, 1, &msic_thermal_platform_data}, | ||
708 | 714 | ||
709 | {}, | 715 | {}, |
710 | }; | 716 | }; |