]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/arm/mach-footbridge/dc21285-timer.c
cpumask: remove arch_send_call_function_ipi
[mirror_ubuntu-artful-kernel.git] / arch / arm / mach-footbridge / dc21285-timer.c
CommitLineData
1da177e4
LT
1/*
2 * linux/arch/arm/mach-footbridge/dc21285-timer.c
3 *
4 * Copyright (C) 1998 Russell King.
5 * Copyright (C) 1998 Phil Blundell
6 */
7#include <linux/init.h>
8#include <linux/interrupt.h>
55e86989 9#include <linux/irq.h>
70d13e08 10#include <linux/spinlock.h>
1da177e4
LT
11
12#include <asm/irq.h>
13
14#include <asm/hardware/dec21285.h>
15#include <asm/mach/time.h>
16
17#include "common.h"
18
19/*
20 * Footbridge timer 1 support.
21 */
22static unsigned long timer1_latch;
23
24static unsigned long timer1_gettimeoffset (void)
25{
26 unsigned long value = timer1_latch - *CSR_TIMER1_VALUE;
27
28 return ((tick_nsec / 1000) * value) / timer1_latch;
29}
30
31static irqreturn_t
0cd61b68 32timer1_interrupt(int irq, void *dev_id)
1da177e4 33{
1da177e4
LT
34 *CSR_TIMER1_CLR = 0;
35
0cd61b68 36 timer_tick();
1da177e4 37
1da177e4
LT
38 return IRQ_HANDLED;
39}
40
41static struct irqaction footbridge_timer_irq = {
42 .name = "Timer1 timer tick",
43 .handler = timer1_interrupt,
b30fabad 44 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
1da177e4
LT
45};
46
47/*
48 * Set up timer interrupt.
49 */
50static void __init footbridge_timer_init(void)
51{
1da177e4
LT
52 timer1_latch = (mem_fclk_21285 + 8 * HZ) / (16 * HZ);
53
54 *CSR_TIMER1_CLR = 0;
55 *CSR_TIMER1_LOAD = timer1_latch;
56 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16;
57
58 setup_irq(IRQ_TIMER1, &footbridge_timer_irq);
336eb02b
RK
59
60 isa_rtc_init();
1da177e4
LT
61}
62
63struct sys_timer footbridge_timer = {
64 .init = footbridge_timer_init,
65 .offset = timer1_gettimeoffset,
66};