diff options
author | John Stultz <johnstul@us.ibm.com> | 2010-03-03 22:57:18 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-03-12 19:14:09 -0500 |
commit | 739b27116a0e6903d6c85d6769e69f43d8fa4128 (patch) | |
tree | 8ab72706065125cb409e014d1c4576d32f08536b | |
parent | f7a56575fa4e62e94a644f72ef8c5d423c073982 (diff) |
frv: Convert frv to use read/update_persistent_clock
This patch converts the frv architecture to use the generic
read_persistent_clock and update_persistent_clock interfaces, reducing
the amount of arch specific code we have to maintain, and allowing for
further cleanups in the future.
I have not built or tested this patch, so help from arch maintainers
would be appreciated.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <1267675049-12337-4-git-send-email-johnstul@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/frv/kernel/time.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c index fb0ce7577225..0ddbbae83cb2 100644 --- a/arch/frv/kernel/time.c +++ b/arch/frv/kernel/time.c | |||
@@ -48,20 +48,12 @@ static struct irqaction timer_irq = { | |||
48 | .name = "timer", | 48 | .name = "timer", |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static inline int set_rtc_mmss(unsigned long nowtime) | ||
52 | { | ||
53 | return -1; | ||
54 | } | ||
55 | |||
56 | /* | 51 | /* |
57 | * timer_interrupt() needs to keep up the real-time clock, | 52 | * timer_interrupt() needs to keep up the real-time clock, |
58 | * as well as call the "do_timer()" routine every clocktick | 53 | * as well as call the "do_timer()" routine every clocktick |
59 | */ | 54 | */ |
60 | static irqreturn_t timer_interrupt(int irq, void *dummy) | 55 | static irqreturn_t timer_interrupt(int irq, void *dummy) |
61 | { | 56 | { |
62 | /* last time the cmos clock got updated */ | ||
63 | static long last_rtc_update = 0; | ||
64 | |||
65 | profile_tick(CPU_PROFILING); | 57 | profile_tick(CPU_PROFILING); |
66 | /* | 58 | /* |
67 | * Here we are in the timer irq handler. We just have irqs locally | 59 | * Here we are in the timer irq handler. We just have irqs locally |
@@ -74,22 +66,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy) | |||
74 | 66 | ||
75 | do_timer(1); | 67 | do_timer(1); |
76 | 68 | ||
77 | /* | ||
78 | * If we have an externally synchronized Linux clock, then update | ||
79 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
80 | * called as close as possible to 500 ms before the new second starts. | ||
81 | */ | ||
82 | if (ntp_synced() && | ||
83 | xtime.tv_sec > last_rtc_update + 660 && | ||
84 | (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && | ||
85 | (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2 | ||
86 | ) { | ||
87 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
88 | last_rtc_update = xtime.tv_sec; | ||
89 | else | ||
90 | last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ | ||
91 | } | ||
92 | |||
93 | #ifdef CONFIG_HEARTBEAT | 69 | #ifdef CONFIG_HEARTBEAT |
94 | static unsigned short n; | 70 | static unsigned short n; |
95 | n++; | 71 | n++; |
@@ -119,7 +95,8 @@ void time_divisor_init(void) | |||
119 | __set_TCSR_DATA(0, base >> 8); | 95 | __set_TCSR_DATA(0, base >> 8); |
120 | } | 96 | } |
121 | 97 | ||
122 | void time_init(void) | 98 | |
99 | void read_persistent_clock(struct timespec *ts) | ||
123 | { | 100 | { |
124 | unsigned int year, mon, day, hour, min, sec; | 101 | unsigned int year, mon, day, hour, min, sec; |
125 | 102 | ||
@@ -135,9 +112,12 @@ void time_init(void) | |||
135 | 112 | ||
136 | if ((year += 1900) < 1970) | 113 | if ((year += 1900) < 1970) |
137 | year += 100; | 114 | year += 100; |
138 | xtime.tv_sec = mktime(year, mon, day, hour, min, sec); | 115 | ts->tv_sec = mktime(year, mon, day, hour, min, sec); |
139 | xtime.tv_nsec = 0; | 116 | ts->tv_nsec = 0; |
117 | } | ||
140 | 118 | ||
119 | void time_init(void) | ||
120 | { | ||
141 | /* install scheduling interrupt handler */ | 121 | /* install scheduling interrupt handler */ |
142 | setup_irq(IRQ_CPU_TIMER0, &timer_irq); | 122 | setup_irq(IRQ_CPU_TIMER0, &timer_irq); |
143 | 123 | ||