diff options
author | Sebastian Siewior <bigeasy@linutronix.de> | 2008-04-28 05:43:01 -0400 |
---|---|---|
committer | Greg Ungerer <gerg@uclinux.org> | 2008-07-23 01:11:28 -0400 |
commit | 95469bd64a7a9ab405b566deb8c81d4aaf67ed9e (patch) | |
tree | 737b6971940e46bba0467e9808f6b101ce3cdb37 /arch/m68knommu | |
parent | 0df185f5a1430ab8b437be402d286ee0728ef9f8 (diff) |
m68knommu: complete generic time
do_set_rtc() isn't required because the work that is handled is
allready served if read_persistent_clock() & update_persistent_clock()
are implemented and CONFIG_GENERIC_CMOS_UPDATE is. sync_cmos_clock()
looks very familiar :)
Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68knommu')
-rw-r--r-- | arch/m68knommu/Kconfig | 4 | ||||
-rw-r--r-- | arch/m68knommu/kernel/time.c | 38 |
2 files changed, 14 insertions, 28 deletions
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig index 8e8441587c22..bfd35304d586 100644 --- a/arch/m68knommu/Kconfig +++ b/arch/m68knommu/Kconfig | |||
@@ -58,6 +58,10 @@ config GENERIC_TIME | |||
58 | bool | 58 | bool |
59 | default y | 59 | default y |
60 | 60 | ||
61 | config GENERIC_CMOS_UPDATE | ||
62 | bool | ||
63 | default y | ||
64 | |||
61 | config TIME_LOW_RES | 65 | config TIME_LOW_RES |
62 | bool | 66 | bool |
63 | default y | 67 | default y |
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c index d33ed9a84cc7..67944aa27280 100644 --- a/arch/m68knommu/kernel/time.c +++ b/arch/m68knommu/kernel/time.c | |||
@@ -33,27 +33,6 @@ static inline int set_rtc_mmss(unsigned long nowtime) | |||
33 | return -1; | 33 | return -1; |
34 | } | 34 | } |
35 | 35 | ||
36 | static inline void do_set_rtc(void) | ||
37 | { | ||
38 | /* last time the cmos clock got updated */ | ||
39 | static long last_rtc_update=0; | ||
40 | |||
41 | /* | ||
42 | * If we have an externally synchronized Linux clock, then update | ||
43 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
44 | * called as close as possible to 500 ms before the new second starts. | ||
45 | */ | ||
46 | if (ntp_synced() && | ||
47 | xtime.tv_sec > last_rtc_update + 660 && | ||
48 | (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && | ||
49 | (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { | ||
50 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
51 | last_rtc_update = xtime.tv_sec; | ||
52 | else | ||
53 | last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ | ||
54 | } | ||
55 | } | ||
56 | |||
57 | /* | 36 | /* |
58 | * timer_interrupt() needs to keep up the real-time clock, | 37 | * timer_interrupt() needs to keep up the real-time clock, |
59 | * as well as call the "do_timer()" routine every clocktick | 38 | * as well as call the "do_timer()" routine every clocktick |
@@ -68,8 +47,6 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy) | |||
68 | 47 | ||
69 | do_timer(1); | 48 | do_timer(1); |
70 | 49 | ||
71 | do_set_rtc(); | ||
72 | |||
73 | write_sequnlock(&xtime_lock); | 50 | write_sequnlock(&xtime_lock); |
74 | 51 | ||
75 | #ifndef CONFIG_SMP | 52 | #ifndef CONFIG_SMP |
@@ -93,12 +70,17 @@ static unsigned long read_rtc_mmss(void) | |||
93 | return mktime(year, mon, day, hour, min, sec);; | 70 | return mktime(year, mon, day, hour, min, sec);; |
94 | } | 71 | } |
95 | 72 | ||
96 | void time_init(void) | 73 | unsigned long read_persistent_clock(void) |
74 | { | ||
75 | return read_rtc_mmss(); | ||
76 | } | ||
77 | |||
78 | int update_persistent_clock(struct timespec now) | ||
97 | { | 79 | { |
98 | xtime.tv_sec = read_rtc_mmss(); | 80 | return set_rtc_mmss(now.tv_sec); |
99 | xtime.tv_nsec = 0; | 81 | } |
100 | wall_to_monotonic.tv_sec = -xtime.tv_sec; | ||
101 | 82 | ||
83 | void time_init(void) | ||
84 | { | ||
102 | hw_timer_init(); | 85 | hw_timer_init(); |
103 | } | 86 | } |
104 | |||