Example #1
0
void __init plat_time_init(void)
{
	u32 start, end;
	int i = HZ / 10;

	/* Set up the rate of periodic DS1287 interrupts. */
	ds1287_set_base_clock(HZ);

	if (cpu_has_counter) {
		while (!ds1287_timer_state())
			;

		start = read_c0_count();

		while (i--)
			while (!ds1287_timer_state())
				;

		end = read_c0_count();

		mips_hpt_frequency = (end - start) * 10;
		printk(KERN_INFO "MIPS counter frequency %dHz\n",
			mips_hpt_frequency);
	} else if (IOASIC)
		/* For pre-R4k systems we use the I/O ASIC's counter.  */
		dec_ioasic_clocksource_init();

	ds1287_clockevent_init(dec_interrupt[DEC_IRQ_RTC]);
}
Example #2
0
void __init dec_ioasic_clocksource_init(void)
{
	unsigned int freq;
	u32 start, end;
	int i = HZ / 10;


	while (!ds1287_timer_state())
		;

	start = dec_ioasic_hpt_read();

	while (i--)
		while (!ds1287_timer_state())
			;

	end = dec_ioasic_hpt_read();

	freq = (end - start) * 10;
	printk(KERN_INFO "I/O ASIC clock frequency %dHz\n", freq);

	clocksource_dec.rating = 200 + freq / 10000000;
	clocksource_set_clock(&clocksource_dec, freq);

	clocksource_register(&clocksource_dec);
}