2 * linux/arch/h8300/kernel/cpu/timer/timer8.c
4 * Yoshinori Sato <ysato@users.sourcefoge.jp>
10 #include <linux/errno.h>
11 #include <linux/sched.h>
12 #include <linux/kernel.h>
13 #include <linux/param.h>
14 #include <linux/string.h>
16 #include <linux/interrupt.h>
17 #include <linux/init.h>
18 #include <linux/profile.h>
22 #include <asm/timer.h>
23 #if defined(CONFIG_CPU_H8300H)
24 #include <asm/regs306x.h>
26 #if defined(CONFIG_CPU_H8S)
27 #include <asm/regs267x.h>
33 #if defined(CONFIG_H8300_TIMER8_CH0)
35 #ifdef CONFIG_CPU_H8300H
41 #elif defined(CONFIG_H8300_TIMER8_CH2)
42 #ifdef CONFIG_CPU_H8300H
49 #error Unknown timer channel.
63 * timer_interrupt() needs to keep up the real-time clock,
64 * as well as call the "xtime_update()" routine every clocktick
67 static irqreturn_t
timer_interrupt(int irq
, void *dev_id
)
70 ctrl_bclr(CMFA
, _8BASE
+ _8TCSR
);
74 static struct irqaction timer8_irq
= {
76 .handler
= timer_interrupt
,
77 .flags
= IRQF_DISABLED
| IRQF_TIMER
,
80 static const int __initdata divide_rate
[] = {8, 64, 8192};
82 void __init
h8300_timer_setup(void)
87 calc_param(cnt
, div
, divide_rate
, 0x10000);
90 setup_irq(_8IRQ
, &timer8_irq
);
92 #if defined(CONFIG_CPU_H8S)
93 /* Timer module enable */
97 /* initialize timer */
98 ctrl_outw(cnt
, _8BASE
+ TCORA
);
99 ctrl_outw(0x0000, _8BASE
+ _8TCSR
);
100 ctrl_outw((CMIEA
|CCLR_CMA
|CKS2
) << 8 | div
,