vserver 1.9.5.x5
[linux-2.6.git] / arch / arm / mach-integrator / core.c
index 7f6df02..86c50c3 100644 (file)
@@ -24,6 +24,8 @@
 #include <asm/leds.h>
 #include <asm/mach/time.h>
 
+#include "common.h"
+
 static struct amba_device rtc_device = {
        .dev            = {
                .bus_id = "mb:15",
@@ -113,7 +115,7 @@ arch_initcall(integrator_init);
 
 #define CM_CTRL        IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET
 
-static spinlock_t cm_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(cm_lock);
 
 /**
  * cm_control - update the CM_CTRL register.
@@ -163,15 +165,13 @@ typedef struct TimerStruct {
        unsigned long TimerClear;
 } TimerStruct_t;
 
-extern unsigned long (*gettimeoffset)(void);
-
 static unsigned long timer_reload;
 
 /*
  * Returns number of ms since last clock interrupt.  Note that interrupts
  * will have been disabled by do_gettimeoffset()
  */
-static unsigned long integrator_gettimeoffset(void)
+unsigned long integrator_gettimeoffset(void)
 {
        volatile TimerStruct_t *timer1 = (TimerStruct_t *)TIMER1_VA_BASE;
        unsigned long ticks1, ticks2, status;
@@ -214,11 +214,15 @@ integrator_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
        volatile TimerStruct_t *timer1 = (volatile TimerStruct_t *)TIMER1_VA_BASE;
 
+       write_seqlock(&xtime_lock);
+
        // ...clear the interrupt
        timer1->TimerClear = 1;
 
        timer_tick(regs);
 
+       write_sequnlock(&xtime_lock);
+
        return IRQ_HANDLED;
 }
 
@@ -264,5 +268,4 @@ void __init integrator_time_init(unsigned long reload, unsigned int ctrl)
         * Make irqs happen for the system timer
         */
        setup_irq(IRQ_TIMERINT1, &integrator_timer_irq);
-       gettimeoffset = integrator_gettimeoffset;
 }