summaryrefslogtreecommitdiff
path: root/arch/m68k/kernel
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2012-01-23 13:25:56 +1000
committerGreg Ungerer <gerg@uclinux.org>2012-03-05 09:43:03 +1000
commit9517746131f62294ddd922bcd288415be5104c23 (patch)
tree1ca5433e9d25c1c2f34197a52bfa15fdec163fac /arch/m68k/kernel
parentd3f033f894c433d3c9bf347a0a84f45dac0b14ac (diff)
m68knommu: make persistent clock code consistent with m68k
The read_persistent_clock() code is different on m68knommu, for really no reason. With a few changes to support function names and some code re-organization the code can be made the same. This will make it easier to merge the arch/m68k/kernel/time.c for m68k and m68knommu in a future patch. Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68k/kernel')
-rw-r--r--arch/m68k/kernel/setup_no.c2
-rw-r--r--arch/m68k/kernel/time_no.c36
2 files changed, 14 insertions, 24 deletions
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index ca3df0dc7e88..8394b56b2c72 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -31,6 +31,7 @@
#include <linux/init.h>
#include <linux/initrd.h>
#include <linux/root_dev.h>
+#include <linux/rtc.h>
#include <asm/setup.h>
#include <asm/irq.h>
@@ -48,6 +49,7 @@ char __initdata command_line[COMMAND_LINE_SIZE];
/* machine dependent timer functions */
int (*mach_set_clock_mmss)(unsigned long);
+int (*mach_hwclk) (int, struct rtc_time*);
/* machine dependent reboot functions */
void (*mach_reset)(void);
diff --git a/arch/m68k/kernel/time_no.c b/arch/m68k/kernel/time_no.c
index 3ef0f7768dcd..ca3b3b4d4630 100644
--- a/arch/m68k/kernel/time_no.c
+++ b/arch/m68k/kernel/time_no.c
@@ -20,15 +20,11 @@
#include <linux/profile.h>
#include <linux/time.h>
#include <linux/timex.h>
+#include <linux/rtc.h>
#include <asm/machdep.h>
#include <asm/irq_regs.h>
-#define TICK_SIZE (tick_nsec / 1000)
-
-/* machine dependent timer functions */
-void (*mach_gettod)(int*, int*, int*, int*, int*, int*);
-
static inline int set_rtc_mmss(unsigned long nowtime)
{
if (mach_set_clock_mmss)
@@ -55,28 +51,20 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
}
#endif
-static unsigned long read_rtc_mmss(void)
-{
- unsigned int year, mon, day, hour, min, sec;
-
- if (mach_gettod) {
- mach_gettod(&year, &mon, &day, &hour, &min, &sec);
- if ((year += 1900) < 1970)
- year += 100;
- } else {
- year = 1970;
- mon = day = 1;
- hour = min = sec = 0;
- }
-
-
- return mktime(year, mon, day, hour, min, sec);
-}
-
void read_persistent_clock(struct timespec *ts)
{
- ts->tv_sec = read_rtc_mmss();
+ struct rtc_time time;
+ ts->tv_sec = 0;
ts->tv_nsec = 0;
+
+ if (mach_hwclk) {
+ mach_hwclk(0, &time);
+
+ if ((time.tm_year += 1900) < 1970)
+ time.tm_year += 100;
+ ts->tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday,
+ time.tm_hour, time.tm_min, time.tm_sec);
+ }
}
int update_persistent_clock(struct timespec now)