Merge git://git.infradead.org/mtd-2.6
[cascardo/linux.git] / arch / arm / mach-nomadik / board-nhk8815.c
index 781b915..9438bf6 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/flash.h>
+
+#include <plat/mtu.h>
+
 #include <mach/setup.h>
 #include <mach/nand.h>
 #include <mach/fsmc.h>
 #include "clock.h"
 
+/* Initial value for SRC control register: all timers use MXTAL/8 source */
+#define SRC_CR_INIT_MASK       0x00007fff
+#define SRC_CR_INIT_VAL                0x2aaa8000
+
 /* These adresses span 16MB, so use three individual pages */
 static struct resource nhk8815_nand_resources[] = {
        {
@@ -240,6 +247,26 @@ static struct platform_device *nhk8815_platform_devices[] __initdata = {
        /* will add more devices */
 };
 
+static void __init nomadik_timer_init(void)
+{
+       u32 src_cr;
+
+       /* Configure timer sources in "system reset controller" ctrl reg */
+       src_cr = readl(io_p2v(NOMADIK_SRC_BASE));
+       src_cr &= SRC_CR_INIT_MASK;
+       src_cr |= SRC_CR_INIT_VAL;
+       writel(src_cr, io_p2v(NOMADIK_SRC_BASE));
+
+       /* Save global pointer to mtu, used by platform timer code */
+       mtu_base = io_p2v(NOMADIK_MTU0_BASE);
+
+       nmdk_timer_init();
+}
+
+static struct sys_timer nomadik_timer = {
+       .init   = nomadik_timer_init,
+};
+
 static void __init nhk8815_platform_init(void)
 {
        int i;