diff options
Diffstat (limited to 'arch/mips/kernel/csrc-ioasic.c')
| -rw-r--r-- | arch/mips/kernel/csrc-ioasic.c | 20 | 
1 files changed, 12 insertions, 8 deletions
diff --git a/arch/mips/kernel/csrc-ioasic.c b/arch/mips/kernel/csrc-ioasic.c index 23da108506b..6cbbf6e106b 100644 --- a/arch/mips/kernel/csrc-ioasic.c +++ b/arch/mips/kernel/csrc-ioasic.c @@ -1,7 +1,7 @@  /*   *  DEC I/O ASIC's counter clocksource   * - *  Copyright (C) 2008  Yoichi Yuasa <yuasa@linux-mips.org> + *  Copyright (C) 2008	Yoichi Yuasa <yuasa@linux-mips.org>   *   *  This program is free software; you can redistribute it and/or modify   *  it under the terms of the GNU General Public License as published by @@ -37,13 +37,13 @@ static struct clocksource clocksource_dec = {  	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,  }; -void __init dec_ioasic_clocksource_init(void) +int __init dec_ioasic_clocksource_init(void)  {  	unsigned int freq;  	u32 start, end; -	int i = HZ / 10; - +	int i = HZ / 8; +	ds1287_timer_state();  	while (!ds1287_timer_state())  		; @@ -55,11 +55,15 @@ void __init dec_ioasic_clocksource_init(void)  	end = dec_ioasic_hpt_read(&clocksource_dec); -	freq = (end - start) * 10; +	freq = (end - start) * 8; + +	/* An early revision of the I/O ASIC didn't have the counter.  */ +	if (!freq) +		return -ENXIO; +  	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); +	clocksource_register_hz(&clocksource_dec, freq); +	return 0;  }  | 
