]> git.hungrycats.org Git - linux/commitdiff
[ARM PATCH] 2094/1: don't lose the system timer after resuming from sleep on SA11x0 and
authorNicolas Pitre <nico@org.rmk.(none)>
Tue, 14 Sep 2004 10:54:04 +0000 (11:54 +0100)
committerRussell King <rmk@flint.arm.linux.org.uk>
Tue, 14 Sep 2004 10:54:04 +0000 (11:54 +0100)
 PXA2xx

Patch from Nicolas Pitre

Let's make sure OSCR doesn't end up to be restored with a value
past OSMR0 otherwise the system timer won't start ticking until
OSCR wraps around (aprox 17 min.

Also set OSCR _after_ OIER is restored to avoid matching when
corresponding match interrupt is masked out.

Signed-off-by: Nicolas Pitre
arch/arm/mach-pxa/pm.c
arch/arm/mach-sa1100/pm.c

index 245e25b08f2f83449621fa9abe4a4165e8614fdd..c1c44321af72e077526d6f6649866d0696fca1ca 100644 (file)
@@ -45,7 +45,7 @@ extern void pxa_cpu_resume(void);
  */
 enum { SLEEP_SAVE_START = 0,
 
-       SLEEP_SAVE_OSCR, SLEEP_SAVE_OIER,
+       SLEEP_SAVE_OIER,
        SLEEP_SAVE_OSMR0, SLEEP_SAVE_OSMR1, SLEEP_SAVE_OSMR2, SLEEP_SAVE_OSMR3,
 
        SLEEP_SAVE_GPLR0, SLEEP_SAVE_GPLR1, SLEEP_SAVE_GPLR2,
@@ -78,7 +78,6 @@ static int pxa_pm_enter(u32 state)
        delta = xtime.tv_sec - RCNR;
 
        /* save vital registers */
-       SAVE(OSCR);
        SAVE(OSMR0);
        SAVE(OSMR1);
        SAVE(OSMR2);
@@ -149,9 +148,11 @@ static int pxa_pm_enter(u32 state)
        RESTORE(OSMR1);
        RESTORE(OSMR2);
        RESTORE(OSMR3);
-       RESTORE(OSCR);
        RESTORE(OIER);
 
+       /* OSMR0 is the system timer: make sure OSCR is sufficiently behind */
+       OSCR = OSMR0 - LATCH;
+
        RESTORE(CKEN);
 
        ICLR = 0;
index 2532b7f8009b605103e688aeb8c31a0cc265446a..604e703b522662510815c9787dada4f6149c1c74 100644 (file)
@@ -44,7 +44,7 @@ extern void sa1100_cpu_resume(void);
  */
 enum { SLEEP_SAVE_SP = 0,
 
-       SLEEP_SAVE_OSCR, SLEEP_SAVE_OIER,
+       SLEEP_SAVE_OIER,
        SLEEP_SAVE_OSMR0, SLEEP_SAVE_OSMR1, SLEEP_SAVE_OSMR2, SLEEP_SAVE_OSMR3,
 
        SLEEP_SAVE_GPDR, SLEEP_SAVE_GAFR,
@@ -69,7 +69,6 @@ static int sa11x0_pm_enter(u32 state)
        gpio = GPLR;
 
        /* save vital registers */
-       SAVE(OSCR);
        SAVE(OSMR0);
        SAVE(OSMR1);
        SAVE(OSMR2);
@@ -131,9 +130,11 @@ static int sa11x0_pm_enter(u32 state)
        RESTORE(OSMR1);
        RESTORE(OSMR2);
        RESTORE(OSMR3);
-       RESTORE(OSCR);
        RESTORE(OIER);
 
+       /* OSMR0 is the system timer: make sure OSCR is sufficiently behind */
+       OSCR = OSMR0 - LATCH;
+
        /* restore current time */
        xtime.tv_sec = RCNR + delta;