Skip to contentSkip to conversation

ppc: enable scom access functions on Maple

PATCH Superseded Dmitry Eremin-Solenikov 4 participants 11 messages Jun 17, 2011 – Jun 30, 2011

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ppc: enable scom access functions on Maple

Enable functions used to access SCOM if PPC_MAPLE is defined: they are used by cpufreq driver to control hardware.

---
 arch/powerpc/kernel/misc_64.S |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/misc_64.S +2 -2
index e89df59..616921e 100644
@@ -339,7 +339,7 @@ _GLOBAL(real_205_writeb)
 #endif /* CONFIG_PPC_PASEMI */
 
 
-#ifdef CONFIG_CPU_FREQ_PMAC64
+#if defined(CONFIG_CPU_FREQ_PMAC64) || defined(CONFIG_CPU_FREQ_MAPLE)
 /*
  * SCOM access functions for 970 (FX only for now)
  *
@@ -408,7 +408,7 @@ _GLOBAL(scom970_write)
 	/* restore interrupts */
 	mtmsrd	r5,1
 	blr
-#endif /* CONFIG_CPU_FREQ_PMAC64 */
+#endif /* CONFIG_CPU_FREQ_PMAC64 || CONFIG_CPU_FREQ_MAPLE */
 
 
 /*
Signature · 1 line
1.7.5.3
#1 lore raw

PATCH 2/2 Add cpufreq driver for Momentum Maple boards

Add simple cpufreq driver for Maple-based boards (ppc970fx evaluation kit and others). Driver is based on a cpufreq driver for 64-bit powermac boxes with all pmac-dependant features removed and simple cleanup applied.

---
 drivers/cpufreq/Kconfig         |    5 +
 drivers/cpufreq/Kconfig.powerpc |    7 +
 drivers/cpufreq/Makefile        |    5 +
 drivers/cpufreq/maple-cpufreq.c |  314 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 331 insertions(+), 0 deletions(-)
 create mode 100644 drivers/cpufreq/Kconfig.powerpc
 create mode 100644 drivers/cpufreq/maple-cpufreq.c
drivers/cpufreq/Kconfig +5 -0
index 9fb8485..61ae639 100644
@@ -184,5 +184,10 @@ depends on X86
 source "drivers/cpufreq/Kconfig.x86"
 endmenu
 
+menu "PowerPC CPU frequency scaling drivers"
+depends on PPC32 || PPC64
+source "drivers/cpufreq/Kconfig.powerpc"
+endmenu
+
 endif
 endmenu
drivers/cpufreq/Kconfig.powerpc new file +7 -0
new file mode 100644
index 0000000..e76992f
@@ -0,0 +1,7 @@
+config CPU_FREQ_MAPLE
+	bool "Support for Maple 970FX Evaluation Board"
+	depends on PPC_MAPLE
+	select CPU_FREQ_TABLE
+	help
+	  This adds support for frequency switching on Maple 970FX
+	  Evaluation Board and compatible boards (IBM JS2x blades).
drivers/cpufreq/Makefile +5 -0
index e2fc2d2..ca3796d 100644
@@ -41,3 +41,8 @@ obj-$(CONFIG_X86_CPUFREQ_NFORCE2)	+= cpufreq-nforce2.o
 
 # ARM SoC drivers
 obj-$(CONFIG_UX500_SOC_DB8500)		+= db8500-cpufreq.o
+
+
+##################################################################################d
+# PowerPC platform drivers
+obj-$(CONFIG_CPU_FREQ_MAPLE)		+= maple-cpufreq.o
drivers/cpufreq/maple-cpufreq.c new file +314 -0

314 lines not on this page · raw message

Signature · 1 line
1.7.5.3
#2 lore raw

Re: [PATCH 2/2] Add cpufreq driver for Momentum Maple boards

Before I comment on this last one, a quick Q. for Dave: Do you want to handle this or should I merge it via powerpc.git ? (It depends on another change to the arch code to expose the SCOM functions that it uses, and that patch is going to be in my -next branch).

Now some remaining small nits:

Quoted 11 lines · Dmitry Eremin-Solenikov

Add simple cpufreq driver for Maple-based boards (ppc970fx evaluation kit and others). Driver is based on a cpufreq driver for 64-bit powermac boxes with all pmac-dependant features removed and simple cleanup applied.

---
 drivers/cpufreq/Kconfig         |    5 +
 drivers/cpufreq/Kconfig.powerpc |    7 +
 drivers/cpufreq/Makefile        |    5 +
 drivers/cpufreq/maple-cpufreq.c |  314 +++++++++++++++++++++++++++++++++++++++

If we're going to have a Kconfig.powerpc, should we maybe just have a powerpc subdirectory instead with the driver in it ?

I'm happy at some later point to try moving some of my other ones there.

.../...

drivers/cpufreq/maple-cpufreq.c line 264

Quoted 7 lines
drivers/cpufreq/maple-cpufreq.c new file +7 -0
+	/* Look for the powertune data in the device-tree */
+	maple_pmode_data = of_get_property(cpunode, "power-mode-data", &psize);
+	if (!maple_pmode_data) {
+		DBG("No power-mode-data !\n");
+		goto bail_noprops;
+	}
+	maple_pmode_max = psize / sizeof(u32) - 1;

