public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
* Make mpc82xx use generic_calibrate_decr()
@ 2007-09-13  6:22 David Gibson
  2007-09-13  6:43 ` Kumar Gala
  0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2007-09-13  6:22 UTC (permalink / raw)
  To: Kumar Gala, Tony Breeds, linuxppc-dev

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.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---

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.

Index: working-2.6/arch/powerpc/platforms/82xx/mpc82xx_ads.c
===================================================================
--- working-2.6.orig/arch/powerpc/platforms/82xx/mpc82xx_ads.c	2007-09-13 16:14:18.000000000 +1000
+++ working-2.6/arch/powerpc/platforms/82xx/mpc82xx_ads.c	2007-09-13 16:14:38.000000000 +1000
@@ -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,
 };
Index: working-2.6/arch/powerpc/platforms/82xx/mpc82xx.c
===================================================================
--- working-2.6.orig/arch/powerpc/platforms/82xx/mpc82xx.c	2007-09-13 16:13:48.000000000 +1000
+++ working-2.6/arch/powerpc/platforms/82xx/mpc82xx.c	2007-09-13 16:15:13.000000000 +1000
@@ -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;

-- 
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

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

* Re: Make mpc82xx use generic_calibrate_decr()
  2007-09-13  6:43 ` Kumar Gala
@ 2007-09-13  6:42   ` David Gibson
  0 siblings, 0 replies; 3+ messages in thread
From: David Gibson @ 2007-09-13  6:42 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev@ozlabs.org list

On Thu, Sep 13, 2007 at 01:43:53AM -0500, Kumar Gala wrote:
> 
> On Sep 13, 2007, at 1:22 AM, David Gibson wrote:
> 
> > 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.
> >
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> >
> > 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.

-- 
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

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

* Re: Make mpc82xx use generic_calibrate_decr()
  2007-09-13  6:22 Make mpc82xx use generic_calibrate_decr() David Gibson
@ 2007-09-13  6:43 ` Kumar Gala
  2007-09-13  6:42   ` David Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Kumar Gala @ 2007-09-13  6:43 UTC (permalink / raw)
  To: David Gibson; +Cc: linuxppc-dev@ozlabs.org list


On Sep 13, 2007, at 1:22 AM, David Gibson wrote:

> 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.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>
> 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

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

end of thread, other threads:[~2007-09-13  6:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-13  6:22 Make mpc82xx use generic_calibrate_decr() David Gibson
2007-09-13  6:43 ` Kumar Gala
2007-09-13  6:42   ` David Gibson

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