Merge branch 'clockevents/4.21' of http://git.linaro.org/people/daniel.lezcano/linux...
[linux/fpc-iii.git] / arch / x86 / kernel / i8253.c
blob0d307a657abbb253d4679471bd1ac202279ff447
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * 8253/PIT functions
5 */
6 #include <linux/clockchips.h>
7 #include <linux/init.h>
8 #include <linux/timex.h>
9 #include <linux/i8253.h>
11 #include <asm/hpet.h>
12 #include <asm/time.h>
13 #include <asm/smp.h>
16 * HPET replaces the PIT, when enabled. So we need to know, which of
17 * the two timers is used
19 struct clock_event_device *global_clock_event;
21 void __init setup_pit_timer(void)
23 clockevent_i8253_init(true);
24 global_clock_event = &i8253_clockevent;
27 #ifndef CONFIG_X86_64
28 static int __init init_pit_clocksource(void)
31 * Several reasons not to register PIT as a clocksource:
33 * - On SMP PIT does not scale due to i8253_lock
34 * - when HPET is enabled
35 * - when local APIC timer is active (PIT is switched off)
37 if (num_possible_cpus() > 1 || is_hpet_enabled() ||
38 !clockevent_state_periodic(&i8253_clockevent))
39 return 0;
41 return clocksource_i8253_init();
43 arch_initcall(init_pit_clocksource);
44 #endif /* !CONFIG_X86_64 */