Do you get that property in your device-tree ? Or have you modified your firmware ? If that requires a modified firmware, you should probably put at least a link indicating where to get it somewhere and display a nicer error code.

Also this driver is specific to the Maple HW, you don't want it to kick in and mess around on ... an Apple G5 for example. So stick somewhere a

	if (!machine_is(maple))
		return 0;

drivers/cpufreq/maple-cpufreq.c line 289

Quoted 1 line
drivers/cpufreq/maple-cpufreq.c new file +1 -0
+	printk(KERN_INFO "Registering G5 CPU frequency driver\n");

s/G5/Maple

drivers/cpufreq/maple-cpufreq.c line 290

Quoted 1 line
drivers/cpufreq/maple-cpufreq.c new file +1 -0
+	printk(KERN_INFO "Frequency method: SCOM, Voltage method: none\n");

This is useless.

Cheers,
Ben.

#3 lore raw

Re: [PATCH 2/2] Add cpufreq driver for Momentum Maple boards

Quoted 4 lines · Ben Herrenschmidt

Before I comment on this last one, a quick Q. for Dave: Do you want to handle this or should I merge it via powerpc.git ? (It depends on another change to the arch code to expose the SCOM functions that it uses, and that patch is going to be in my -next branch).

If you're carrying the dependancy, it sounds like it would make more sense for you to carry this too. There are some changes to the Kconfig/Makefile in drivers/cpufreq in my tree for 3.1 already, so you might get a collision when both trees end up in next & subsequently Linus' tree. Just trivial changes though.

Quoted 10 lines
Quoted 5 lines
---
 drivers/cpufreq/Kconfig         |    5 +
 drivers/cpufreq/Kconfig.powerpc |    7 +
 drivers/cpufreq/Makefile        |    5 +
 drivers/cpufreq/maple-cpufreq.c |  314 +++++++++++++++++++++++++++++++++++++++

If we're going to have a Kconfig.powerpc, should we maybe just have a powerpc subdirectory instead with the driver in it ?

I'm happy at some later point to try moving some of my other ones there.

So far we haven't bothered with additional subarch drivers/ directories for x86/arm. I'm not against the idea. As more archs move over, I could see drivers/cpufreq/ getting more cluttered.

Dave

#4 lore raw

Re: [PATCH 2/2] Add cpufreq driver for Momentum Maple boards

In reply to Benjamin Herrenschmidt
Quoted 21 lines · Benjamin Herrenschmidt

Before I comment on this last one, a quick Q. for Dave: Do you want to handle this or should I merge it via powerpc.git ? (It depends on another change to the arch code to expose the SCOM functions that it uses, and that patch is going to be in my -next branch).

Now some remaining small nits:

Quoted 5 lines · Dmitry Eremin-Solenikov

Add simple cpufreq driver for Maple-based boards (ppc970fx evaluation kit and others). Driver is based on a cpufreq driver for 64-bit powermac boxes with all pmac-dependant features removed and simple cleanup applied.

Quoted 7 lines
---
 drivers/cpufreq/Kconfig         |    5 +
 drivers/cpufreq/Kconfig.powerpc |    7 +
 drivers/cpufreq/Makefile        |    5 +
 drivers/cpufreq/maple-cpufreq.c |  314

+++++++++++++++++++++++++++++++++++++++

Quoted 4 lines

If we're going to have a Kconfig.powerpc, should we maybe just have a powerpc subdirectory instead with the driver in it ?

I'm happy at some later point to try moving some of my other ones there.

As Dave also isn't sure about subdirs, should I create cpufreq/powerpc directory,
or not?

Quoted 15 lines

.../...

drivers/cpufreq/maple-cpufreq.c line 264

