Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH][MIPS] set up Cobalt's mips_hpt_frequency
@ 2007-12-09 12:22 Yoichi Yuasa
  2007-12-09 19:10 ` Ralf Baechle
  2007-12-10 12:03 ` Sergei Shtylyov
  0 siblings, 2 replies; 6+ messages in thread
From: Yoichi Yuasa @ 2007-12-09 12:22 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: yoichi_yuasa, linux-mips

Set up Cobalt's mips_hpt_frequency.

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/cobalt/time.c mips/arch/mips/cobalt/time.c
--- mips-orig/arch/mips/cobalt/time.c	2007-12-06 18:27:02.689043750 +0900
+++ mips/arch/mips/cobalt/time.c	2007-12-09 17:13:37.916769000 +0900
@@ -27,9 +27,28 @@
 
 void __init plat_time_init(void)
 {
+	u32 start, end;
+	int i = HZ / 10;
+
 	setup_pit_timer();
 
 	gt641xx_set_base_clock(GT641XX_BASE_CLOCK);
 
-	mips_timer_state = gt641xx_timer0_state;
+	/*
+	 * MIPS counter frequency is measured between 100msec 
+	 * using GT64111 timer0.
+	 */
+	while (!gt641xx_timer0_state())
+		;
+
+	start = read_c0_count();
+
+	while (i--)
+		while (!gt641xx_timer0_state())
+			;
+
+	end = read_c0_count();
+
+	mips_hpt_frequency = (end - start) * 10;
+	printk(KERN_INFO "MIPS counter frequency %dHz\n", mips_hpt_frequency);
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-12-10 13:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-09 12:22 [PATCH][MIPS] set up Cobalt's mips_hpt_frequency Yoichi Yuasa
2007-12-09 19:10 ` Ralf Baechle
2007-12-10  0:36   ` Yoichi Yuasa
2007-12-10 13:15     ` Ralf Baechle
2007-12-10 12:03 ` Sergei Shtylyov
2007-12-10 13:22   ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox