Commit 044836d4 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 7e5829c1 ee206dc5
...@@ -304,6 +304,39 @@ int do_settimeofday(struct timespec *tv) ...@@ -304,6 +304,39 @@ int do_settimeofday(struct timespec *tv)
EXPORT_SYMBOL(do_settimeofday); EXPORT_SYMBOL(do_settimeofday);
/**
* save_time_delta - Save the offset between system time and RTC time
* @delta: pointer to timespec to store delta
* @rtc: pointer to timespec for current RTC time
*
* Return a delta between the system time and the RTC time, such
* that system time can be restored later with restore_time_delta()
*/
void save_time_delta(struct timespec *delta, struct timespec *rtc)
{
set_normalized_timespec(delta,
xtime.tv_sec - rtc->tv_sec,
xtime.tv_nsec - rtc->tv_nsec);
}
EXPORT_SYMBOL(save_time_delta);
/**
* restore_time_delta - Restore the current system time
* @delta: delta returned by save_time_delta()
* @rtc: pointer to timespec for current RTC time
*/
void restore_time_delta(struct timespec *delta, struct timespec *rtc)
{
struct timespec ts;
set_normalized_timespec(&ts,
delta->tv_sec + rtc->tv_sec,
delta->tv_nsec + rtc->tv_nsec);
do_settimeofday(&ts);
}
EXPORT_SYMBOL(restore_time_delta);
void timer_tick(struct pt_regs *regs) void timer_tick(struct pt_regs *regs)
{ {
profile_tick(CPU_PROFILING, regs); profile_tick(CPU_PROFILING, regs);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/arch/pxa-regs.h> #include <asm/arch/pxa-regs.h>
#include <asm/arch/lubbock.h> #include <asm/arch/lubbock.h>
#include <asm/mach/time.h>
/* /*
...@@ -69,14 +70,16 @@ static int pxa_pm_enter(u32 state) ...@@ -69,14 +70,16 @@ static int pxa_pm_enter(u32 state)
{ {
unsigned long sleep_save[SLEEP_SAVE_SIZE]; unsigned long sleep_save[SLEEP_SAVE_SIZE];
unsigned long checksum = 0; unsigned long checksum = 0;
unsigned long delta; struct timespec delta, rtc;
int i; int i;
if (state != PM_SUSPEND_MEM) if (state != PM_SUSPEND_MEM)
return -EINVAL; return -EINVAL;
/* preserve current time */ /* preserve current time */
delta = xtime.tv_sec - RCNR; rtc.tv_sec = RCNR;
rtc.tv_nsec = 0;
save_time_delta(&delta, &rtc);
/* save vital registers */ /* save vital registers */
SAVE(OSMR0); SAVE(OSMR0);
...@@ -161,7 +164,8 @@ static int pxa_pm_enter(u32 state) ...@@ -161,7 +164,8 @@ static int pxa_pm_enter(u32 state)
RESTORE(ICMR); RESTORE(ICMR);
/* restore current time */ /* restore current time */
xtime.tv_sec = RCNR + delta; rtc.tv_sec = RCNR;
restore_time_delta(&delta, &rtc);
#ifdef DEBUG #ifdef DEBUG
printk(KERN_DEBUG "*** made it back from resume\n"); printk(KERN_DEBUG "*** made it back from resume\n");
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/memory.h> #include <asm/memory.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/mach/time.h>
extern void sa1100_cpu_suspend(void); extern void sa1100_cpu_suspend(void);
extern void sa1100_cpu_resume(void); extern void sa1100_cpu_resume(void);
...@@ -58,14 +59,16 @@ enum { SLEEP_SAVE_SP = 0, ...@@ -58,14 +59,16 @@ enum { SLEEP_SAVE_SP = 0,
static int sa11x0_pm_enter(u32 state) static int sa11x0_pm_enter(u32 state)
{ {
unsigned long sleep_save[SLEEP_SAVE_SIZE]; unsigned long gpio, sleep_save[SLEEP_SAVE_SIZE];
unsigned long delta, gpio; struct timespec delta, rtc;
if (state != PM_SUSPEND_MEM) if (state != PM_SUSPEND_MEM)
return -EINVAL; return -EINVAL;
/* preserve current time */ /* preserve current time */
delta = xtime.tv_sec - RCNR; rtc.tv_sec = RCNR;
rtc.tv_nsec = 0;
save_time_delta(&delta, &rtc);
gpio = GPLR; gpio = GPLR;
/* save vital registers */ /* save vital registers */
...@@ -136,7 +139,8 @@ static int sa11x0_pm_enter(u32 state) ...@@ -136,7 +139,8 @@ static int sa11x0_pm_enter(u32 state)
OSCR = OSMR0 - LATCH; OSCR = OSMR0 - LATCH;
/* restore current time */ /* restore current time */
xtime.tv_sec = RCNR + delta; rtc.tv_sec = RCNR;
restore_time_delta(&delta, &rtc);
return 0; return 0;
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/swap.h> #include <linux/swap.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/mman.h>
#include <linux/initrd.h> #include <linux/initrd.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
......
...@@ -13,8 +13,11 @@ ...@@ -13,8 +13,11 @@
extern void (*init_arch_time)(void); extern void (*init_arch_time)(void);
extern int (*set_rtc)(void); extern int (*set_rtc)(void);
extern unsigned long(*gettimeoffset)(void); extern unsigned long (*gettimeoffset)(void);
void timer_tick(struct pt_regs *); extern void timer_tick(struct pt_regs *);
extern void save_time_delta(struct timespec *delta, struct timespec *rtc);
extern void restore_time_delta(struct timespec *delta, struct timespec *rtc);
#endif #endif
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