diff options
Diffstat (limited to 'arch/m68knommu/kernel/time.c')
-rw-r--r-- | arch/m68knommu/kernel/time.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c index 0ccfb2ad6380..d182b2f72211 100644 --- a/arch/m68knommu/kernel/time.c +++ b/arch/m68knommu/kernel/time.c | |||
@@ -33,14 +33,13 @@ static inline int set_rtc_mmss(unsigned long nowtime) | |||
33 | return -1; | 33 | return -1; |
34 | } | 34 | } |
35 | 35 | ||
36 | #ifndef CONFIG_GENERIC_CLOCKEVENTS | ||
36 | /* | 37 | /* |
37 | * timer_interrupt() needs to keep up the real-time clock, | 38 | * timer_interrupt() needs to keep up the real-time clock, |
38 | * as well as call the "do_timer()" routine every clocktick | 39 | * as well as call the "do_timer()" routine every clocktick |
39 | */ | 40 | */ |
40 | irqreturn_t arch_timer_interrupt(int irq, void *dummy) | 41 | irqreturn_t arch_timer_interrupt(int irq, void *dummy) |
41 | { | 42 | { |
42 | /* last time the cmos clock got updated */ | ||
43 | static long last_rtc_update=0; | ||
44 | 43 | ||
45 | if (current->pid) | 44 | if (current->pid) |
46 | profile_tick(CPU_PROFILING); | 45 | profile_tick(CPU_PROFILING); |
@@ -49,21 +48,6 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy) | |||
49 | 48 | ||
50 | do_timer(1); | 49 | do_timer(1); |
51 | 50 | ||
52 | /* | ||
53 | * If we have an externally synchronized Linux clock, then update | ||
54 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
55 | * called as close as possible to 500 ms before the new second starts. | ||
56 | */ | ||
57 | if (ntp_synced() && | ||
58 | xtime.tv_sec > last_rtc_update + 660 && | ||
59 | (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && | ||
60 | (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { | ||
61 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
62 | last_rtc_update = xtime.tv_sec; | ||
63 | else | ||
64 | last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ | ||
65 | } | ||
66 | |||
67 | write_sequnlock(&xtime_lock); | 51 | write_sequnlock(&xtime_lock); |
68 | 52 | ||
69 | #ifndef CONFIG_SMP | 53 | #ifndef CONFIG_SMP |
@@ -71,8 +55,9 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy) | |||
71 | #endif | 55 | #endif |
72 | return(IRQ_HANDLED); | 56 | return(IRQ_HANDLED); |
73 | } | 57 | } |
58 | #endif | ||
74 | 59 | ||
75 | void time_init(void) | 60 | static unsigned long read_rtc_mmss(void) |
76 | { | 61 | { |
77 | unsigned int year, mon, day, hour, min, sec; | 62 | unsigned int year, mon, day, hour, min, sec; |
78 | 63 | ||
@@ -83,10 +68,21 @@ void time_init(void) | |||
83 | 68 | ||
84 | if ((year += 1900) < 1970) | 69 | if ((year += 1900) < 1970) |
85 | year += 100; | 70 | year += 100; |
86 | xtime.tv_sec = mktime(year, mon, day, hour, min, sec); | ||
87 | xtime.tv_nsec = 0; | ||
88 | wall_to_monotonic.tv_sec = -xtime.tv_sec; | ||
89 | 71 | ||
90 | hw_timer_init(); | 72 | return mktime(year, mon, day, hour, min, sec);; |
73 | } | ||
74 | |||
75 | unsigned long read_persistent_clock(void) | ||
76 | { | ||
77 | return read_rtc_mmss(); | ||
91 | } | 78 | } |
92 | 79 | ||
80 | int update_persistent_clock(struct timespec now) | ||
81 | { | ||
82 | return set_rtc_mmss(now.tv_sec); | ||
83 | } | ||
84 | |||
85 | void time_init(void) | ||
86 | { | ||
87 | hw_timer_init(); | ||
88 | } | ||