Merge branch 'omap4-i2c-init' into omap-for-linus
[pandora-kernel.git] / arch / arm / mach-integrator / integrator_cp.c
index 9997d1f..cde57b2 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/list.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
-#include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/sysdev.h>
 #include <linux/amba/bus.h>
@@ -21,6 +20,7 @@
 #include <linux/amba/clcd.h>
 #include <linux/amba/mmci.h>
 #include <linux/io.h>
+#include <linux/gfp.h>
 
 #include <asm/clkdev.h>
 #include <mach/clkdev.h>
@@ -29,7 +29,8 @@
 #include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
-#include <asm/hardware/icst525.h>
+#include <asm/hardware/arm_timer.h>
+#include <asm/hardware/icst.h>
 
 #include <mach/cm.h>
 #include <mach/lm.h>
@@ -40,7 +41,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 
-#include "common.h"
+#include <plat/timer-sp.h>
 
 #define INTCP_PA_FLASH_BASE            0x24000000
 #define INTCP_FLASH_SIZE               SZ_32M
@@ -265,8 +266,8 @@ static void __init intcp_init_irq(void)
 /*
  * Clock handling
  */
-#define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
-#define CM_AUXOSC IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x1c)
+#define CM_LOCK                (__io_address(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_LOCK_OFFSET)
+#define CM_AUXOSC      (__io_address(INTEGRATOR_HDR_BASE)+0x1c)
 
 static const struct icst_params cp_auxvco_params = {
        .ref            = 24000000,
@@ -284,17 +285,24 @@ static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
 {
        u32 val;
 
-       val = readl(CM_AUXOSC) & ~0x7ffff;
+       val = readl(clk->vcoreg) & ~0x7ffff;
        val |= vco.v | (vco.r << 9) | (vco.s << 16);
 
        writel(0xa05f, CM_LOCK);
-       writel(val, CM_AUXOSC);
+       writel(val, clk->vcoreg);
        writel(0, CM_LOCK);
 }
 
+static const struct clk_ops cp_auxclk_ops = {
+       .round  = icst_clk_round,
+       .set    = icst_clk_set,
+       .setvco = cp_auxvco_set,
+};
+
 static struct clk cp_auxclk = {
+       .ops    = &cp_auxclk_ops,
        .params = &cp_auxvco_params,
-       .setvco = cp_auxvco_set,
+       .vcoreg = CM_AUXOSC,
 };
 
 static struct clk_lookup cp_lookups[] = {
@@ -569,11 +577,18 @@ static void __init intcp_init(void)
        }
 }
 
-#define TIMER_CTRL_IE  (1 << 5)                        /* Interrupt Enable */
+#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE)
+#define TIMER1_VA_BASE __io_address(INTEGRATOR_TIMER1_BASE)
+#define TIMER2_VA_BASE __io_address(INTEGRATOR_TIMER2_BASE)
 
 static void __init intcp_timer_init(void)
 {
-       integrator_time_init(1000, TIMER_CTRL_IE);
+       writel(0, TIMER0_VA_BASE + TIMER_CTRL);
+       writel(0, TIMER1_VA_BASE + TIMER_CTRL);
+       writel(0, TIMER2_VA_BASE + TIMER_CTRL);
+
+       sp804_clocksource_init(TIMER2_VA_BASE);
+       sp804_clockevents_init(TIMER1_VA_BASE, IRQ_TIMERINT1);
 }
 
 static struct sys_timer cp_timer = {