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
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>
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/system.h>
33 #include <mach/regs-timer.h>
35 static unsigned long w90x900_gettimeoffset(void)
40 /*IRQ handler for the timer*/
43 w90x900_timer_interrupt(int irq, void *dev_id)
46 __raw_writel(0x01, REG_TISR); /* clear TIF0 */
50 static struct irqaction w90x900_timer_irq = {
51 .name = "w90x900 Timer Tick",
52 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
53 .handler = w90x900_timer_interrupt,
58 static void w90x900_timer_setup(void)
60 __raw_writel(0, REG_TCSR0);
61 __raw_writel(0, REG_TCSR1);
62 __raw_writel(0, REG_TCSR2);
63 __raw_writel(0, REG_TCSR3);
64 __raw_writel(0, REG_TCSR4);
65 __raw_writel(0x1F, REG_TISR);
66 __raw_writel(15000000/(100 * 100), REG_TICR0);
67 __raw_writel(0x68000063, REG_TCSR0);
70 static void __init w90x900_timer_init(void)
72 w90x900_timer_setup();
73 setup_irq(IRQ_TIMER0, &w90x900_timer_irq);
76 struct sys_timer w90x900_timer = {
77 .init = w90x900_timer_init,
78 .offset = w90x900_gettimeoffset,
79 .resume = w90x900_timer_setup