Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / arch / x86 / kernel / i8253.c
CommitLineData
8d016ef1 1/*
835c34a1 2 * 8253/PIT functions
8d016ef1 3 *
4 */
e9e2cdb4 5#include <linux/clockchips.h>
8d016ef1 6#include <linux/module.h>
08604bd9 7#include <linux/timex.h>
334955ef 8#include <linux/i8253.h>
8d016ef1 9
4713e22c 10#include <asm/hpet.h>
16f871bc 11#include <asm/time.h>
c8344bc2 12#include <asm/smp.h>
8d016ef1 13
e9e2cdb4
TG
14/*
15 * HPET replaces the PIT, when enabled. So we need to know, which of
16 * the two timers is used
17 */
18struct clock_event_device *global_clock_event;
19
e9e2cdb4
TG
20void __init setup_pit_timer(void)
21{
0a779c57
TG
22 clockevent_i8253_init(true);
23 global_clock_event = &i8253_clockevent;
8d016ef1 24}
5d0cf410 25
f5e0e93f 26#ifndef CONFIG_X86_64
5d0cf410 27static int __init init_pit_clocksource(void)
28{
316da3b3
TG
29 /*
30 * Several reasons not to register PIT as a clocksource:
31 *
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)
35 */
36 if (num_possible_cpus() > 1 || is_hpet_enabled() ||
8eda41b0 37 !clockevent_state_periodic(&i8253_clockevent))
5d0cf410 38 return 0;
39
82491451 40 return clocksource_i8253_init();
5d0cf410 41}
6bb74df4 42arch_initcall(init_pit_clocksource);
c8344bc2 43#endif /* !CONFIG_X86_64 */
This page took 0.667396 seconds and 5 git commands to generate.