diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-10-21 09:06:35 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2008-12-15 16:46:41 -0500 |
commit | 9bc1aaeac0118611c30edf84995ebad5adfd6822 (patch) | |
tree | a274b3dfe8c52c191c6483877fb302418f26b480 /arch/arm | |
parent | bcae8aeb320dfe8dde4b3512237a5b76737b0120 (diff) |
[ARM] S3C24XX: Split timer pending code out
Split the timer pending code out to a seperate per-machine
header so that when compiling for mach-s3c2410 or mach-s3c24a0
we can use the right timer code without having to #ifdef the
timer driver.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-s3c2410/include/mach/tick.h | 15 | ||||
-rw-r--r-- | arch/arm/mach-s3c24a0/include/mach/tick.h | 15 | ||||
-rw-r--r-- | arch/arm/plat-s3c/time.c | 7 |
3 files changed, 32 insertions, 5 deletions
diff --git a/arch/arm/mach-s3c2410/include/mach/tick.h b/arch/arm/mach-s3c2410/include/mach/tick.h new file mode 100644 index 000000000000..544da41979db --- /dev/null +++ b/arch/arm/mach-s3c2410/include/mach/tick.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/include/mach/tick.h | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C2410 - timer tick support | ||
8 | */ | ||
9 | |||
10 | #define SRCPND_TIMER4 (1<<(IRQ_TIMER4 - IRQ_EINT0)) | ||
11 | |||
12 | static inline int s3c24xx_ostimer_pending(void) | ||
13 | { | ||
14 | return __raw_readl(S3C2410_SRCPND) & SRCPND_TIMER4; | ||
15 | } | ||
diff --git a/arch/arm/mach-s3c24a0/include/mach/tick.h b/arch/arm/mach-s3c24a0/include/mach/tick.h new file mode 100644 index 000000000000..9dea8ba6fb72 --- /dev/null +++ b/arch/arm/mach-s3c24a0/include/mach/tick.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* linux/arch/arm/mach-s3c24a0/include/mach/tick.h | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C24A0 - timer tick support | ||
8 | */ | ||
9 | |||
10 | #define SUBSRC_TIMER4 (1 << (IRQ_TIMER4 - IRQ_S3CUART_RX0)) | ||
11 | |||
12 | static inline int s3c24xx_ostimer_pending(void) | ||
13 | { | ||
14 | return __raw_readl(S3C2410_SUBSRCPND) & SUBSRC_TIMER4; | ||
15 | } | ||
diff --git a/arch/arm/plat-s3c/time.c b/arch/arm/plat-s3c/time.c index c6861a05a291..d35e149f4ebf 100644 --- a/arch/arm/plat-s3c/time.c +++ b/arch/arm/plat-s3c/time.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <plat/regs-timer.h> | 36 | #include <plat/regs-timer.h> |
37 | #include <mach/regs-irq.h> | 37 | #include <mach/regs-irq.h> |
38 | #include <asm/mach/time.h> | 38 | #include <asm/mach/time.h> |
39 | #include <mach/tick.h> | ||
39 | 40 | ||
40 | #include <plat/clock.h> | 41 | #include <plat/clock.h> |
41 | #include <plat/cpu.h> | 42 | #include <plat/cpu.h> |
@@ -91,12 +92,9 @@ static inline unsigned long timer_ticks_to_usec(unsigned long ticks) | |||
91 | * IRQs are disabled before entering here from do_gettimeofday() | 92 | * IRQs are disabled before entering here from do_gettimeofday() |
92 | */ | 93 | */ |
93 | 94 | ||
94 | #define SRCPND_TIMER4 (1<<(IRQ_TIMER4 - IRQ_EINT0)) | ||
95 | |||
96 | static unsigned long s3c2410_gettimeoffset (void) | 95 | static unsigned long s3c2410_gettimeoffset (void) |
97 | { | 96 | { |
98 | unsigned long tdone; | 97 | unsigned long tdone; |
99 | unsigned long irqpend; | ||
100 | unsigned long tval; | 98 | unsigned long tval; |
101 | 99 | ||
102 | /* work out how many ticks have gone since last timer interrupt */ | 100 | /* work out how many ticks have gone since last timer interrupt */ |
@@ -106,8 +104,7 @@ static unsigned long s3c2410_gettimeoffset (void) | |||
106 | 104 | ||
107 | /* check to see if there is an interrupt pending */ | 105 | /* check to see if there is an interrupt pending */ |
108 | 106 | ||
109 | irqpend = __raw_readl(S3C2410_SRCPND); | 107 | if (s3c24xx_ostimer_pending()) { |
110 | if (irqpend & SRCPND_TIMER4) { | ||
111 | /* re-read the timer, and try and fix up for the missed | 108 | /* re-read the timer, and try and fix up for the missed |
112 | * interrupt. Note, the interrupt may go off before the | 109 | * interrupt. Note, the interrupt may go off before the |
113 | * timer has re-loaded from wrapping. | 110 | * timer has re-loaded from wrapping. |