ARM: OMAP: Fix clockevent support for hrtimers
authorKevin Hilman <khilman@mvista.com>
Fri, 19 Oct 2007 06:04:43 +0000 (23:04 -0700)
committerTony Lindgren <tony@atomide.com>
Thu, 20 Mar 2008 14:56:09 +0000 (16:56 +0200)
One-shot mode was broken in MPU-timer support for OMAP1 due to a typo.

Also, ensure timer is stopped before changing the auto-reload flag.
The TRM says changing the AR flag when timer is running is undefined.

Also set GENERIC_CLOCKEVENTS for all omaps.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/Kconfig
arch/arm/mach-omap1/time.c
arch/arm/plat-omap/Kconfig

index 955fc53c1c019e1c47acf52251bdb30fa36cceb1..4039a133006e8a2c0af987b99914334a6abac90f 100644 (file)
@@ -469,6 +469,7 @@ config ARCH_OMAP
        bool "TI OMAP"
        select GENERIC_GPIO
        select GENERIC_TIME
+       select GENERIC_CLOCKEVENTS
        help
          Support for TI's OMAP platform (OMAP1 and OMAP2).
 
index 237651ebae5da555be9e346b36f154400d9acaa7..572a2dbc72ab765ca3c4b2081071aaee9ddad420 100644 (file)
@@ -132,13 +132,20 @@ static inline void omap_mpu_timer_start(int nr, unsigned long load_val,
        timer->cntl = timerflags;
 }
 
+static inline void omap_mpu_timer_stop(int nr)
+{
+       volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
+
+       timer->cntl &= ~MPU_TIMER_ST;
+}
+
 /*
  * ---------------------------------------------------------------------------
  * MPU timer 1 ... count down to zero, interrupt, reload
  * ---------------------------------------------------------------------------
  */
 static int omap_mpu_set_next_event(unsigned long cycles,
-                                   struct clock_event_device *evt)
+                                  struct clock_event_device *evt)
 {
        omap_mpu_timer_start(0, cycles, 0);
        return 0;
@@ -152,6 +159,7 @@ static void omap_mpu_set_mode(enum clock_event_mode mode,
                omap_mpu_set_autoreset(0);
                break;
        case CLOCK_EVT_MODE_ONESHOT:
+               omap_mpu_timer_stop(0);
                omap_mpu_remove_autoreset(0);
                break;
        case CLOCK_EVT_MODE_UNUSED:
index c1f7e5a819a3fdac417a4100902ed68fa4786090..b917206ee9068036f6e17570162595a16afbdf38 100644 (file)
@@ -11,7 +11,6 @@ choice
 
 config ARCH_OMAP1
        bool "TI OMAP1"
-       select GENERIC_CLOCKEVENTS
 
 config ARCH_OMAP2
        bool "TI OMAP2"