blob: b73f52e196b90e91b75ac6ae8ab628f72381a070 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/mach-footbridge/isa-timer.c
3 *
4 * Copyright (C) 1998 Russell King.
5 * Copyright (C) 1998 Phil Blundell
6 */
Russell King4e8d7632011-01-28 21:00:39 +00007#include <linux/clockchips.h>
Ralf Baechle334955e2011-06-01 19:04:57 +01008#include <linux/i8253.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/init.h>
10#include <linux/interrupt.h>
Thomas Gleixner55e86982006-07-01 22:32:17 +010011#include <linux/irq.h>
Russell King8c414ff2011-05-08 18:50:20 +010012#include <linux/spinlock.h>
Russell King4e8d7632011-01-28 21:00:39 +000013#include <linux/timex.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <asm/irq.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <asm/mach/time.h>
17
18#include "common.h"
19
Russell King4e8d7632011-01-28 21:00:39 +000020static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
21{
22 struct clock_event_device *ce = dev_id;
23 ce->event_handler(ce);
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 return IRQ_HANDLED;
25}
26
Russell King4e8d7632011-01-28 21:00:39 +000027static struct irqaction pit_timer_irq = {
28 .name = "pit",
29 .handler = pit_timer_interrupt,
Michael Opdenacker26632be2014-03-04 21:45:48 +010030 .flags = IRQF_TIMER | IRQF_IRQPOLL,
Thomas Gleixner8560a6c2011-06-09 13:08:28 +000031 .dev_id = &i8253_clockevent,
Linus Torvalds1da177e2005-04-16 15:20:36 -070032};
33
Stephen Warren6bb27d72012-11-08 12:40:59 -070034void __init isa_timer_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070035{
Russell King8c414ff2011-05-08 18:50:20 +010036 clocksource_i8253_init();
Russell King4e8d7632011-01-28 21:00:39 +000037
Thomas Gleixner8560a6c2011-06-09 13:08:28 +000038 setup_irq(i8253_clockevent.irq, &pit_timer_irq);
39 clockevent_i8253_init(false);
Linus Torvalds1da177e2005-04-16 15:20:36 -070040}