Skip to content

Commit 18ca38d

Browse files
Yoichi Yuasaralfbaechle
authored andcommitted
[MIPS] time: Set up Cobalt's mips_hpt_frequency
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent da8cadb commit 18ca38d

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

‎arch/mips/cobalt/time.c‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,28 @@
2727

2828
void __init plat_time_init(void)
2929
{
30+
u32 start, end;
31+
int i = HZ / 10;
32+
3033
setup_pit_timer();
3134

3235
gt641xx_set_base_clock(GT641XX_BASE_CLOCK);
3336

34-
mips_timer_state = gt641xx_timer0_state;
37+
/*
38+
* MIPS counter frequency is measured during a 100msec interval
39+
* using GT64111 timer0.
40+
*/
41+
while (!gt641xx_timer0_state())
42+
;
43+
44+
start = read_c0_count();
45+
46+
while (i--)
47+
while (!gt641xx_timer0_state())
48+
;
49+
50+
end = read_c0_count();
51+
52+
mips_hpt_frequency = (end - start) * 10;
53+
printk(KERN_INFO "MIPS counter frequency %dHz\n", mips_hpt_frequency);
3554
}

0 commit comments

Comments
 (0)