2007-10-12 06:46:10 +08:00
|
|
|
/*
|
|
|
|
* i8253.c 8253/PIT functions
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <linux/clockchips.h>
|
2011-06-02 02:04:57 +08:00
|
|
|
#include <linux/i8253.h>
|
2007-10-12 06:46:10 +08:00
|
|
|
#include <linux/module.h>
|
2009-06-19 21:05:26 +08:00
|
|
|
#include <linux/smp.h>
|
2010-10-07 21:08:54 +08:00
|
|
|
#include <linux/irq.h>
|
2007-10-12 06:46:10 +08:00
|
|
|
|
2007-11-01 22:38:20 +08:00
|
|
|
#include <asm/time.h>
|
2007-10-12 06:46:10 +08:00
|
|
|
|
2007-11-01 22:38:20 +08:00
|
|
|
static irqreturn_t timer_interrupt(int irq, void *dev_id)
|
2007-10-12 06:46:10 +08:00
|
|
|
{
|
2011-07-22 17:17:11 +08:00
|
|
|
i8253_clockevent.event_handler(&i8253_clockevent);
|
2007-10-12 06:46:10 +08:00
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct irqaction irq0 = {
|
|
|
|
.handler = timer_interrupt,
|
2009-10-08 21:17:54 +08:00
|
|
|
.flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER,
|
2007-10-12 06:46:10 +08:00
|
|
|
.name = "timer"
|
|
|
|
};
|
|
|
|
|
|
|
|
void __init setup_pit_timer(void)
|
|
|
|
{
|
2011-06-09 21:08:27 +08:00
|
|
|
clockevent_i8253_init(true);
|
2007-10-12 06:46:10 +08:00
|
|
|
setup_irq(0, &irq0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int __init init_pit_clocksource(void)
|
|
|
|
{
|
|
|
|
if (num_possible_cpus() > 1) /* PIT does not scale! */
|
|
|
|
return 0;
|
|
|
|
|
2011-05-09 02:03:03 +08:00
|
|
|
return clocksource_i8253_init();
|
2007-10-12 06:46:10 +08:00
|
|
|
}
|
|
|
|
arch_initcall(init_pit_clocksource);
|