Quoted 7 lines
drivers/cpufreq/maple-cpufreq.c new file +7 -0
+	/* Look for the powertune data in the device-tree */
+	maple_pmode_data = of_get_property(cpunode, "power-mode-data", &psize);
+	if (!maple_pmode_data) {
+		DBG("No power-mode-data !\n");
+		goto bail_noprops;
+	}
+	maple_pmode_max = psize / sizeof(u32) - 1;

Do you get that property in your device-tree ? Or have you modified your firmware ? If that requires a modified firmware, you should probably put at least a link indicating where to get it somewhere and display a nicer error code.

PIBS firmware (used on PPC970FX devkit/original Maple-D board) generates this property, if the board is started with dual CPUs (it can also be started with only one CPU selected). On the other hand SLOF firmware (used on JS2x blade servers) doesn't generate this property. It can be adapted however to generate it.

Quoted 9 lines

Also this driver is specific to the Maple HW, you don't want it to kick in and mess around on ... an Apple G5 for example. So stick somewhere a

	if (!machine_is(maple))
		return 0;

drivers/cpufreq/maple-cpufreq.c line 289

Quoted 1 line
drivers/cpufreq/maple-cpufreq.c new file +1 -0
+	printk(KERN_INFO "Registering G5 CPU frequency driver\n");

s/G5/Maple

Hmmm. I'm actually thinking about doing it the other way: as this driver is mostly c&p of PowerMac G5 driver, as we are moving those from arch/powerpc to drivers/cpufreq, maybe I should merge two drivers (this one with cpufreq_64 from powermac)?

Quoted 3 lines

drivers/cpufreq/maple-cpufreq.c line 290

Quoted 1 line
drivers/cpufreq/maple-cpufreq.c new file +1 -0
+	printk(KERN_INFO "Frequency method: SCOM, Voltage method: none\n");

This is useless.

Leftover from powermac thing.

Signature · 2 lines
With best wishes
Dmitry
#5 lore raw

Re: [PATCH 2/2] Add cpufreq driver for Momentum Maple boards

Quoted 22 lines · Dmitry Eremin-Solenikov
Quoted 21 lines · Benjamin Herrenschmidt

Before I comment on this last one, a quick Q. for Dave: Do you want to handle this or should I merge it via powerpc.git ? (It depends on another change to the arch code to expose the SCOM functions that it uses, and that patch is going to be in my -next branch).

Now some remaining small nits:

Quoted 12 lines · Dmitry Eremin-Solenikov

Add simple cpufreq driver for Maple-based boards (ppc970fx evaluation kit and others). Driver is based on a cpufreq driver for 64-bit powermac boxes with all pmac-dependant features removed and simple cleanup applied.

---
 drivers/cpufreq/Kconfig         |    5 +
 drivers/cpufreq/Kconfig.powerpc |    7 +
 drivers/cpufreq/Makefile        |    5 +
 drivers/cpufreq/maple-cpufreq.c |  314

+++++++++++++++++++++++++++++++++++++++

Quoted 8 lines
Quoted 4 lines

If we're going to have a Kconfig.powerpc, should we maybe just have a powerpc subdirectory instead with the driver in it ?

I'm happy at some later point to try moving some of my other ones there.

As Dave also isn't sure about subdirs, should I create cpufreq/powerpc directory,
or not?

Don't bother, I can do it all at once if/when I chose to move the powermac stuff there.

Quoted 10 lines
Quoted 4 lines

Do you get that property in your device-tree ? Or have you modified your firmware ? If that requires a modified firmware, you should probably put at least a link indicating where to get it somewhere and display a nicer error code.

PIBS firmware (used on PPC970FX devkit/original Maple-D board) generates this property, if the board is started with dual CPUs (it can also be started with only one CPU selected). On the other hand SLOF firmware (used on JS2x blade servers) doesn't generate this property. It can be adapted however to generate it.

Ok.

Quoted 6 lines
Quoted 6 lines

Also this driver is specific to the Maple HW, you don't want it to kick in and mess around on ... an Apple G5 for example. So stick somewhere a

	if (!machine_is(maple))
		return 0;
Quoted 8 lines
Quoted 3 lines

drivers/cpufreq/maple-cpufreq.c line 289

Quoted 1 line
drivers/cpufreq/maple-cpufreq.c new file +1 -0
+	printk(KERN_INFO "Registering G5 CPU frequency driver\n");

s/G5/Maple

Hmmm. I'm actually thinking about doing it the other way: as this driver is mostly c&p of PowerMac G5 driver, as we are moving those from arch/powerpc to drivers/cpufreq, maybe I should merge two drivers (this one with cpufreq_64 from powermac)?

If you feel like it :-) The powermac one has quite a bit more plumbing for voltage control etc... but it does make sense in the long run.

