aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-w90x900/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-w90x900/time.c')
-rw-r--r--arch/arm/mach-w90x900/time.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c
new file mode 100644
index 000000000000..3a69e381f316
--- /dev/null
+++ b/arch/arm/mach-w90x900/time.c
@@ -0,0 +1,80 @@
1/*
2 * linux/arch/arm/mach-w90x900/time.c
3 *
4 * Based on linux/arch/arm/plat-s3c24xx/time.c by Ben Dooks
5 *
6 * Copyright (c) 2008 Nuvoton technology corporation
7 * All rights reserved.
8 *
9 * Wan ZongShun <mcuos.com@gmail.com>
10 *
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.
15 *
16 */
17
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>
26
27#include <asm/mach-types.h>
28#include <asm/mach/irq.h>
29#include <asm/mach/time.h>
30
31#include <mach/system.h>
32#include <mach/map.h>
33#include <mach/regs-timer.h>
34
35static unsigned long w90x900_gettimeoffset(void)
36{
37 return 0;
38}
39
40/*IRQ handler for the timer*/
41
42static irqreturn_t
43w90x900_timer_interrupt(int irq, void *dev_id)
44{
45 timer_tick();
46 __raw_writel(0x01, REG_TISR); /* clear TIF0 */
47 return IRQ_HANDLED;
48}
49
50static struct irqaction w90x900_timer_irq = {
51 .name = "w90x900 Timer Tick",
52 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
53 .handler = w90x900_timer_interrupt,
54};
55
56/*Set up timer reg.*/
57
58static void w90x900_timer_setup(void)
59{
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);
68}
69
70static void __init w90x900_timer_init(void)
71{
72 w90x900_timer_setup();
73 setup_irq(IRQ_TIMER0, &w90x900_timer_irq);
74}
75
76struct sys_timer w90x900_timer = {
77 .init = w90x900_timer_init,
78 .offset = w90x900_gettimeoffset,
79 .resume = w90x900_timer_setup
80};