/* setup match20 to interrupt once every 10ms */ 
/* setup match20 to interrupt once every HZ */ 
void au1xxx_timer_setup(struct irqaction *irq){        unsigned int est_freq;	extern unsigned long (*do_gettimeoffset)(void);	printk("calculating r4koff... ");	r4k_offset = cal_r4koff();	printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset);	//est_freq = 2*r4k_offset*HZ;	est_freq = r4k_offset*HZ;	est_freq += 5000;    /* round */	est_freq -= est_freq%10000;	printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,	       (est_freq%1000000)*100/1000000); 	set_au1x00_speed(est_freq); 	set_au1x00_lcd_clock(); // program the LCD clock	r4k_cur = (read_c0_count() + r4k_offset);	write_c0_compare(r4k_cur);#ifdef CONFIG_PM	/*	 * setup counter 0, since it keeps ticking after a	 * 'wait' instruction has been executed. The CP0 timer and	 * counter 1 do NOT continue running after 'wait'	 *	 * It's too early to call request_irq() here, so we handle	 * counter 0 interrupt as a special irq and it doesn't show	 * up under /proc/interrupts.	 *	 * Check to ensure we really have a 32KHz oscillator before	 * we do this.	 */	if (no_au1xxx_32khz) {		unsigned int c0_status;		printk("WARNING: no 32KHz clock found.\n");		do_gettimeoffset = do_fast_cp0_gettimeoffset;		/* Ensure we get CPO_COUNTER interrupts.		*/		c0_status = read_c0_status();		c0_status |= IE_IRQ5;		write_c0_status(c0_status);	}	else {		while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);		au_writel(0, SYS_TOYWRITE);		while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);		au_writel(au_readl(SYS_WAKEMSK) | (1<<8), SYS_WAKEMSK);		au_writel(~0, SYS_WAKESRC);		au_sync();		while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);		/* setup match20 to interrupt once every 10ms */		last_pc0 = last_match20 = au_readl(SYS_TOYREAD);		au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);		au_sync();		while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);		startup_match20_interrupt(counter0_irq);		do_gettimeoffset = do_fast_pm_gettimeoffset;		/* We can use the real 'wait' instruction.		*/		allow_au1k_wait = 1;	}#else	/* We have to do this here instead of in timer_init because	 * the generic code in arch/mips/kernel/time.c will write	 * over our function pointer.	 */	do_gettimeoffset = do_fast_cp0_gettimeoffset;#endif}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/3ce86ee14ba7c4b0f8ddae6030df9d0dee15b236/time.c/clean/arch/mips/au1000/common/time.c