Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-footbridge/isa-timer.c |
| 3 | * |
| 4 | * Copyright (C) 1998 Russell King. |
| 5 | * Copyright (C) 1998 Phil Blundell |
| 6 | */ |
Russell King | 4e8d763 | 2011-01-28 21:00:39 +0000 | [diff] [blame] | 7 | #include <linux/clockchips.h> |
Ralf Baechle | 334955e | 2011-06-01 19:04:57 +0100 | [diff] [blame] | 8 | #include <linux/i8253.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <linux/init.h> |
| 10 | #include <linux/interrupt.h> |
Thomas Gleixner | 55e8698 | 2006-07-01 22:32:17 +0100 | [diff] [blame] | 11 | #include <linux/irq.h> |
Russell King | 8c414ff | 2011-05-08 18:50:20 +0100 | [diff] [blame] | 12 | #include <linux/spinlock.h> |
Russell King | 4e8d763 | 2011-01-28 21:00:39 +0000 | [diff] [blame] | 13 | #include <linux/timex.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <asm/irq.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <asm/mach/time.h> |
| 17 | |
| 18 | #include "common.h" |
| 19 | |
Russell King | 4e8d763 | 2011-01-28 21:00:39 +0000 | [diff] [blame] | 20 | static 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | return IRQ_HANDLED; |
| 25 | } |
| 26 | |
Russell King | 4e8d763 | 2011-01-28 21:00:39 +0000 | [diff] [blame] | 27 | static struct irqaction pit_timer_irq = { |
| 28 | .name = "pit", |
| 29 | .handler = pit_timer_interrupt, |
Bernhard Walle | b30faba | 2007-05-08 00:35:39 -0700 | [diff] [blame] | 30 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
Thomas Gleixner | 8560a6c | 2011-06-09 13:08:28 +0000 | [diff] [blame] | 31 | .dev_id = &i8253_clockevent, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | static void __init isa_timer_init(void) |
| 35 | { |
Russell King | 8c414ff | 2011-05-08 18:50:20 +0100 | [diff] [blame] | 36 | clocksource_i8253_init(); |
Russell King | 4e8d763 | 2011-01-28 21:00:39 +0000 | [diff] [blame] | 37 | |
Thomas Gleixner | 8560a6c | 2011-06-09 13:08:28 +0000 | [diff] [blame] | 38 | setup_irq(i8253_clockevent.irq, &pit_timer_irq); |
| 39 | clockevent_i8253_init(false); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | struct sys_timer isa_timer = { |
| 43 | .init = isa_timer_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | }; |