Root/
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> |
9 | #include <linux/irq.h> |
10 | #include <linux/spinlock.h> |
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 | */ |
22 | static unsigned long timer1_latch; |
23 | |
24 | static 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 | |
31 | static irqreturn_t |
32 | timer1_interrupt(int irq, void *dev_id) |
33 | { |
34 | *CSR_TIMER1_CLR = 0; |
35 | |
36 | timer_tick(); |
37 | |
38 | return IRQ_HANDLED; |
39 | } |
40 | |
41 | static struct irqaction footbridge_timer_irq = { |
42 | .name = "Timer1 timer tick", |
43 | .handler = timer1_interrupt, |
44 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
45 | }; |
46 | |
47 | /* |
48 | * Set up timer interrupt. |
49 | */ |
50 | static void __init footbridge_timer_init(void) |
51 | { |
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); |
59 | } |
60 | |
61 | struct sys_timer footbridge_timer = { |
62 | .init = footbridge_timer_init, |
63 | .offset = timer1_gettimeoffset, |
64 | }; |
65 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9