On Wed, Sep 20, 2000 at 05:03:42PM +0200, Albrecht Dreß wrote:
"D.J. Osguthorpe" wrote:
quoted
Here are two patches that appear to fix the cpu_temp function in setup.c.
They have been applied to a number of Ben Herrenschmidt kernels on a 500 MHz
Pismo powerbook and print reasonable values when you cat /proc/cpuinfo.
The patch seems to work on my Lombard/333, too... Really great!
quoted
+ /* this set for 500 MHz Pismo - how do we get access to clock?? */
There is, in the same file, around line 319 code to read the clock speed from
the device tree. However, is it really necessary to include the clock speed at
this point? What is the drawback if we just assume 500 MHz (or even the max
value) for every G3 based machine?
Why assume when we can do it properly? Besides, a friend of mine oc'ed his
B&W to 550, so it's possible to have >500Mhz :)
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
quoted
quoted
+ /* this set for 500 MHz Pismo - how do we get access to clock?? */
There is, in the same file, around line 319 code to read the clock speed from
the device tree. However, is it really necessary to include the clock speed at
this point? What is the drawback if we just assume 500 MHz (or even the max
value) for every G3 based machine?
Why assume when we can do it properly? Besides, a friend of mine oc'ed his
B&W to 550, so it's possible to have >500Mhz :)
Like this?
--- arch/ppc/kernel/setup.c.org Wed Sep 20 20:25:53 2000
+++ arch/ppc/kernel/setup.c Wed Sep 20 20:31:26 2000
@@ -197,6 +197,7 @@
unsigned int thresd;
unsigned int threst;
unsigned int i;
+ unsigned int cpu_freq;
othrm1 = _get_THRM1();
othrm2 = _get_THRM2();
@@ -208,9 +209,23 @@
/* we need 20us to do the compare - assume 300MHz processor clock */
/* max value for sitv is 0x3fff - or 16383 */
/* this set for 500 MHz Pismo - how do we get access to clock?? */
+
+ cpu_freq = 500;
+ if ( have_of )
+ {
+ struct device_node *cpu_node;
+ int *fp;
+
+ cpu_node = find_type_devices("cpu");
+ if ( cpu_node ) {
+ fp = (int *) get_property(cpu_node, "clock-frequency", NULL);
+ if ( fp ) cpu_freq = *fp / 1000000;
+ }
+ }
+
/* 25 usec conversion time - max for 500 Mhz is approx. 32 usec */
_set_THRM3(0);
- _set_THRM3(THRM3_E | THRM3_SITV(500*25) );
+ _set_THRM3(THRM3_E | THRM3_SITV(cpu_freq*25) );
thresd = 1 << 6;
threst = thresd;
Only tested on my Lombard ...
Michael
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Hi all,
On 20 Sep, this message from Tom Rini echoed through cyberspace:
On Wed, Sep 20, 2000 at 05:03:42PM +0200, Albrecht Dreß wrote:
quoted
"D.J. Osguthorpe" wrote:
quoted
Here are two patches that appear to fix the cpu_temp function in setup.c.
They have been applied to a number of Ben Herrenschmidt kernels on a 500 MHz
Pismo powerbook and print reasonable values when you cat /proc/cpuinfo.
The patch seems to work on my Lombard/333, too... Really great!
quoted
+ /* this set for 500 MHz Pismo - how do we get access to clock?? */
There is, in the same file, around line 319 code to read the clock speed from
the device tree. However, is it really necessary to include the clock speed at
this point? What is the drawback if we just assume 500 MHz (or even the max
value) for every G3 based machine?
Why assume when we can do it properly? Besides, a friend of mine oc'ed his
B&W to 550, so it's possible to have >500Mhz :)
To do it properly on all machines requires a processor frequency
calculating routine, that doesn't depend on OF. Note that on all
upgraded machines that did not initially have a G3, OF's value is wrong
(too low, actually)!
On the other hand, Motorola's doc states that setting too large a value
doesn't hurt, so I guess we can safely hardcode something like 600 MHz.
At the only expense of busy-waiting a bit too long on slower machines...
but how often do you look at /proc/cpuinfo? Besides, you could always do
the aproximation using the interrupt ;-)
Michel
-------------------------------------------------------------------------
Michel Lanners | " Read Philosophy. Study Art.
23, Rue Paul Henkes | Ask Questions. Make Mistakes.
L-1710 Luxembourg |
email mlan@cpu.lu |
http://www.cpu.lu/~mlan | Learn Always. "
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/