X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fh8300%2Fplatform%2Fh8300h%2Fh8max%2Ftimer.c;h=9ac9fa6691c01484c3ac1f130ea18f86fa3151b9;hb=746550cff061581f89c687ada8523670768364f2;hp=745da9d277651ce6030c7c711d0317a319e843ad;hpb=86090fcac5e27b630656fe3d963a6b80e26dac44;p=linux-2.6.git diff --git a/arch/h8300/platform/h8300h/h8max/timer.c b/arch/h8300/platform/h8300h/h8max/timer.c index 745da9d27..9ac9fa669 100644 --- a/arch/h8300/platform/h8300h/h8max/timer.c +++ b/arch/h8300/platform/h8300h/h8max/timer.c @@ -25,12 +25,19 @@ #define CMFA 6 +#define CMIEA 0x40 +#define CCLR_CMA 0x08 +#define CLK_DIV8192 0x03 + +#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */ + void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) { - ctrl_outb(H8300_TIMER_COUNT_DATA,TCORA2); - ctrl_outb(0x00,_8TCSR2); - request_irq(40,timer_int,0,"timer",0); - ctrl_outb(0x40|0x08|0x03,_8TCR2); + /* setup 8bit timer ch2 */ + ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2); /* set interval */ + ctrl_outb(0x00, _8TCSR2); /* no output */ + request_irq(40, timer_int, 0, "timer", 0); + ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR2); /* start count */ } void platform_timer_eoi(void)