Merge branch 'master' of git://git.infradead.org/users/dwmw2/solos-2.6
[pandora-kernel.git] / arch / arm / mach-omap2 / timer-gp.c
index f36aba1..97eeeeb 100644 (file)
  *
  * Some parts based off of TI's 24xx code:
  *
- *   Copyright (C) 2004 Texas Instruments, Inc.
+ * Copyright (C) 2004-2009 Texas Instruments, Inc.
  *
  * Roughly modelled after the OMAP1 MPU timer code.
+ * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License. See the file "COPYING" in the main directory of this archive
@@ -37,6 +38,7 @@
 
 #include <asm/mach/time.h>
 #include <mach/dmtimer.h>
+#include <asm/localtimer.h>
 
 /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
 #define MAX_GPTIMER_ID         12
@@ -82,7 +84,8 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
        case CLOCK_EVT_MODE_PERIODIC:
                period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ;
                period -= 1;
-
+               if (cpu_is_omap44xx())
+                       period = 0xff;  /* FIXME: */
                omap_dm_timer_set_load_start(gptimer, 1, 0xffffffff - period);
                break;
        case CLOCK_EVT_MODE_ONESHOT:
@@ -145,6 +148,9 @@ static void __init omap2_gp_clockevent_init(void)
                     "timer-gp: omap_dm_timer_set_source() failed\n");
 
        tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer));
+       if (cpu_is_omap44xx())
+               /* Assuming 32kHz clk is driving GPT1 */
+               tick_rate = 32768;      /* FIXME: */
 
        pr_info("OMAP clockevent source: GPTIMER%d at %u Hz\n",
                gptimer_id, tick_rate);
@@ -224,6 +230,9 @@ static void __init omap2_gp_clocksource_init(void)
 
 static void __init omap2_gp_timer_init(void)
 {
+#ifdef CONFIG_LOCAL_TIMERS
+       twd_base = IO_ADDRESS(OMAP44XX_LOCAL_TWD_BASE);
+#endif
        omap_dm_timer_init();
 
        omap2_gp_clockevent_init();