X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fh8300%2Fplatform%2Fh8s%2Fedosk2674%2Ftimer.c;h=bfb1424482f47869af70594ec391f0491590e2b6;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=e49892e8e8a14fe7d9813dd94a67c9dc2d91bb58;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/h8300/platform/h8s/edosk2674/timer.c b/arch/h8300/platform/h8s/edosk2674/timer.c index e49892e8e..bfb142448 100644 --- a/arch/h8300/platform/h8s/edosk2674/timer.c +++ b/arch/h8300/platform/h8s/edosk2674/timer.c @@ -1,5 +1,5 @@ /* - * linux/arch/h8300/platform/h8s/generic/timer.c + * linux/arch/h8300/platform/h8s/edosk2674/timer.c * * Yoshinori Sato * @@ -7,7 +7,6 @@ * */ -#include #include #include #include @@ -23,25 +22,28 @@ #include #include -#define REGS(regs) __REGS(regs) -#define __REGS(regs) #regs +#define CMFA 6 -int __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) +#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 *)) { - unsigned char mstpcrl; - mstpcrl = ctrl_inb(MSTPCRL); /* Enable timer */ - mstpcrl &= ~0x01; - ctrl_outb(mstpcrl,MSTPCRL); - ctrl_outb(H8300_TIMER_COUNT_DATA,_8TCORA1); - ctrl_outb(0x00,_8TCSR1); - request_irq(76,timer_int,0,"timer",0); - ctrl_outb(0x40|0x08|0x03,_8TCR1); - return 0; + /* 8bit timer module enabled */ + ctrl_outb(ctrl_inb(MSTPCRL) & ~0x01, MSTPCRL); + /* setup 8bit timer ch1 */ + ctrl_outb(H8300_TIMER_FREQ / HZ, _8TCORA1); /* set interval */ + ctrl_outb(0x00, _8TCSR1); /* no output */ + request_irq(76, timer_int, 0, "timer" ,0); + ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR1); /* start count */ } void platform_timer_eoi(void) { - __asm__("bclr #6,@" REGS(_8TCSR1) ":8"); + *(volatile unsigned char *)_8TCSR1 &= ~(1 << CMFA); } void platform_gettod(int *year, int *mon, int *day, int *hour,