Commit 7c13cbc0 authored by Ben Dooks's avatar Ben Dooks Committed by Russell King

[ARM PATCH] 2056/1: S3C2410 - check for IRQ pending in gettimeoffset()

Patch from Ben Dooks

Ensure we check for IRQ pending for the gettimeoffset()
function
parent 496cf41f
...@@ -31,14 +31,12 @@ ...@@ -31,14 +31,12 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/arch/map.h> #include <asm/arch/map.h>
#include <asm/arch/regs-timer.h> #include <asm/arch/regs-timer.h>
#include <asm/arch/regs-irq.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
static unsigned long timer_startval; static unsigned long timer_startval;
static unsigned long timer_ticks_usec; static unsigned long timer_ticks_usec;
#ifdef CONFIG_S3C2410_RTC
extern void s3c2410_rtc_check();
#endif
/* with an 12MHz clock, we get 12 ticks per-usec /* with an 12MHz clock, we get 12 ticks per-usec
*/ */
...@@ -49,15 +47,30 @@ extern void s3c2410_rtc_check(); ...@@ -49,15 +47,30 @@ extern void s3c2410_rtc_check();
* will have been disabled by do_gettimeoffset() * will have been disabled by do_gettimeoffset()
* IRQs are disabled before entering here from do_gettimeofday() * IRQs are disabled before entering here from do_gettimeofday()
*/ */
#define SRCPND_TIMER4 (1<<(IRQ_TIMER4 - IRQ_EINT0))
static unsigned long s3c2410_gettimeoffset (void) static unsigned long s3c2410_gettimeoffset (void)
{ {
unsigned long tdone; unsigned long tdone;
unsigned long usec; unsigned long usec;
unsigned long irqpend;
/* work out how many ticks have gone since last timer interrupt */ /* work out how many ticks have gone since last timer interrupt */
tdone = timer_startval - __raw_readl(S3C2410_TCNTO(4)); tdone = timer_startval - __raw_readl(S3C2410_TCNTO(4));
/* check to see if there is an interrupt pending */
irqpend = __raw_readl(S3C2410_SRCPND);
if (irqpend & SRCPND_TIMER4) {
/* re-read the timer, and try and fix up for the missed
* interrupt */
tdone = timer_startval - __raw_readl(S3C2410_TCNTO(4));
tdone += 1<<16;
}
/* currently, tcnt is in 12MHz units, but this may change /* currently, tcnt is in 12MHz units, but this may change
* for non-bast machines... * for non-bast machines...
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment