aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/kernel/time.c')
-rw-r--r--arch/blackfin/kernel/time.c39
1 files changed, 6 insertions, 33 deletions
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index 13c1ee3e6408..c9113619029f 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -112,11 +112,6 @@ u32 arch_gettimeoffset(void)
112} 112}
113#endif 113#endif
114 114
115static inline int set_rtc_mmss(unsigned long nowtime)
116{
117 return 0;
118}
119
120/* 115/*
121 * timer_interrupt() needs to keep up the real-time clock, 116 * timer_interrupt() needs to keep up the real-time clock,
122 * as well as call the "do_timer()" routine every clocktick 117 * as well as call the "do_timer()" routine every clocktick
@@ -126,29 +121,8 @@ __attribute__((l1_text))
126#endif 121#endif
127irqreturn_t timer_interrupt(int irq, void *dummy) 122irqreturn_t timer_interrupt(int irq, void *dummy)
128{ 123{
129 /* last time the cmos clock got updated */
130 static long last_rtc_update;
131
132 write_seqlock(&xtime_lock); 124 write_seqlock(&xtime_lock);
133 do_timer(1); 125 do_timer(1);
134
135 /*
136 * If we have an externally synchronized Linux clock, then update
137 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
138 * called as close as possible to 500 ms before the new second starts.
139 */
140 if (ntp_synced() &&
141 xtime.tv_sec > last_rtc_update + 660 &&
142 (xtime.tv_nsec / NSEC_PER_USEC) >=
143 500000 - ((unsigned)TICK_SIZE) / 2
144 && (xtime.tv_nsec / NSEC_PER_USEC) <=
145 500000 + ((unsigned)TICK_SIZE) / 2) {
146 if (set_rtc_mmss(xtime.tv_sec) == 0)
147 last_rtc_update = xtime.tv_sec;
148 else
149 /* Do it again in 60s. */
150 last_rtc_update = xtime.tv_sec - 600;
151 }
152 write_sequnlock(&xtime_lock); 126 write_sequnlock(&xtime_lock);
153 127
154#ifdef CONFIG_IPIPE 128#ifdef CONFIG_IPIPE
@@ -161,10 +135,15 @@ irqreturn_t timer_interrupt(int irq, void *dummy)
161 return IRQ_HANDLED; 135 return IRQ_HANDLED;
162} 136}
163 137
164void __init time_init(void) 138void read_persistent_clock(struct timespec *ts)
165{ 139{
166 time_t secs_since_1970 = (365 * 37 + 9) * 24 * 60 * 60; /* 1 Jan 2007 */ 140 time_t secs_since_1970 = (365 * 37 + 9) * 24 * 60 * 60; /* 1 Jan 2007 */
141 ts->tv_sec = secs_since_1970;
142 ts->tv_nsec = 0;
143}
167 144
145void __init time_init(void)
146{
168#ifdef CONFIG_RTC_DRV_BFIN 147#ifdef CONFIG_RTC_DRV_BFIN
169 /* [#2663] hack to filter junk RTC values that would cause 148 /* [#2663] hack to filter junk RTC values that would cause
170 * userspace to have to deal with time values greater than 149 * userspace to have to deal with time values greater than
@@ -176,11 +155,5 @@ void __init time_init(void)
176 } 155 }
177#endif 156#endif
178 157
179 /* Initialize xtime. From now on, xtime is updated with timer interrupts */
180 xtime.tv_sec = secs_since_1970;
181 xtime.tv_nsec = 0;
182
183 wall_to_monotonic.tv_sec = -xtime.tv_sec;
184
185 time_sched_init(timer_interrupt); 158 time_sched_init(timer_interrupt);
186} 159}