aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/kernel/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/avr32/kernel/time.c')
-rw-r--r--arch/avr32/kernel/time.c45
1 files changed, 8 insertions, 37 deletions
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 36a46c3ae308..bf2f762e6a47 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -38,9 +38,15 @@ cycle_t __weak read_cycle_count(void)
38 return (cycle_t)sysreg_read(COUNT); 38 return (cycle_t)sysreg_read(COUNT);
39} 39}
40 40
41/*
42 * The architectural cycle count registers are a fine clocksource unless
43 * the system idle loop use sleep states like "idle": the CPU cycles
44 * measured by COUNT (and COMPARE) don't happen during sleep states.
45 * So we rate the clocksource using COUNT as very low quality.
46 */
41struct clocksource __weak clocksource_avr32 = { 47struct clocksource __weak clocksource_avr32 = {
42 .name = "avr32", 48 .name = "avr32",
43 .rating = 350, 49 .rating = 50,
44 .read = read_cycle_count, 50 .read = read_cycle_count,
45 .mask = CLOCKSOURCE_MASK(32), 51 .mask = CLOCKSOURCE_MASK(32),
46 .shift = 16, 52 .shift = 16,
@@ -55,22 +61,6 @@ struct irqaction timer_irqaction = {
55 .name = "timer", 61 .name = "timer",
56}; 62};
57 63
58/*
59 * By default we provide the null RTC ops
60 */
61static unsigned long null_rtc_get_time(void)
62{
63 return mktime(2007, 1, 1, 0, 0, 0);
64}
65
66static int null_rtc_set_time(unsigned long sec)
67{
68 return 0;
69}
70
71static unsigned long (*rtc_get_time)(void) = null_rtc_get_time;
72static int (*rtc_set_time)(unsigned long) = null_rtc_set_time;
73
74static void avr32_timer_ack(void) 64static void avr32_timer_ack(void)
75{ 65{
76 u32 count; 66 u32 count;
@@ -190,7 +180,7 @@ void __init time_init(void)
190 */ 180 */
191 sysreg_write(COMPARE, 0); 181 sysreg_write(COMPARE, 0);
192 182
193 xtime.tv_sec = rtc_get_time(); 183 xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0);
194 xtime.tv_nsec = 0; 184 xtime.tv_nsec = 0;
195 185
196 set_normalized_timespec(&wall_to_monotonic, 186 set_normalized_timespec(&wall_to_monotonic,
@@ -212,22 +202,3 @@ void __init time_init(void)
212 return; 202 return;
213 } 203 }
214} 204}
215
216static struct sysdev_class timer_class = {
217 .name = "timer",
218};
219
220static struct sys_device timer_device = {
221 .id = 0,
222 .cls = &timer_class,
223};
224
225static int __init init_timer_sysfs(void)
226{
227 int err = sysdev_class_register(&timer_class);
228 if (!err)
229 err = sysdev_register(&timer_device);
230 return err;
231}
232
233device_initcall(init_timer_sysfs);