|
@@ -15,6 +15,7 @@
|
|
#include <linux/time.h>
|
|
#include <linux/time.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/module.h>
|
|
#include <linux/module.h>
|
|
|
|
+#include <linux/rtc.h>
|
|
|
|
|
|
#include "tick-internal.h"
|
|
#include "tick-internal.h"
|
|
|
|
|
|
@@ -483,8 +484,7 @@ out:
|
|
return leap;
|
|
return leap;
|
|
}
|
|
}
|
|
|
|
|
|
-#ifdef CONFIG_GENERIC_CMOS_UPDATE
|
|
|
|
-
|
|
|
|
|
|
+#if defined(CONFIG_GENERIC_CMOS_UPDATE) || defined(CONFIG_RTC_SYSTOHC)
|
|
static void sync_cmos_clock(struct work_struct *work);
|
|
static void sync_cmos_clock(struct work_struct *work);
|
|
|
|
|
|
static DECLARE_DELAYED_WORK(sync_cmos_work, sync_cmos_clock);
|
|
static DECLARE_DELAYED_WORK(sync_cmos_work, sync_cmos_clock);
|
|
@@ -510,14 +510,22 @@ static void sync_cmos_clock(struct work_struct *work)
|
|
}
|
|
}
|
|
|
|
|
|
getnstimeofday(&now);
|
|
getnstimeofday(&now);
|
|
- if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2)
|
|
|
|
|
|
+ if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2) {
|
|
|
|
+ fail = -ENODEV;
|
|
|
|
+#ifdef CONFIG_GENERIC_CMOS_UPDATE
|
|
fail = update_persistent_clock(now);
|
|
fail = update_persistent_clock(now);
|
|
|
|
+#endif
|
|
|
|
+#ifdef CONFIG_RTC_SYSTOHC
|
|
|
|
+ if (fail == -ENODEV)
|
|
|
|
+ fail = rtc_set_ntp_time(now);
|
|
|
|
+#endif
|
|
|
|
+ }
|
|
|
|
|
|
next.tv_nsec = (NSEC_PER_SEC / 2) - now.tv_nsec - (TICK_NSEC / 2);
|
|
next.tv_nsec = (NSEC_PER_SEC / 2) - now.tv_nsec - (TICK_NSEC / 2);
|
|
if (next.tv_nsec <= 0)
|
|
if (next.tv_nsec <= 0)
|
|
next.tv_nsec += NSEC_PER_SEC;
|
|
next.tv_nsec += NSEC_PER_SEC;
|
|
|
|
|
|
- if (!fail)
|
|
|
|
|
|
+ if (!fail || fail == -ENODEV)
|
|
next.tv_sec = 659;
|
|
next.tv_sec = 659;
|
|
else
|
|
else
|
|
next.tv_sec = 0;
|
|
next.tv_sec = 0;
|