Subject: [PATCH][MIPS] set up Cobalt's mips_hpt_frequency

From: Yoichi Yuasa <[email-masked]>
Date: Sun, 9 Dec 2007 21:22:04 +0900

Set up Cobalt's mips_hpt_frequency.

Signed-off-by: Yoichi Yuasa <[email-masked]>

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);
 }

---

From: Ralf Baechle <[email-masked]>
Date: Sun, 9 Dec 2007 19:10:39 +0000

> Set up Cobalt's mips_hpt_frequency.

Queue for 2.6.25.  Thanks,

  Ralf

---

From: Yoichi Yuasa <[email-masked]>
Date: Mon, 10 Dec 2007 09:36:27 +0900

On Sun, 9 Dec 2007 19:10:39 +0000

> Queue for 2.6.25.  Thanks,

Cobalt cannot boot as this patch doesn't exist.
Please apply 2.6.24-rc too.

Thanks,

Yoichi

---

From: Sergei Shtylyov <[email-masked]>
Date: Mon, 10 Dec 2007 15:03:45 +0300

Hello.

> +++ mips/arch/mips/cobalt/time.c	2007-12-09 17:13:37.916769000 +0900

    s/between/during/

WBR, Sergei

---

From: Ralf Baechle <[email-masked]>
Date: Mon, 10 Dec 2007 13:15:02 +0000

> Please apply 2.6.24-rc too.

Ah, sorry.  Applied.

  Ralf

---

From: Ralf Baechle <[email-masked]>
Date: Mon, 10 Dec 2007 13:22:17 +0000

>> +	 * MIPS counter frequency is measured between 100msec 

Fixed.  The patch which will go to Linus will have the typo fix comment
folded into the actual mips_hpt_frequency patch.

  Ralf