Maybe start with getting that maple driver in, and -then- merge ?

Quoted 5 lines
Quoted 3 lines

drivers/cpufreq/maple-cpufreq.c line 290

Quoted 1 line
drivers/cpufreq/maple-cpufreq.c new file +1 -0
+	printk(KERN_INFO "Frequency method: SCOM, Voltage method: none\n");

This is useless.

Leftover from powermac thing.

Cheers,
Ben.

#6 lore raw

Re: [PATCH 2/2] Add cpufreq driver for Momentum Maple boards

Hi,

Try this one more time ...

Quoted 5 lines · Benjamin Herrenschmidt

On Wed, 2011-06-29 at 12:40 +0400, Dmitry Eremin-Solenikov wrote:

If you feel like it :-) The powermac one has quite a bit more plumbing for voltage control etc... but it does make sense in the long run.

On my G5 (PowerMac7,3?), a dual 970FX @ 2.5G, I don't think the voltage scaling works correctly. If someone else with one of these (preferably someone who is NOT swamped (and named Ben)) could run some experiments. I would like to know whether the G5 I bought on ebay is some "FrankenG5" and the others actually work correctly.

To summarize, if I disable frequency scaling and look at the cpu core voltages it runs at the LOW voltage at full (i.e. 2.5 GHz) speed. With frequency scaling enabled, it runs the low speed at the same voltage it runs at 2.5 GHz without frequency scaling enabled. At the full speed it switches to a higher voltage. It WILL overheat if allowed to 'do stuff'. Temps above 110 are observed for cpu 1 (the second cpu in the serial (i.e. cpu 1 is heated by cpu 0) cooling setup - DUH!!!). The two voltages are like ~1.23 and ~1.35.

Back when this beast had MacOS X, I think it exhibited similar behavior based on the fan noise.

kevin

#7 lore raw

Re: [PATCH 2/2] Add cpufreq driver for Momentum Maple boards

In reply to Benjamin Herrenschmidt

Hi,

On Tue, Jun 28, 2011 at 10:28 PM, Benjamin Herrenschmidt >

Quoted 4 lines

If we're going to have a Kconfig.powerpc, should we maybe just have a powerpc subdirectory instead with the driver in it ?

Where would the powerpc subdirectory be? under drivers/cpufreq? Or somewhere under arch/powerpc where it belongs (and I put my 750GX stuff)?

Quoted 5 lines
Quoted 2 lines

+     printk(KERN_INFO "Frequency method: SCOM, Voltage method: none\n");

This is useless.

Why?

Quoted 3 lines

Cheers,
Ben.

kevin

#8 lore raw

Re: [PATCH 2/2] Add cpufreq driver for Momentum Maple boards

Quoted 10 lines · kevin diggs

Hi,

On Tue, Jun 28, 2011 at 10:28 PM, Benjamin Herrenschmidt >

Quoted 4 lines

If we're going to have a Kconfig.powerpc, should we maybe just have a powerpc subdirectory instead with the driver in it ?

Where would the powerpc subdirectory be? under drivers/cpufreq? Or somewhere under arch/powerpc where it belongs (and I put my 750GX stuff)?

drivers/cpufreq/powerpc. However my current version (as suggested by Ben) goes directly to drivers/cpufreq

Signature · 2 lines
With best wishes
Dmitry
#9 lore raw

Re: [PATCH 2/2] Add cpufreq driver for Momentum Maple boards

Hi,

Quoted 4 lines · Dmitry Eremin-Solenikov

drivers/cpufreq/powerpc. However my current version (as suggested by Ben) goes directly to drivers/cpufreq

Uh ... Just curious ... why is arch specific code now being put outside of the arch directories? When I wrote the 750GX stuff (~2.6.28) I put in a location similar to what x86 was doing? When did this change?

kevin

#10 lore raw

Re: [PATCH 2/2] Add cpufreq driver for Momentum Maple boards

Quoted 5 lines · kevin diggs

Hi,

Quoted 1 line · Dmitry Eremin-Solenikov
Quoted 7 lines
Quoted 3 lines

drivers/cpufreq/powerpc. However my current version (as suggested by Ben) goes directly to drivers/cpufreq

Uh ... Just curious ... why is arch specific code now being put outside of the arch directories? When I wrote the 750GX stuff (~2.6.28) I put in a location similar to what x86 was doing? When did this change?

last release, ARM moved their cpufreq drivers. I moved the x86 ones afterwards. There's precedent for other arch specific drivers in drivers/ too, but the cpufreq move is a recent thing.

Dave