summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@kernel.crashing.org>2003-01-06 18:29:52 -0700
committerTom Rini <trini@kernel.crashing.org>2003-01-06 18:29:52 -0700
commitd4f7a1127a14bfe68fb80ffeef3b61e362cad7e5 (patch)
tree07a332adfbdb323baa381f2d098a5ddbcb671bdb
parent87113c38e7f9cde3d70cb77aea2e55855a868379 (diff)
PPC32: Fix a delay which could occur when booting on machines
without an RTC.
-rw-r--r--arch/ppc/kernel/time.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
index c23238e70b69..14c583e45876 100644
--- a/arch/ppc/kernel/time.c
+++ b/arch/ppc/kernel/time.c
@@ -286,13 +286,11 @@ void do_settimeofday(struct timeval *tv)
write_unlock_irqrestore(&xtime_lock, flags);
}
-
+/* This function is only called on the boot processor */
void __init time_init(void)
{
time_t sec, old_sec;
unsigned old_stamp, stamp, elapsed;
- /* This function is only called on the boot processor */
- unsigned long flags;
if (ppc_md.time_init != NULL)
time_offset = ppc_md.time_init();
@@ -309,31 +307,31 @@ void __init time_init(void)
/* Now that the decrementer is calibrated, it can be used in case the
* clock is stuck, but the fact that we have to handle the 601
* makes things more complex. Repeatedly read the RTC until the
- * next second boundary to try to achieve some precision...
+ * next second boundary to try to achieve some precision. If there
+ * is no RTC, we still need to set tb_last_stamp and
+ * last_jiffy_stamp(cpu 0) to the current stamp.
*/
+ stamp = get_native_tbl();
if (ppc_md.get_rtc_time) {
- stamp = get_native_tbl();
sec = ppc_md.get_rtc_time();
elapsed = 0;
do {
old_stamp = stamp;
old_sec = sec;
stamp = get_native_tbl();
- if (__USE_RTC() && stamp < old_stamp) old_stamp -= 1000000000;
+ if (__USE_RTC() && stamp < old_stamp)
+ old_stamp -= 1000000000;
elapsed += stamp - old_stamp;
sec = ppc_md.get_rtc_time();
} while ( sec == old_sec && elapsed < 2*HZ*tb_ticks_per_jiffy);
- if (sec==old_sec) {
+ if (sec==old_sec)
printk("Warning: real time clock seems stuck!\n");
- }
- write_lock_irqsave(&xtime_lock, flags);
xtime.tv_sec = sec;
- last_jiffy_stamp(0) = tb_last_stamp = stamp;
xtime.tv_nsec = 0;
/* No update now, we just read the time from the RTC ! */
last_rtc_update = xtime.tv_sec;
- write_unlock_irqrestore(&xtime_lock, flags);
}
+ last_jiffy_stamp(0) = tb_last_stamp = stamp;
/* Not exact, but the timer interrupt takes care of this */
set_dec(tb_ticks_per_jiffy);