Linux 4.1.18
[linux/fpc-iii.git] / arch / x86 / kernel / i8253.c
blobf2b96de3c7c16dc45a36a6d4a8acd02d3b453b6a
1 /*
2 * 8253/PIT functions
4 */
5 #include <linux/clockchips.h>
6 #include <linux/module.h>
7 #include <linux/timex.h>
8 #include <linux/i8253.h>
10 #include <asm/hpet.h>
11 #include <asm/time.h>
12 #include <asm/smp.h>
15 * HPET replaces the PIT, when enabled. So we need to know, which of
16 * the two timers is used
18 struct clock_event_device *global_clock_event;
20 void __init setup_pit_timer(void)
22 clockevent_i8253_init(true);
23 global_clock_event = &i8253_clockevent;
26 #ifndef CONFIG_X86_64
27 static int __init init_pit_clocksource(void)
30 * Several reasons not to register PIT as a clocksource:
32 * - On SMP PIT does not scale due to i8253_lock
33 * - when HPET is enabled
34 * - when local APIC timer is active (PIT is switched off)
36 if (num_possible_cpus() > 1 || is_hpet_enabled() ||
37 i8253_clockevent.mode != CLOCK_EVT_MODE_PERIODIC)
38 return 0;
40 return clocksource_i8253_init();
42 arch_initcall(init_pit_clocksource);
43 #endif /* !CONFIG_X86_64 */