Commit 8570a650 authored by Russell King's avatar Russell King

[ARM] Move OS timer suspend/resume from pm.c to time.c

This makes OS timer suspend/resume part of the system device power
management model.
parent 4dd3065f
......@@ -47,9 +47,6 @@ extern void pxa_cpu_resume(void);
*/
enum { SLEEP_SAVE_START = 0,
SLEEP_SAVE_OIER,
SLEEP_SAVE_OSMR0, SLEEP_SAVE_OSMR1, SLEEP_SAVE_OSMR2, SLEEP_SAVE_OSMR3,
SLEEP_SAVE_GPLR0, SLEEP_SAVE_GPLR1, SLEEP_SAVE_GPLR2,
SLEEP_SAVE_GPDR0, SLEEP_SAVE_GPDR1, SLEEP_SAVE_GPDR2,
SLEEP_SAVE_GRER0, SLEEP_SAVE_GRER1, SLEEP_SAVE_GRER2,
......@@ -81,13 +78,6 @@ static int pxa_pm_enter(u32 state)
rtc.tv_nsec = 0;
save_time_delta(&delta, &rtc);
/* save vital registers */
SAVE(OSMR0);
SAVE(OSMR1);
SAVE(OSMR2);
SAVE(OSMR3);
SAVE(OIER);
SAVE(GPLR0); SAVE(GPLR1); SAVE(GPLR2);
SAVE(GPDR0); SAVE(GPDR1); SAVE(GPDR2);
SAVE(GRER0); SAVE(GRER1); SAVE(GRER2);
......@@ -148,15 +138,6 @@ static int pxa_pm_enter(u32 state)
PSSR = PSSR_RDH | PSSR_PH;
RESTORE(OSMR0);
RESTORE(OSMR1);
RESTORE(OSMR2);
RESTORE(OSMR3);
RESTORE(OIER);
/* OSMR0 is the system timer: make sure OSCR is sufficiently behind */
OSCR = OSMR0 - LATCH;
RESTORE(CKEN);
ICLR = 0;
......
......@@ -123,12 +123,29 @@ static void __init pxa_timer_init(void)
}
#ifdef CONFIG_PM
static unsigned long osmr[4], oier;
static void pxa_timer_suspend(void)
{
osmr[0] = OSMR0;
osmr[1] = OSMR1;
osmr[2] = OSMR2;
osmr[3] = OSMR3;
oier = OIER;
}
static void pxa_timer_resume(void)
{
OSMR0 = osmr[0];
OSMR1 = osmr[1];
OSMR2 = osmr[2];
OSMR3 = osmr[3];
OIER = oier;
/*
* OSMR0 is the system timer: make sure OSCR is sufficiently behind
*/
OSCR = OSMR0 - LATCH;
}
#else
#define pxa_timer_suspend NULL
......
......@@ -45,9 +45,6 @@ extern void sa1100_cpu_resume(void);
*/
enum { SLEEP_SAVE_SP = 0,
SLEEP_SAVE_OIER,
SLEEP_SAVE_OSMR0, SLEEP_SAVE_OSMR1, SLEEP_SAVE_OSMR2, SLEEP_SAVE_OSMR3,
SLEEP_SAVE_GPDR, SLEEP_SAVE_GAFR,
SLEEP_SAVE_PPDR, SLEEP_SAVE_PPSR, SLEEP_SAVE_PPAR, SLEEP_SAVE_PSDR,
......@@ -72,12 +69,6 @@ static int sa11x0_pm_enter(u32 state)
gpio = GPLR;
/* save vital registers */
SAVE(OSMR0);
SAVE(OSMR1);
SAVE(OSMR2);
SAVE(OSMR3);
SAVE(OIER);
SAVE(GPDR);
SAVE(GAFR);
......@@ -129,15 +120,6 @@ static int sa11x0_pm_enter(u32 state)
*/
PSSR = PSSR_PH;
RESTORE(OSMR0);
RESTORE(OSMR1);
RESTORE(OSMR2);
RESTORE(OSMR3);
RESTORE(OIER);
/* OSMR0 is the system timer: make sure OSCR is sufficiently behind */
OSCR = OSMR0 - LATCH;
/* restore current time */
rtc.tv_sec = RCNR;
restore_time_delta(&delta, &rtc);
......
......@@ -117,12 +117,30 @@ static void __init sa1100_timer_init(void)
}
#ifdef CONFIG_PM
unsigned long osmr[4], oier;
static void sa1100_timer_suspend(void)
{
osmr[0] = OSMR0;
osmr[1] = OSMR1;
osmr[2] = OSMR2;
osmr[3] = OSMR3;
oier = OIER;
}
static void sa1100_timer_resume(void)
{
OSSR = 0x0f;
OSMR0 = osmr[0];
OSMR1 = osmr[1];
OSMR2 = osmr[2];
OSMR3 = osmr[3];
OIER = oier;
/*
* OSMR0 is the system timer: make sure OSCR is sufficiently behind
*/
OSCR = OSMR0 - LATCH;
}
#else
#define sa1100_timer_suspend NULL
......
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