Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / h8300 / platform / h8300h / h8max / timer.c
blob9ac9fa6691c01484c3ac1f130ea18f86fa3151b9
1 /*
2 * linux/arch/h8300/platform/h8300h/h8max/timer.c
4 * Yoshinori Sato <ysato@users.sourcefoge.jp>
6 * Platform depend Timer Handler
8 */
10 #include <linux/config.h>
11 #include <linux/errno.h>
12 #include <linux/sched.h>
13 #include <linux/kernel.h>
14 #include <linux/param.h>
15 #include <linux/string.h>
16 #include <linux/mm.h>
17 #include <linux/interrupt.h>
18 #include <linux/init.h>
19 #include <linux/timex.h>
21 #include <asm/segment.h>
22 #include <asm/io.h>
23 #include <asm/irq.h>
24 #include <asm/regs306x.h>
26 #define CMFA 6
28 #define CMIEA 0x40
29 #define CCLR_CMA 0x08
30 #define CLK_DIV8192 0x03
32 #define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
34 void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
36 /* setup 8bit timer ch2 */
37 ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2); /* set interval */
38 ctrl_outb(0x00, _8TCSR2); /* no output */
39 request_irq(40, timer_int, 0, "timer", 0);
40 ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR2); /* start count */
43 void platform_timer_eoi(void)
45 *(volatile unsigned char *)_8TCSR2 &= ~(1 << CMFA);
48 void platform_gettod(int *year, int *mon, int *day, int *hour,
49 int *min, int *sec)
51 *year = *mon = *day = *hour = *min = *sec = 0;