diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-19 20:10:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-19 20:10:06 -0400 |
commit | 7d02093e29de9efc4a72d5e93baae9506969b789 (patch) | |
tree | a6fc2450132ae419934f6eb9d223baa338b7d782 /arch/blackfin | |
parent | 6e0b7b2c39b91b467270dd0bc383914f99e1fb28 (diff) | |
parent | e9ddbc075d95b2edf111247cdde16f33c31654a8 (diff) |
Merge branch 'timers-for-linus-cleanups' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-for-linus-cleanups' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
avr32: Fix typo in read_persistent_clock()
sparc: Convert sparc to use read/update_persistent_clock
cris: Convert cris to use read/update_persistent_clock
m68k: Convert m68k to use read/update_persistent_clock
m32r: Convert m32r to use read/update_peristent_clock
blackfin: Convert blackfin to use read/update_persistent_clock
ia64: Convert ia64 to use read/update_persistent_clock
avr32: Convert avr32 to use read/update_persistent_clock
h8300: Convert h8300 to use read/update_persistent_clock
frv: Convert frv to use read/update_persistent_clock
mn10300: Convert mn10300 to use read/update_persistent_clock
alpha: Convert alpha to use read/update_persistent_clock
xtensa: Fix unnecessary setting of xtime
time: Clean up direct xtime usage in xen
Diffstat (limited to 'arch/blackfin')
-rw-r--r-- | arch/blackfin/kernel/time-ts.c | 13 | ||||
-rw-r--r-- | arch/blackfin/kernel/time.c | 39 |
2 files changed, 13 insertions, 39 deletions
diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c index cb7a01d4f009..8c9a43daf80f 100644 --- a/arch/blackfin/kernel/time-ts.c +++ b/arch/blackfin/kernel/time-ts.c | |||
@@ -353,9 +353,15 @@ void bfin_coretmr_clockevent_init(void) | |||
353 | #endif /* CONFIG_TICKSOURCE_CORETMR */ | 353 | #endif /* CONFIG_TICKSOURCE_CORETMR */ |
354 | 354 | ||
355 | 355 | ||
356 | void __init time_init(void) | 356 | void read_persistent_clock(struct timespec *ts) |
357 | { | 357 | { |
358 | time_t secs_since_1970 = (365 * 37 + 9) * 24 * 60 * 60; /* 1 Jan 2007 */ | 358 | time_t secs_since_1970 = (365 * 37 + 9) * 24 * 60 * 60; /* 1 Jan 2007 */ |
359 | ts->tv_sec = secs_since_1970; | ||
360 | ts->tv_nsec = 0; | ||
361 | } | ||
362 | |||
363 | void __init time_init(void) | ||
364 | { | ||
359 | 365 | ||
360 | #ifdef CONFIG_RTC_DRV_BFIN | 366 | #ifdef CONFIG_RTC_DRV_BFIN |
361 | /* [#2663] hack to filter junk RTC values that would cause | 367 | /* [#2663] hack to filter junk RTC values that would cause |
@@ -368,11 +374,6 @@ void __init time_init(void) | |||
368 | } | 374 | } |
369 | #endif | 375 | #endif |
370 | 376 | ||
371 | /* Initialize xtime. From now on, xtime is updated with timer interrupts */ | ||
372 | xtime.tv_sec = secs_since_1970; | ||
373 | xtime.tv_nsec = 0; | ||
374 | set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); | ||
375 | |||
376 | bfin_cs_cycles_init(); | 377 | bfin_cs_cycles_init(); |
377 | bfin_cs_gptimer0_init(); | 378 | bfin_cs_gptimer0_init(); |
378 | 379 | ||
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 | ||
115 | static 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 |
127 | irqreturn_t timer_interrupt(int irq, void *dummy) | 122 | irqreturn_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 | ||
164 | void __init time_init(void) | 138 | void 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 | ||
145 | void __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 | } |