Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

David Cohen and committed by
H. Peter Anvin
bc20aa48 85611e3f

+144 -8
+2
arch/x86/include/asm/intel-mid.h
··· 52 52 /* 1 was Moorestown */ 53 53 INTEL_MID_CPU_CHIP_PENWELL = 2, 54 54 INTEL_MID_CPU_CHIP_CLOVERVIEW, 55 + INTEL_MID_CPU_CHIP_TANGIER, 55 56 }; 56 57 57 58 extern enum intel_mid_cpu_type __intel_mid_cpu_chip; ··· 83 82 #define INTEL_MID_OPS_INIT {\ 84 83 DECLARE_INTEL_MID_OPS_INIT(penwell, INTEL_MID_CPU_CHIP_PENWELL), \ 85 84 DECLARE_INTEL_MID_OPS_INIT(cloverview, INTEL_MID_CPU_CHIP_CLOVERVIEW), \ 85 + DECLARE_INTEL_MID_OPS_INIT(tangier, INTEL_MID_CPU_CHIP_TANGIER) \ 86 86 }; 87 87 88 88 #ifdef CONFIG_X86_INTEL_MID
+5 -1
arch/x86/pci/intel_mid_pci.c
··· 31 31 #include <asm/pci_x86.h> 32 32 #include <asm/hw_irq.h> 33 33 #include <asm/io_apic.h> 34 + #include <asm/intel-mid.h> 34 35 35 36 #define PCIE_CAP_OFFSET 0x100 36 37 ··· 220 219 irq_attr.ioapic = mp_find_ioapic(dev->irq); 221 220 irq_attr.ioapic_pin = dev->irq; 222 221 irq_attr.trigger = 1; /* level */ 223 - irq_attr.polarity = 1; /* active low */ 222 + if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) 223 + irq_attr.polarity = 0; /* active high */ 224 + else 225 + irq_attr.polarity = 1; /* active low */ 224 226 io_apic_set_pci_routing(&dev->dev, dev->irq, &irq_attr); 225 227 226 228 return 0;
+1 -1
arch/x86/platform/intel-mid/Makefile
··· 1 - obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o intel_mid_vrtc.o mfld.o 1 + obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o intel_mid_vrtc.o mfld.o mrfl.o 2 2 obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_intel_mid.o 3 3 4 4 # SFI specific code
+4
arch/x86/platform/intel-mid/intel-mid.c
··· 116 116 case 0x35: 117 117 __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_CLOVERVIEW; 118 118 break; 119 + case 0x3C: 120 + case 0x4A: 121 + __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_TANGIER; 122 + break; 119 123 case 0x27: 120 124 default: 121 125 __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL;
+1
arch/x86/platform/intel-mid/intel_mid_weak_decls.h
··· 16 16 */ 17 17 extern void * __cpuinit get_penwell_ops(void) __attribute__((weak)); 18 18 extern void * __cpuinit get_cloverview_ops(void) __attribute__((weak)); 19 + extern void * __init get_tangier_ops(void) __attribute__((weak));
+103
arch/x86/platform/intel-mid/mrfl.c
··· 1 + /* 2 + * mrfl.c: Intel Merrifield platform specific 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 + 17 + #include "intel_mid_weak_decls.h" 18 + 19 + static unsigned long __init tangier_calibrate_tsc(void) 20 + { 21 + unsigned long fast_calibrate; 22 + u32 lo, hi, ratio, fsb, bus_freq; 23 + 24 + /* *********************** */ 25 + /* Compute TSC:Ratio * FSB */ 26 + /* *********************** */ 27 + 28 + /* Compute Ratio */ 29 + rdmsr(MSR_PLATFORM_INFO, lo, hi); 30 + pr_debug("IA32 PLATFORM_INFO is 0x%x : %x\n", hi, lo); 31 + 32 + ratio = (lo >> 8) & 0xFF; 33 + pr_debug("ratio is %d\n", ratio); 34 + if (!ratio) { 35 + pr_err("Read a zero ratio, force tsc ratio to 4 ...\n"); 36 + ratio = 4; 37 + } 38 + 39 + /* Compute FSB */ 40 + rdmsr(MSR_FSB_FREQ, lo, hi); 41 + pr_debug("Actual FSB frequency detected by SOC 0x%x : %x\n", 42 + hi, lo); 43 + 44 + bus_freq = lo & 0x7; 45 + pr_debug("bus_freq = 0x%x\n", bus_freq); 46 + 47 + if (bus_freq == 0) 48 + fsb = FSB_FREQ_100SKU; 49 + else if (bus_freq == 1) 50 + fsb = FSB_FREQ_100SKU; 51 + else if (bus_freq == 2) 52 + fsb = FSB_FREQ_133SKU; 53 + else if (bus_freq == 3) 54 + fsb = FSB_FREQ_167SKU; 55 + else if (bus_freq == 4) 56 + fsb = FSB_FREQ_83SKU; 57 + else if (bus_freq == 5) 58 + fsb = FSB_FREQ_400SKU; 59 + else if (bus_freq == 6) 60 + fsb = FSB_FREQ_267SKU; 61 + else if (bus_freq == 7) 62 + fsb = FSB_FREQ_333SKU; 63 + else { 64 + BUG(); 65 + pr_err("Invalid bus_freq! Setting to minimal value!\n"); 66 + fsb = FSB_FREQ_100SKU; 67 + } 68 + 69 + /* TSC = FSB Freq * Resolved HFM Ratio */ 70 + fast_calibrate = ratio * fsb; 71 + pr_debug("calculate tangier tsc %lu KHz\n", fast_calibrate); 72 + 73 + /* ************************************ */ 74 + /* Calculate Local APIC Timer Frequency */ 75 + /* ************************************ */ 76 + lapic_timer_frequency = (fsb * 1000) / HZ; 77 + 78 + pr_debug("Setting lapic_timer_frequency = %d\n", 79 + lapic_timer_frequency); 80 + 81 + /* mark tsc clocksource as reliable */ 82 + set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE); 83 + 84 + if (fast_calibrate) 85 + return fast_calibrate; 86 + 87 + return 0; 88 + } 89 + 90 + static void __init tangier_arch_setup(void) 91 + { 92 + x86_platform.calibrate_tsc = tangier_calibrate_tsc; 93 + } 94 + 95 + /* tangier arch ops */ 96 + static struct intel_mid_ops tangier_ops = { 97 + .arch_setup = tangier_arch_setup, 98 + }; 99 + 100 + void * __cpuinit get_tangier_ops() 101 + { 102 + return &tangier_ops; 103 + }
+28 -6
arch/x86/platform/intel-mid/sfi.c
··· 443 443 * so we have to enable them one by one here 444 444 */ 445 445 ioapic = mp_find_ioapic(irq); 446 - irq_attr.ioapic = ioapic; 447 - irq_attr.ioapic_pin = irq; 448 - irq_attr.trigger = 1; 449 - irq_attr.polarity = 1; 450 - io_apic_set_pci_routing(NULL, irq, &irq_attr); 451 - } else 446 + if (ioapic >= 0) { 447 + irq_attr.ioapic = ioapic; 448 + irq_attr.ioapic_pin = irq; 449 + irq_attr.trigger = 1; 450 + if (intel_mid_identify_cpu() == 451 + INTEL_MID_CPU_CHIP_TANGIER) { 452 + if (!strncmp(pentry->name, 453 + "r69001-ts-i2c", 13)) 454 + /* active low */ 455 + irq_attr.polarity = 1; 456 + else if (!strncmp(pentry->name, 457 + "synaptics_3202", 14)) 458 + /* active low */ 459 + irq_attr.polarity = 1; 460 + else if (irq == 41) 461 + /* fast_int_1 */ 462 + irq_attr.polarity = 1; 463 + else 464 + /* active high */ 465 + irq_attr.polarity = 0; 466 + } else { 467 + /* PNW and CLV go with active low */ 468 + irq_attr.polarity = 1; 469 + } 470 + io_apic_set_pci_routing(NULL, irq, &irq_attr); 471 + } 472 + } else { 452 473 irq = 0; /* No irq */ 474 + } 453 475 454 476 dev = get_device_id(pentry->type, pentry->name); 455 477