Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6/sactl.git] / arch / arm / mach-w90x900 / time.c
blobbcc838f6b3936236d68c50bc54be24f775ecb263
1 /*
2 * linux/arch/arm/mach-w90x900/time.c
4 * Based on linux/arch/arm/plat-s3c24xx/time.c by Ben Dooks
6 * Copyright (c) 2008 Nuvoton technology corporation
7 * All rights reserved.
9 * Wan ZongShun <mcuos.com@gmail.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
18 #include <linux/kernel.h>
19 #include <linux/sched.h>
20 #include <linux/init.h>
21 #include <linux/interrupt.h>
22 #include <linux/err.h>
23 #include <linux/clk.h>
24 #include <linux/io.h>
25 #include <linux/leds.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/irq.h>
29 #include <asm/mach/time.h>
31 #include <mach/map.h>
32 #include <mach/regs-timer.h>
34 static unsigned long w90x900_gettimeoffset(void)
36 return 0;
39 /*IRQ handler for the timer*/
41 static irqreturn_t
42 w90x900_timer_interrupt(int irq, void *dev_id)
44 timer_tick();
45 __raw_writel(0x01, REG_TISR); /* clear TIF0 */
46 return IRQ_HANDLED;
49 static struct irqaction w90x900_timer_irq = {
50 .name = "w90x900 Timer Tick",
51 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
52 .handler = w90x900_timer_interrupt,
55 /*Set up timer reg.*/
57 static void w90x900_timer_setup(void)
59 __raw_writel(0, REG_TCSR0);
60 __raw_writel(0, REG_TCSR1);
61 __raw_writel(0, REG_TCSR2);
62 __raw_writel(0, REG_TCSR3);
63 __raw_writel(0, REG_TCSR4);
64 __raw_writel(0x1F, REG_TISR);
65 __raw_writel(15000000/(100 * 100), REG_TICR0);
66 __raw_writel(0x68000063, REG_TCSR0);
69 static void __init w90x900_timer_init(void)
71 w90x900_timer_setup();
72 setup_irq(IRQ_TIMER0, &w90x900_timer_irq);
75 struct sys_timer w90x900_timer = {
76 .init = w90x900_timer_init,
77 .offset = w90x900_gettimeoffset,
78 .resume = w90x900_timer_setup