diff options
author | David Brownell <david-b@pacbell.net> | 2008-02-12 14:45:49 -0800 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-04-19 20:40:06 -0400 |
commit | 62c6df62f9575cffd673bfc395270e6896a12a60 (patch) | |
tree | b4e6522f9050dbb9170251c6144cab366b824398 /arch/avr32/kernel | |
parent | 040b28fc0a69281a46adcebd6b31dd74da4a8d49 (diff) |
avr32: start clocksource cleanup
Start cleaning up the AVR32 clocksource mess, starting with the cycle
counter clocksource: remove unneeded pseudo-RTC (just inline that
call to mktime) and associated build warning, and unused sysdev.
Add comment about the problem using the cycle counter register,
and adjust the clocksource rating accordingly. Later patches can
make this usable again (by disabling use of the idle state and
providing a proper clocksource without the weak binding hacks)
and move towards TCB-based clockevent support (including high
resolution timers) that's shared between AT91 and AVR32.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/kernel')
-rw-r--r-- | arch/avr32/kernel/time.c | 45 |
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) return (cycle_t)sysreg_read(COUNT); } +/* + * The architectural cycle count registers are a fine clocksource unless + * the system idle loop use sleep states like "idle": the CPU cycles + * measured by COUNT (and COMPARE) don't happen during sleep states. + * So we rate the clocksource using COUNT as very low quality. + */ struct clocksource __weak clocksource_avr32 = { .name = "avr32", - .rating = 350, + .rating = 50, .read = read_cycle_count, .mask = CLOCKSOURCE_MASK(32), .shift = 16, @@ -55,22 +61,6 @@ struct irqaction timer_irqaction = { .name = "timer", }; -/* - * By default we provide the null RTC ops - */ -static unsigned long null_rtc_get_time(void) -{ - return mktime(2007, 1, 1, 0, 0, 0); -} - -static int null_rtc_set_time(unsigned long sec) -{ - return 0; -} - -static unsigned long (*rtc_get_time)(void) = null_rtc_get_time; -static int (*rtc_set_time)(unsigned long) = null_rtc_set_time; - static void avr32_timer_ack(void) { u32 count; @@ -190,7 +180,7 @@ void __init time_init(void) */ sysreg_write(COMPARE, 0); - xtime.tv_sec = rtc_get_time(); + xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0); xtime.tv_nsec = 0; set_normalized_timespec(&wall_to_monotonic, @@ -212,22 +202,3 @@ void __init time_init(void) return; } } - -static struct sysdev_class timer_class = { - .name = "timer", -}; - -static struct sys_device timer_device = { - .id = 0, - .cls = &timer_class, -}; - -static int __init init_timer_sysfs(void) -{ - int err = sysdev_class_register(&timer_class); - if (!err) - err = sysdev_register(&timer_device); - return err; -} - -device_initcall(init_timer_sysfs); |