]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-pxa/time.c
Merge branch 's3c-move' into devel
[linux-2.6-omap-h63xx.git] / arch / arm / mach-pxa / time.c
index 3c4abbf318036a42c5873994970130e4913bcd26..f8a9a62959e5bfe9cb426e75560efb17a08f7194 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/clockchips.h>
 #include <linux/sched.h>
+#include <linux/cnt32_to_63.h>
 
 #include <asm/div64.h>
-#include <asm/cnt32_to_63.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
-#include <asm/arch/pxa-regs.h>
+#include <mach/pxa-regs.h>
 #include <asm/mach-types.h>
 
 /*
@@ -155,7 +155,7 @@ static void __init pxa_timer_init(void)
        OIER = 0;
        OSSR = OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3;
 
-       if (cpu_is_pxa21x() || cpu_is_pxa25x())
+       if (cpu_is_pxa25x())
                clock_tick_rate = 3686400;
        else if (machine_is_mainstone())
                clock_tick_rate = 3249600;
@@ -169,7 +169,7 @@ static void __init pxa_timer_init(void)
        ckevt_pxa_osmr0.max_delta_ns =
                clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0);
        ckevt_pxa_osmr0.min_delta_ns =
-               clockevent_delta2ns(MIN_OSCR_DELTA, &ckevt_pxa_osmr0) + 1;
+               clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_pxa_osmr0) + 1;
 
        cksrc_pxa_oscr0.mult =
                clocksource_hz2mult(clock_tick_rate, cksrc_pxa_oscr0.shift);
@@ -181,7 +181,7 @@ static void __init pxa_timer_init(void)
 }
 
 #ifdef CONFIG_PM
-static unsigned long osmr[4], oier;
+static unsigned long osmr[4], oier, oscr;
 
 static void pxa_timer_suspend(void)
 {
@@ -190,23 +190,26 @@ static void pxa_timer_suspend(void)
        osmr[2] = OSMR2;
        osmr[3] = OSMR3;
        oier = OIER;
+       oscr = OSCR;
 }
 
 static void pxa_timer_resume(void)
 {
+       /*
+        * Ensure that we have at least MIN_OSCR_DELTA between match
+        * register 0 and the OSCR, to guarantee that we will receive
+        * the one-shot timer interrupt.  We adjust OSMR0 in preference
+        * to OSCR to guarantee that OSCR is monotonically incrementing.
+        */
+       if (osmr[0] - oscr < MIN_OSCR_DELTA)
+               osmr[0] += MIN_OSCR_DELTA;
+
        OSMR0 = osmr[0];
        OSMR1 = osmr[1];
        OSMR2 = osmr[2];
        OSMR3 = osmr[3];
        OIER = oier;
-
-       /*
-        * OSCR0 is the system timer, which has to increase
-        * monotonically until it rolls over in hardware.  The value
-        * (OSMR0 - LATCH) is OSCR0 at the most recent system tick,
-        * which is a handy value to restore to OSCR0.
-        */
-       OSCR = OSMR0 - LATCH;
+       OSCR = oscr;
 }
 #else
 #define pxa_timer_suspend NULL