Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
e64b956
Documentation
LICENSES
arch
alpha
arc
arm
arm64
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
nios2
openrisc
parisc
powerpc
riscv
s390
score
sh
sparc
tile
um
unicore32
x86
boot
configs
crypto
entry
events
hyperv
ia32
include
kernel
kvm
lib
math-emu
mm
net
oprofile
pci
platform
atom
ce4100
efi
geode
goldfish
intel-mid
device_libs
Makefile
intel-mid.c
intel_mid_vrtc.c
intel_mid_weak_decls.h
mfld.c
mrfld.c
pwr.c
sfi.c
intel-quark
intel
iris
olpc
scx200
sfi
ts5500
uv
Makefile
power
purgatory
ras
realmode
tools
um
video
xen
.gitignore
Kbuild
Kconfig
Kconfig.cpu
Kconfig.debug
Makefile
Makefile.um
Makefile_32.cpu
xtensa
.gitignore
Kconfig
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
arch
/
x86
/
platform
/
intel-mid
/
intel-mid.c
Copy path
Blame
Blame
Latest commit
History
History
231 lines (198 loc) · 6.48 KB
Breadcrumbs
linux
/
arch
/
x86
/
platform
/
intel-mid
/
intel-mid.c
Top
File metadata and controls
Code
Blame
231 lines (198 loc) · 6.48 KB
Raw
/* * intel-mid.c: Intel MID platform setup code * * (C) Copyright 2008, 2012 Intel Corporation * Author: Jacob Pan (jacob.jun.pan@intel.com) * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 * of the License. */ #define pr_fmt(fmt) "intel_mid: " fmt #include <linux/init.h> #include <linux/kernel.h> #include <linux/interrupt.h> #include <linux/regulator/machine.h> #include <linux/scatterlist.h> #include <linux/sfi.h> #include <linux/irq.h> #include <linux/export.h> #include <linux/notifier.h> #include <asm/setup.h> #include <asm/mpspec_def.h> #include <asm/hw_irq.h> #include <asm/apic.h> #include <asm/io_apic.h> #include <asm/intel-mid.h> #include <asm/intel_mid_vrtc.h> #include <asm/io.h> #include <asm/i8259.h> #include <asm/intel_scu_ipc.h> #include <asm/apb_timer.h> #include <asm/reboot.h> #include "intel_mid_weak_decls.h" /* * the clockevent devices on Moorestown/Medfield can be APBT or LAPIC clock, * cmdline option x86_intel_mid_timer can be used to override the configuration * to prefer one or the other. * at runtime, there are basically three timer configurations: * 1. per cpu apbt clock only * 2. per cpu always-on lapic clocks only, this is Penwell/Medfield only * 3. per cpu lapic clock (C3STOP) and one apbt clock, with broadcast. * * by default (without cmdline option), platform code first detects cpu type * to see if we are on lincroft or penwell, then set up both lapic or apbt * clocks accordingly. * i.e. by default, medfield uses configuration #2, moorestown uses #1. * config #3 is supported but not recommended on medfield. * * rating and feature summary: * lapic (with C3STOP) --------- 100 * apbt (always-on) ------------ 110 * lapic (always-on,ARAT) ------ 150 */ enum intel_mid_timer_options intel_mid_timer_options; /* intel_mid_ops to store sub arch ops */ static struct intel_mid_ops *intel_mid_ops; /* getter function for sub arch ops*/ static void *(*get_intel_mid_ops[])(void) = INTEL_MID_OPS_INIT; enum intel_mid_cpu_type __intel_mid_cpu_chip; EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip); static void intel_mid_power_off(void) { /* Shut down South Complex via PWRMU */ intel_mid_pwr_power_off(); /* Only for Tangier, the rest will ignore this command */ intel_scu_ipc_simple_command(IPCMSG_COLD_OFF, 1); }; static void intel_mid_reboot(void) { intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 0); } static unsigned long __init intel_mid_calibrate_tsc(void) { return 0; } static void __init intel_mid_setup_bp_timer(void) { apbt_time_init(); setup_boot_APIC_clock(); } static void __init intel_mid_time_init(void) { sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr); switch (intel_mid_timer_options) { case INTEL_MID_TIMER_APBT_ONLY: break; case INTEL_MID_TIMER_LAPIC_APBT: /* Use apbt and local apic */ x86_init.timers.setup_percpu_clockev = intel_mid_setup_bp_timer; x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock; return; default: if (!boot_cpu_has(X86_FEATURE_ARAT)) break; /* Lapic only, no apbt */ x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock; x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock; return; } x86_init.timers.setup_percpu_clockev = apbt_time_init; } static void intel_mid_arch_setup(void) { if (boot_cpu_data.x86 != 6) { pr_err("Unknown Intel MID CPU (%d:%d), default to Penwell\n", boot_cpu_data.x86, boot_cpu_data.x86_model); __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL; goto out; } switch (boot_cpu_data.x86_model) { case 0x35: __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_CLOVERVIEW; break; case 0x3C: case 0x4A: __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_TANGIER; break; case 0x27: default: __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL; break; } if (__intel_mid_cpu_chip < MAX_CPU_OPS(get_intel_mid_ops)) intel_mid_ops = get_intel_mid_ops[__intel_mid_cpu_chip](); else { intel_mid_ops = get_intel_mid_ops[INTEL_MID_CPU_CHIP_PENWELL](); pr_info("ARCH: Unknown SoC, assuming Penwell!\n"); } out: if (intel_mid_ops->arch_setup) intel_mid_ops->arch_setup(); /* * Intel MID platforms are using explicitly defined regulators. * * Let the regulator core know that we do not have any additional * regulators left. This lets it substitute unprovided regulators with * dummy ones: */ regulator_has_full_constraints(); } /* * Moorestown does not have external NMI source nor port 0x61 to report * NMI status. The possible NMI sources are from pmu as a result of NMI * watchdog or lock debug. Reading io port 0x61 results in 0xff which * misled NMI handler. */ static unsigned char intel_mid_get_nmi_reason(void) { return 0; } /* * Moorestown specific x86_init function overrides and early setup * calls. */ void __init x86_intel_mid_early_setup(void) { x86_init.resources.probe_roms = x86_init_noop; x86_init.resources.reserve_resources = x86_init_noop; x86_init.timers.timer_init = intel_mid_time_init; x86_init.timers.setup_percpu_clockev = x86_init_noop; x86_init.timers.wallclock_init = intel_mid_rtc_init; x86_init.irqs.pre_vector_init = x86_init_noop; x86_init.oem.arch_setup = intel_mid_arch_setup; x86_cpuinit.setup_percpu_clockev = apbt_setup_secondary_clock; x86_platform.calibrate_tsc = intel_mid_calibrate_tsc; x86_platform.get_nmi_reason = intel_mid_get_nmi_reason; x86_init.pci.arch_init = intel_mid_pci_init; x86_init.pci.fixup_irqs = x86_init_noop; legacy_pic = &null_legacy_pic; pm_power_off = intel_mid_power_off; machine_ops.emergency_restart = intel_mid_reboot; /* Avoid searching for BIOS MP tables */ x86_init.mpparse.find_smp_config = x86_init_noop; x86_init.mpparse.get_smp_config = x86_init_uint_noop; set_bit(MP_BUS_ISA, mp_bus_not_pci); } /* * if user does not want to use per CPU apb timer, just give it a lower rating * than local apic timer and skip the late per cpu timer init. */ static inline int __init setup_x86_intel_mid_timer(char *arg) { if (!arg) return -EINVAL; if (strcmp("apbt_only", arg) == 0) intel_mid_timer_options = INTEL_MID_TIMER_APBT_ONLY; else if (strcmp("lapic_and_apbt", arg) == 0) intel_mid_timer_options = INTEL_MID_TIMER_LAPIC_APBT; else { pr_warn("X86 INTEL_MID timer option %s not recognised use x86_intel_mid_timer=apbt_only or lapic_and_apbt\n", arg); return -EINVAL; } return 0; } __setup("x86_intel_mid_timer=", setup_x86_intel_mid_timer);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
You can’t perform that action at this time.