aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2009-03-04 15:39:12 -0500
committerChris Zankel <chris@zankel.net>2009-04-03 02:45:07 -0400
commit4476c96769ec083c53fbdbd37b538105deb65aa2 (patch)
treeae29b4d46fb63aab25a22da8eb6d4ab992f5b1e6 /arch
parent90be8c16950e28aee7cad422272805dcefa06167 (diff)
xtensa: remove platform rtc hooks
platform_get/set_rtc_time() is not implemented by any of the supported xtensa platforms. Remove the facility completely. The initial seconds for xtime come from read_persistent_clock() which returns just 0 in the generic implementation. Platforms that sport a persistent clock can implement this function. This is needed to implement the ccount as a clock source. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/xtensa/include/asm/platform.h11
-rw-r--r--arch/xtensa/kernel/platform.c2
-rw-r--r--arch/xtensa/kernel/time.c29
3 files changed, 1 insertions, 41 deletions
diff --git a/arch/xtensa/include/asm/platform.h b/arch/xtensa/include/asm/platform.h
index e3d5a48ad495..7d936e58e9be 100644
--- a/arch/xtensa/include/asm/platform.h
+++ b/arch/xtensa/include/asm/platform.h
@@ -74,16 +74,5 @@ extern int platform_pcibios_fixup (void);
74 */ 74 */
75extern void platform_calibrate_ccount (void); 75extern void platform_calibrate_ccount (void);
76 76
77/*
78 * platform_get_rtc_time returns RTC seconds (returns 0 for no error)
79 */
80extern int platform_get_rtc_time(time_t*);
81
82/*
83 * platform_set_rtc_time set RTC seconds (returns 0 for no error)
84 */
85extern int platform_set_rtc_time(time_t);
86
87
88#endif /* _XTENSA_PLATFORM_H */ 77#endif /* _XTENSA_PLATFORM_H */
89 78
diff --git a/arch/xtensa/kernel/platform.c b/arch/xtensa/kernel/platform.c
index 69675f216062..1b91a97f1d84 100644
--- a/arch/xtensa/kernel/platform.c
+++ b/arch/xtensa/kernel/platform.c
@@ -36,8 +36,6 @@ _F(void, power_off, (void), { while(1); });
36_F(void, idle, (void), { __asm__ __volatile__ ("waiti 0" ::: "memory"); }); 36_F(void, idle, (void), { __asm__ __volatile__ ("waiti 0" ::: "memory"); });
37_F(void, heartbeat, (void), { }); 37_F(void, heartbeat, (void), { });
38_F(int, pcibios_fixup, (void), { return 0; }); 38_F(int, pcibios_fixup, (void), { return 0; });
39_F(int, get_rtc_time, (time_t* t), { return 0; });
40_F(int, set_rtc_time, (time_t t), { return 0; });
41 39
42#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 40#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
43_F(void, calibrate_ccount, (void), 41_F(void, calibrate_ccount, (void),
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 86bfe83718e9..db14a3d88db7 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -14,7 +14,6 @@
14 14
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/time.h> 16#include <linux/time.h>
17#include <linux/timex.h>
18#include <linux/interrupt.h> 17#include <linux/interrupt.h>
19#include <linux/module.h> 18#include <linux/module.h>
20#include <linux/init.h> 19#include <linux/init.h>
@@ -25,18 +24,11 @@
25#include <asm/timex.h> 24#include <asm/timex.h>
26#include <asm/platform.h> 25#include <asm/platform.h>
27 26
28
29DEFINE_SPINLOCK(rtc_lock);
30EXPORT_SYMBOL(rtc_lock);
31
32
33#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 27#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
34unsigned long ccount_per_jiffy; /* per 1/HZ */ 28unsigned long ccount_per_jiffy; /* per 1/HZ */
35unsigned long nsec_per_ccount; /* nsec per ccount increment */ 29unsigned long nsec_per_ccount; /* nsec per ccount increment */
36#endif 30#endif
37 31
38static long last_rtc_update = 0;
39
40static irqreturn_t timer_interrupt(int irq, void *dev_id); 32static irqreturn_t timer_interrupt(int irq, void *dev_id);
41static struct irqaction timer_irqaction = { 33static struct irqaction timer_irqaction = {
42 .handler = timer_interrupt, 34 .handler = timer_interrupt,
@@ -46,8 +38,6 @@ static struct irqaction timer_irqaction = {
46 38
47void __init time_init(void) 39void __init time_init(void)
48{ 40{
49 time_t sec_o, sec_n = 0;
50
51 /* The platform must provide a function to calibrate the processor 41 /* The platform must provide a function to calibrate the processor
52 * speed for the CALIBRATE. 42 * speed for the CALIBRATE.
53 */ 43 */
@@ -59,15 +49,8 @@ void __init time_init(void)
59 (int)(ccount_per_jiffy/(10000/HZ))%100); 49 (int)(ccount_per_jiffy/(10000/HZ))%100);
60#endif 50#endif
61 51
62 /* Set time from RTC (if provided) */
63
64 if (platform_get_rtc_time(&sec_o) == 0)
65 while (platform_get_rtc_time(&sec_n))
66 if (sec_o != sec_n)
67 break;
68
69 xtime.tv_nsec = 0; 52 xtime.tv_nsec = 0;
70 last_rtc_update = xtime.tv_sec = sec_n; 53 xtime.tv_sec = read_persistent_clock();
71 54
72 set_normalized_timespec(&wall_to_monotonic, 55 set_normalized_timespec(&wall_to_monotonic,
73 -xtime.tv_sec, -xtime.tv_nsec); 56 -xtime.tv_sec, -xtime.tv_nsec);
@@ -169,16 +152,6 @@ again:
169 next += CCOUNT_PER_JIFFY; 152 next += CCOUNT_PER_JIFFY;
170 set_linux_timer(next); 153 set_linux_timer(next);
171 154
172 if (ntp_synced() &&
173 xtime.tv_sec - last_rtc_update >= 659 &&
174 abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ) {
175
176 if (platform_set_rtc_time(xtime.tv_sec+1) == 0)
177 last_rtc_update = xtime.tv_sec+1;
178 else
179 /* Do it again in 60 s */
180 last_rtc_update += 60;
181 }
182 write_sequnlock(&xtime_lock); 155 write_sequnlock(&xtime_lock);
183 } 156 }
184 157