Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d142b6e77d394a4fcc0a42381b03852bd9c4e263
Commit:     d142b6e77d394a4fcc0a42381b03852bd9c4e263
Parent:     9b73e76f3cf63379dcf45fcd4f112f5812418d0a
Author:     Russell King <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 12 21:55:12 2007 +0000
Committer:  Russell King <[EMAIL PROTECTED]>
CommitDate: Sat Jan 26 14:40:57 2008 +0000

    [ARM] sa1100: add clock source support
    
    Add generic clock source support for SA11x0 platforms.
    
    Signed-off-by: Russell King <[EMAIL PROTECTED]>
---
 arch/arm/Kconfig            |    1 +
 arch/arm/mach-sa1100/time.c |   38 ++++++++++++++++++++------------------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a04f507..7425279 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -366,6 +366,7 @@ config ARCH_SA1100
        select ARCH_DISCONTIGMEM_ENABLE
        select ARCH_MTD_XIP
        select GENERIC_GPIO
+       select GENERIC_TIME
        help
          Support for StrongARM 11x0 based boards.
 
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index fdf7b01..7298435 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -14,6 +14,7 @@
 #include <linux/irq.h>
 #include <linux/timex.h>
 #include <linux/signal.h>
+#include <linux/clocksource.h>
 
 #include <asm/mach/time.h>
 #include <asm/hardware.h>
@@ -35,23 +36,6 @@ static int sa1100_set_rtc(void)
        return 0;
 }
 
-/* IRQs are disabled before entering here from do_gettimeofday() */
-static unsigned long sa1100_gettimeoffset (void)
-{
-       unsigned long ticks_to_match, elapsed, usec;
-
-       /* Get ticks before next timer match */
-       ticks_to_match = OSMR0 - OSCR;
-
-       /* We need elapsed ticks since last match */
-       elapsed = LATCH - ticks_to_match;
-
-       /* Now convert them to usec */
-       usec = (unsigned long)(elapsed * (tick_nsec / 1000))/LATCH;
-
-       return usec;
-}
-
 #ifdef CONFIG_NO_IDLE_HZ
 static unsigned long initial_match;
 static int match_posponed;
@@ -96,6 +80,20 @@ static struct irqaction sa1100_timer_irq = {
        .handler        = sa1100_timer_interrupt,
 };
 
+static cycle_t sa1100_read_oscr(void)
+{
+       return OSCR;
+}
+
+static struct clocksource cksrc_sa1100_oscr = {
+       .name           = "oscr",
+       .rating         = 200,
+       .read           = sa1100_read_oscr,
+       .mask           = CLOCKSOURCE_MASK(32),
+       .shift          = 20,
+       .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
+};
+
 static void __init sa1100_timer_init(void)
 {
        unsigned long flags;
@@ -109,6 +107,11 @@ static void __init sa1100_timer_init(void)
        OIER = OIER_E0;         /* enable match on timer 0 to cause interrupts 
*/
        OSMR0 = OSCR + LATCH;   /* set initial match */
        local_irq_restore(flags);
+
+       cksrc_sa1100_oscr.mult =
+               clocksource_hz2mult(CLOCK_TICK_RATE, cksrc_sa1100_oscr.shift);
+
+       clocksource_register(&cksrc_sa1100_oscr);
 }
 
 #ifdef CONFIG_NO_IDLE_HZ
@@ -182,7 +185,6 @@ struct sys_timer sa1100_timer = {
        .init           = sa1100_timer_init,
        .suspend        = sa1100_timer_suspend,
        .resume         = sa1100_timer_resume,
-       .offset         = sa1100_gettimeoffset,
 #ifdef CONFIG_NO_IDLE_HZ
        .dyn_tick       = &sa1100_dyn_tick,
 #endif
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to