initial commit with v2.6.9
[linux-2.6.9-moxart.git] / arch / arm / mach-epxa10db / time.c
blob7d72a433dad79608a4febb9e29a9ced5ce9b8f5b
1 /*
2 * linux/arch/arm/mach-epxa10db/time.c
4 * Copyright (C) 2000 Deep Blue Solutions
5 * Copyright (C) 2001 Altera Corporation
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/interrupt.h>
14 #include <linux/sched.h>
16 #include <asm/hardware.h>
17 #include <asm/system.h>
18 #include <asm/leds.h>
20 #include <asm/mach/time.h>
22 #define TIMER00_TYPE (volatile unsigned int*)
23 #include <asm/arch/timer00.h>
25 static int epxa10db_set_rtc(void)
27 return 1;
30 static int epxa10db_rtc_init(void)
32 set_rtc = epxa10db_set_rtc;
34 return 0;
37 __initcall(epxa10db_rtc_init);
41 * IRQ handler for the timer
43 static irqreturn_t
44 epxa10db_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
47 // ...clear the interrupt
48 *TIMER0_CR(IO_ADDRESS(EXC_TIMER00_BASE))|=TIMER0_CR_CI_MSK;
50 timer_tick(regs);
52 return IRQ_HANDLED;
55 static struct irqaction epxa10db_timer_irq = {
56 .name = "Excalibur Timer Tick",
57 .flags = SA_INTERRUPT,
58 .handler = epxa10db_timer_interrupt
62 * Set up timer interrupt, and return the current time in seconds.
64 void __init epxa10db_init_time(void)
66 /* Start the timer */
67 *TIMER0_LIMIT(IO_ADDRESS(EXC_TIMER00_BASE))=(unsigned int)(EXC_AHB2_CLK_FREQUENCY/200);
68 *TIMER0_PRESCALE(IO_ADDRESS(EXC_TIMER00_BASE))=1;
69 *TIMER0_CR(IO_ADDRESS(EXC_TIMER00_BASE))=TIMER0_CR_IE_MSK | TIMER0_CR_S_MSK;
71 setup_irq(IRQ_TIMER0, &epxa10db_timer_irq);