Skip to contentSkip to conversation

Make mpc82xx use generic_calibrate_decr()

PATCH David Gibson 2 participants 3 messages Sep 13, 2007 PowerPC

lore
Share & tools
lore
#0 lore raw

The only difference between m82xx_calibrate_decr() and generic_calibrate_decr() is that the former computes the timebase frequency from the cpu node's bus-frequency property, instead of directly from the timebase-frequency property.

But there's no reason the timebase-frequency shouldn't be correct on 82xx like everything else. Certainly the 82xx bootwrapper in arch/powerpc/boot/cuboot-pq2.c should get it right.

Therefore, this patch removes mpc82xx_calibrate_decr(), using generic_calibrate_decr() instead.

---

I've compiled this, but no booted it, since I don't have any 82xx hardware. I'm hoping for an ack from someone who can test boot it.

arch/powerpc/platforms/82xx/mpc82xx_ads.c +1 -1
Index: working-2.6/arch/powerpc/platforms/82xx/mpc82xx_ads.c
===================================================================
@@ -635,6 +635,6 @@ define_machine(mpc82xx_ads)
 	.init_IRQ =    mpc82xx_ads_pic_init,
 	.show_cpuinfo =    mpc82xx_ads_show_cpuinfo,
 	.get_irq =    cpm2_get_irq,
-	.calibrate_decr =    m82xx_calibrate_decr,
+	.calibrate_decr = generic_calibrate_decr,
 	.restart = m82xx_restart,.halt = m82xx_halt,
 };
arch/powerpc/platforms/82xx/mpc82xx.c +0 -36
Index: working-2.6/arch/powerpc/platforms/82xx/mpc82xx.c
===================================================================
@@ -51,42 +51,6 @@
 
 #include "pq2ads.h"
 
-static int __init get_freq(char *name, unsigned long *val)
-{
-	struct device_node *cpu;
-	const unsigned int *fp;
-	int found = 0;
-
-	/* The cpu node should have timebase and clock frequency properties */
-	cpu = of_find_node_by_type(NULL, "cpu");
-
-	if (cpu) {
-		fp = of_get_property(cpu, name, NULL);
-		if (fp) {
-			found = 1;
-			*val = *fp;
-		}
-
-		of_node_put(cpu);
-	}
-
-	return found;
-}
-
-void __init m82xx_calibrate_decr(void)
-{
-	ppc_tb_freq = 125000000;
-	if (!get_freq("bus-frequency", &ppc_tb_freq)) {
-		printk(KERN_ERR "WARNING: Estimating decrementer frequency "
-				"(not found)\n");
-	}
-	ppc_tb_freq /= 4;
-	ppc_proc_freq = 1000000000;
-	if (!get_freq("clock-frequency", &ppc_proc_freq))
-		printk(KERN_ERR "WARNING: Estimating processor frequency"
-				"(not found)\n");
-}
-
 void mpc82xx_ads_show_cpuinfo(struct seq_file *m)
 {
 	uint pvid, svid, phid1;
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#1 lore raw
Quoted 9 lines · David Gibson

The only difference between m82xx_calibrate_decr() and generic_calibrate_decr() is that the former computes the timebase frequency from the cpu node's bus-frequency property, instead of directly from the timebase-frequency property.

But there's no reason the timebase-frequency shouldn't be correct on 82xx like everything else. Certainly the 82xx bootwrapper in arch/powerpc/boot/cuboot-pq2.c should get it right.

Quoted 8 lines

Therefore, this patch removes mpc82xx_calibrate_decr(), using generic_calibrate_decr() instead.

---

I've compiled this, but no booted it, since I don't have any 82xx hardware. I'm hoping for an ack from someone who can test boot it.

Scott's cleanup does this already for 82xx :)

- k

#2 lore raw
Quoted 15 lines · Kumar Gala
Quoted 12 lines · David Gibson

The only difference between m82xx_calibrate_decr() and generic_calibrate_decr() is that the former computes the timebase frequency from the cpu node's bus-frequency property, instead of directly from the timebase-frequency property.

But there's no reason the timebase-frequency shouldn't be correct on 82xx like everything else. Certainly the 82xx bootwrapper in arch/powerpc/boot/cuboot-pq2.c should get it right.

Therefore, this patch removes mpc82xx_calibrate_decr(), using generic_calibrate_decr() instead.

Quoted 7 lines
Quoted 5 lines

---

I've compiled this, but no booted it, since I don't have any 82xx hardware. I'm hoping for an ack from someone who can test boot it.

Scott's cleanup does this already for 82xx :)

Oh, yes. Oops.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson