]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-sa1100/time.c
[ARM] Fix timer damage from d3d74453c34f8fd87674a8cf5b8a327c68f22e99
[linux-2.6-omap-h63xx.git] / arch / arm / mach-sa1100 / time.c
index 4284bd6f7a1f583c2af51cc98be24f7e6f638e87..47f8640438e6a9d6ede96c45e7933b864a2037e4 100644 (file)
 #define RTC_DEF_DIVIDER                (32768 - 1)
 #define RTC_DEF_TRIM            0
 
-static unsigned long __init sa1100_get_rtc_time(void)
-{
-       /*
-        * According to the manual we should be able to let RTTR be zero
-        * and then a default diviser for a 32.768KHz clock is used.
-        * Apparently this doesn't work, at least for my SA1110 rev 5.
-        * If the clock divider is uninitialized then reset it to the
-        * default value to get the 1Hz clock.
-        */
-       if (RTTR == 0) {
-               RTTR = RTC_DEF_DIVIDER + (RTC_DEF_TRIM << 16);
-               printk(KERN_WARNING "Warning: uninitialized Real Time Clock\n");
-               /* The current RTC value probably doesn't make sense either */
-               RCNR = 0;
-               return 0;
-       }
-       return RCNR;
-}
-
 static int sa1100_set_rtc(void)
 {
        unsigned long current_time = xtime.tv_sec;
@@ -81,8 +62,6 @@ sa1100_timer_interrupt(int irq, void *dev_id)
 {
        unsigned int next_match;
 
-       write_seqlock(&xtime_lock);
-
 #ifdef CONFIG_NO_IDLE_HZ
        if (match_posponed) {
                match_posponed = 0;
@@ -104,34 +83,28 @@ sa1100_timer_interrupt(int irq, void *dev_id)
                next_match = (OSMR0 += LATCH);
        } while ((signed long)(next_match - OSCR) <= 0);
 
-       write_sequnlock(&xtime_lock);
-
        return IRQ_HANDLED;
 }
 
 static struct irqaction sa1100_timer_irq = {
        .name           = "SA11xx Timer Tick",
-       .flags          = IRQF_DISABLED | IRQF_TIMER,
+       .flags          = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
        .handler        = sa1100_timer_interrupt,
 };
 
 static void __init sa1100_timer_init(void)
 {
-       struct timespec tv;
+       unsigned long flags;
 
        set_rtc = sa1100_set_rtc;
 
-       tv.tv_nsec = 0;
-       tv.tv_sec = sa1100_get_rtc_time();
-       do_settimeofday(&tv);
-
        OIER = 0;               /* disable any timer interrupts */
-       OSCR = LATCH*2;         /* push OSCR out of the way */
-       OSMR0 = LATCH;          /* set initial match */
        OSSR = 0xf;             /* clear status on all timers */
        setup_irq(IRQ_OST0, &sa1100_timer_irq);
+       local_irq_save(flags);
        OIER = OIER_E0;         /* enable match on timer 0 to cause interrupts */
-       OSCR = 0;               /* initialize free-running timer */
+       OSMR0 = OSCR + LATCH;   /* set initial match */
+       local_irq_restore(flags);
 }
 
 #ifdef CONFIG_NO_IDLE_HZ