Skip to contentSkip to conversation

Small fixes for the Ebony device tree

PATCH David Gibson 3 participants 13 messages May 15, 2007 – May 16, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

This patch corrects a number of minor errors in the Ebony device tree:
- Missing (given as 0) cache sizes are added to the CPU node
- device_type properties are removed from nodes which don't
have a reasonably well defined device_type binding. This does require a very small code change to locate the busses to be probed for of_platform devices by 'compatible' instead of 'device_type'.
- A node is added for the SRAM controller
- The unit address of the small-flash node is adjusted to
correctly reflect the reg property.
- device_type values for the MAL and ZMII are updated to
reflected more up-to-date versions of the binding.
- An incorrect offset in the partition map for the large-flash
node is corrected.
- Some redundant values, already commented out are removed
entirely.

---

Revised based on feedback from Segher et al.

arch/powerpc/boot/dts/ebony.dts +13 -22
Index: working-2.6/arch/powerpc/boot/dts/ebony.dts
===================================================================
@@ -33,8 +33,8 @@
 			timebase-frequency = <0>; // Filled in by zImage
 			i-cache-line-size = <32>;
 			d-cache-line-size = <32>;
-			i-cache-size = <0>;
-			d-cache-size = <0>;
+			i-cache-size = <8000>; /* 32 kB */
+			d-cache-size = <8000>; /* 32 kB */
 			dcr-controller;
 			dcr-access-method = "native";
 		};
@@ -46,7 +46,6 @@
 	};
 
 	UIC0: interrupt-controller0 {
-		device_type = "ibm,uic";
 		compatible = "ibm,uic-440gp", "ibm,uic";
 		interrupt-controller;
 		cell-index = <0>;
@@ -58,7 +57,6 @@
 	};
 
 	UIC1: interrupt-controller1 {
-		device_type = "ibm,uic";
 		compatible = "ibm,uic-440gp", "ibm,uic";
 		interrupt-controller;
 		cell-index = <1>;
@@ -71,36 +69,37 @@
 	};
 
 	CPC0: cpc {
-		device_type = "ibm,cpc";
 		compatible = "ibm,cpc-440gp";
 		dcr-reg = <0b0 003 0e0 010>;
 		// FIXME: anything else?
 	};
 
 	plb {
-		device_type = "ibm,plb";
 		compatible = "ibm,plb-440gp", "ibm,plb4";
 		#address-cells = <2>;
 		#size-cells = <1>;
 		ranges;
 		clock-frequency = <0>; // Filled in by zImage
 
-		SDRAM0: sdram {
-			device_type = "memory-controller";
+		SDRAM0: memory-controller {
 			compatible = "ibm,sdram-440gp", "ibm,sdram";
 			dcr-reg = <010 2>;
 			// FIXME: anything else?
 		};
 
+		SRAM0: sram {
+			compatible = "ibm,sram440gp";
+			dcr-reg = <020 8 00a 1>;
+		};
+
 		DMA0: dma {
 			// FIXME: ???
-			device_type = "ibm,dma-4xx";
 			compatible = "ibm,dma-440gp", "ibm,dma-4xx";
 			dcr-reg = <100 027>;
 		};
 
 		MAL0: mcmal {
-			device_type = "mcmal-dma";
+			device_type = "dma-controller";
 			compatible = "ibm,mcmal-440gp", "ibm,mcmal";
 			dcr-reg = <180 62>;
 			num-tx-chans = <4>;
@@ -119,7 +118,6 @@
 		};
 
 		POB0: opb {
-			device_type = "ibm,opb";
 			compatible = "ibm,opb-440gp", "ibm,opb";
 			#address-cells = <1>;
 			#size-cells = <1>;
@@ -133,8 +131,7 @@
 			clock-frequency = <0>; // Filled in by zImage
 
 			EBC0: ebc {
-				device_type = "ibm,ebc";
-				compatible = "ibm,ebc-440gp";
+				compatible = "ibm,ebc-440gp", "ibm,ebc";
 				dcr-reg = <012 2>;
 				#address-cells = <2>;
 				#size-cells = <1>;
@@ -147,7 +144,7 @@
 				interrupts = <5 4>;
 				interrupt-parent = <&UIC1>;
 
-				small-flash@0,0 {
+				small-flash@0,80000 {
 					device_type = "rom";
 					compatible = "direct-mapped";
 					probe-type = "JEDEC";
@@ -159,7 +156,6 @@
 
 				ds1743@1,0 {
 					/* NVRAM & RTC */
-					device_type = "nvram";
 					compatible = "ds1743";
 					reg = <1 0 2000>;
 				};
@@ -170,7 +166,7 @@
 					probe-type = "JEDEC";
 					bank-width = <1>;
 					partitions = <0 380000
-						      280000 80000>;
+						      380000 80000>;
 					partition-names = "fs", "firmware";
 					reg = <2 0 400000>;
 				};
@@ -226,13 +222,12 @@
 
 			GPIO0: gpio@40000700 {
 				/* FIXME */
-				device_type = "gpio";
 				compatible = "ibm,gpio-440gp";
 				reg = <40000700 20>;
 			};
 
 			ZMII0: emac-zmii@40000780 {
-				device_type = "emac-zmii";
+				device_type = "zmii-interface";
 				compatible = "ibm,zmii-440gp", "ibm,zmii";
 				reg = <40000780 c>;
 			};
@@ -299,9 +294,5 @@
 
 	chosen {
 		linux,stdout-path = "/plb/opb/serial@40000200";
-//		linux,initrd-start = <0>; /* FIXME */
-//		linux,initrd-end = <0>;
-//		bootargs = "";
 	};
 };
-
arch/powerpc/platforms/44x/ebony.c +3 -3
Index: working-2.6/arch/powerpc/platforms/44x/ebony.c
===================================================================
@@ -27,9 +27,9 @@
 #include "44x.h"
 
 static struct of_device_id ebony_of_bus[] = {
-	{ .type = "ibm,plb", },
-	{ .type = "ibm,opb", },
-	{ .type = "ibm,ebc", },
+	{ .compatible = "ibm,plb", },
+	{ .compatible = "ibm,opb", },
+	{ .compatible = "ibm,ebc", },
 	{},
 };
 
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

Just a few more things...

arch/powerpc/boot/dts/ebony.dts line 78

Quoted 3 lines
arch/powerpc/boot/dts/ebony.dts +0 -1
 	plb {
-		device_type = "ibm,plb";
 		compatible = "ibm,plb-440gp", "ibm,plb4";

You match on "ibm,plb" though. Well you got one
in three right ;-)

arch/powerpc/boot/dts/ebony.dts line 85

Quoted 2 lines
arch/powerpc/boot/dts/ebony.dts +1 -0
+		SDRAM0: memory-controller {
 			compatible = "ibm,sdram-440gp", "ibm,sdram";

"ibm,sdram" is way too generic to ever be usefully used for device matching.

arch/powerpc/boot/dts/ebony.dts line 91

Quoted 2 lines
arch/powerpc/boot/dts/ebony.dts +2 -0
+		SRAM0: sram {
+			compatible = "ibm,sram440gp";

You spell this one without a dash, all others with one.

Segher

#2 lore raw
Quoted 8 lines · Segher Boessenkool

Just a few more things...

arch/powerpc/boot/dts/ebony.dts line 78

Quoted 3 lines
arch/powerpc/boot/dts/ebony.dts +0 -1
 	plb {
-		device_type = "ibm,plb";
 		compatible = "ibm,plb-440gp", "ibm,plb4";

You match on "ibm,plb" though. Well you got one
in three right ;-)

Indeed. And I'm still not sure how it's recognizing the plb devices right now...

Quoted 5 lines

arch/powerpc/boot/dts/ebony.dts line 85

Quoted 2 lines
arch/powerpc/boot/dts/ebony.dts +1 -0
+		SDRAM0: memory-controller {
 			compatible = "ibm,sdram-440gp", "ibm,sdram";

"ibm,sdram" is way too generic to ever be usefully used for device matching.

Yeah, I guess this should be ibm,sdram-44x or ibm,sdram-4xx. Better go look up if any 40x chips use a similar sdram controller.

Quoted 4 lines

arch/powerpc/boot/dts/ebony.dts line 91

Quoted 2 lines
arch/powerpc/boot/dts/ebony.dts +2 -0
+		SRAM0: sram {
+			compatible = "ibm,sram440gp";

You spell this one without a dash, all others with one.

Ah, 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
#3 lore raw
Quoted 5 lines · David Gibson
Quoted 2 lines

"ibm,sdram" is way too generic to ever be usefully used for device matching.

Yeah, I guess this should be ibm,sdram-44x or ibm,sdram-4xx. Better go look up if any 40x chips use a similar sdram controller.

Here a list of the current 4xx SDRAM controllers:

SDRAM: all 40x (except for 405EZ)
DDR: 440GP, 440GX, 440EP, 440GR
DDR2: 440SP, 440SPe
DDR2 (Denali): 440EPx, 440GRx

Best regards,
Stefan

#4 lore raw
Quoted 8 lines · Stefan Roese
Quoted 5 lines · David Gibson
Quoted 2 lines

"ibm,sdram" is way too generic to ever be usefully used for device matching.

Yeah, I guess this should be ibm,sdram-44x or ibm,sdram-4xx. Better go look up if any 40x chips use a similar sdram controller.

Here a list of the current 4xx SDRAM controllers:

Ah, thanks :).

Anyone have any objection to the following: each of these controllers should have compatible properties listing 3 string, first, a specific version for the CPU in question (e.g "ibm,sdram-440gp"), then a string based on the type as listed below, finally "ibm,sdram-4xx".

Quoted 1 line

SDRAM: all 40x (except for 405EZ)

	ibm,sdram-40x
Quoted 1 line

DDR: 440GP, 440GX, 440EP, 440GR

	ibm,sdram-44x-ddr
Quoted 1 line

DDR2: 440SP, 440SPe

	ibm,sdram-44x-ddr2
Quoted 1 line

DDR2 (Denali): 440EPx, 440GRx

ibm,sdram-44x-ddr2denali

Seem reasonable?

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
#5 lore raw
Quoted 4 lines

Anyone have any objection to the following: each of these controllers should have compatible properties listing 3 string, first, a specific version for the CPU in question (e.g "ibm,sdram-440gp"), then a string based on the type as listed below, finally "ibm,sdram-4xx".

Is that last entry ever useful? Do all those controllers have something in common?

Quoted 11 lines
Quoted 1 line

SDRAM: all 40x (except for 405EZ)

	ibm,sdram-40x
Quoted 1 line

DDR: 440GP, 440GX, 440EP, 440GR

	ibm,sdram-44x-ddr
Quoted 1 line

DDR2: 440SP, 440SPe

	ibm,sdram-44x-ddr2
Quoted 1 line

DDR2 (Denali): 440EPx, 440GRx

ibm,sdram-44x-ddr2denali

Is this one a superset of the previous one? If so, put both names in.

Quoted 1 line

Seem reasonable?

It's better to say 440 than 44x, maybe all "441" parts will be totally different. I don't know what to do with 40x; maybe say 405 as that seems to be the most common chip. OTOH, you don't have to deal with that right now :-)

Segher

#6 lore raw
Quoted 7 lines · Segher Boessenkool
Quoted 4 lines

Anyone have any objection to the following: each of these controllers should have compatible properties listing 3 string, first, a specific version for the CPU in question (e.g "ibm,sdram-440gp"), then a string based on the type as listed below, finally "ibm,sdram-4xx".

Is that last entry ever useful? Do all those controllers have something in common?

A quick glance over the descriptions in the 440GP and 405GP user manuals suggests that they have most of the registers in common, though I haven't checked to see if the semantics of those registers are actually all the same.

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
#11 lore raw
In reply to David Gibson
Quoted 13 lines · David Gibson

Anyone have any objection to the following: each of these controllers should have compatible properties listing 3 string, first, a specific version for the CPU in question (e.g "ibm,sdram-440gp"), then a string based on the type as listed below, finally "ibm,sdram-4xx".

Quoted 1 line

SDRAM: all 40x (except for 405EZ)

	ibm,sdram-40x
Quoted 1 line

DDR: 440GP, 440GX, 440EP, 440GR

	ibm,sdram-44x-ddr
Quoted 7 lines
Quoted 1 line

DDR2: 440SP, 440SPe

	ibm,sdram-44x-ddr2
Quoted 1 line

DDR2 (Denali): 440EPx, 440GRx

ibm,sdram-44x-ddr2denali

Why "ibm,xxx"? Is this for the CPU core? Or for the SDRAM controller core? Both are not IBM in this case.

Quoted 1 line

Seem reasonable?

I forgot the new 405EX which will be equipped with a DDR2 controller (not sure right now if it's the Denali or the other core right now). So we should probably drop this 40x/44x completely. Does this make sense?

Best regards,
Stefan

#7 lore raw
In reply to David Gibson
Quoted 9 lines
Quoted 4 lines
Quoted 1 line

finally "ibm,sdram-4xx".

Is that last entry ever useful? Do all those controllers have something in common?

A quick glance over the descriptions in the 440GP and 405GP user manuals suggests that they have most of the registers in common, though I haven't checked to see if the semantics of those registers are actually all the same.

Let me rephrase: can a kernel driver ever do anything useful with the device if it _only_ knows it is some 4xx memory controller?

If that isn't the case, but for example, the 440GP's controller can be driven by the 405GP driver, you can express exactly that in the "compatible" property. It is a bad plan in general to say "4xx", it suggests compatibility both ways, which almost never is true; so what _does_ it mean? Lowest common denominator? Say exactly that, then. "compatible" is meant for drivers to figure if they can drive the device (or, equivalently, for the kernel to figure out which driver can drive a given device).

Segher

#8 lore raw
Quoted 14 lines · Segher Boessenkool
Quoted 9 lines
Quoted 4 lines
Quoted 1 line

finally "ibm,sdram-4xx".

Is that last entry ever useful? Do all those controllers have something in common?

A quick glance over the descriptions in the 440GP and 405GP user manuals suggests that they have most of the registers in common, though I haven't checked to see if the semantics of those registers are actually all the same.

Let me rephrase: can a kernel driver ever do anything useful with the device if it _only_ knows it is some 4xx memory controller?

Quoted 10 lines

If that isn't the case, but for example, the 440GP's controller can be driven by the 405GP driver, you can express exactly that in the "compatible" property. It is a bad plan in general to say "4xx", it suggests compatibility both ways, which almost never is true; so what _does_ it mean? Lowest common denominator? Say exactly that, then. "compatible" is meant for drivers to figure if they can drive the device (or, equivalently, for the kernel to figure out which driver can drive a given device).

Ok, I see what you mean.

Sod it, I think I'll just drop everything except "ibm,sdram-440gp" for now. The one place we access the SDRAM controller, it's under platform control anyway we do it via direct DCR access anyway, so the compatible property is pretty much irrelevant.

If a clearer pattern emerges later, we can add more compatible strings. If some later driver has to have an extra backwards compatibility id_table entry for the Ebony/440GP it's no great disaster.

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
#12 lore raw
In reply to Stefan Roese
Quoted 1 line

Why "ibm,xxx"? Is this for the CPU core? Or for the SDRAM controller core?

For whatever is behind the comma. The prefixes are meant to give each manufacturer his own namespace, to reduce the number of name collisions.

Quoted 1 line

Both are not IBM in this case.

Yeah.

Quoted 3 lines

I forgot the new 405EX which will be equipped with a DDR2 controller (not sure right now if it's the Denali or the other core right now). So we should probably drop this 40x/44x completely. Does this make sense?

Yes. To claim compatibility to a family of devices, specify the oldest part, or the most popular part, or a few parts if different generations added more features (and this part is compatible with those).

Segher

#9 lore raw
In reply to David Gibson
Quoted 2 lines

Sod it, I think I'll just drop everything except "ibm,sdram-440gp" for now.

Perfect plan :-) And then 440GX, GR, etc. can claim compatibility to 440GP, which is the nestor of the family.

Quoted 3 lines

If some later driver has to have an extra backwards compatibility id_table entry for the Ebony/440GP it's no great disaster.

Sure, mistakes happen. They can be fixed in the bootwrapper, too -- or just in the DTS file if your device tree is shipped with the kernel.

Segher

#10 lore raw
Quoted 6 lines · Segher Boessenkool
Quoted 2 lines

Sod it, I think I'll just drop everything except "ibm,sdram-440gp" for now.

Perfect plan :-) And then 440GX, GR, etc. can claim compatibility to 440GP, which is the nestor of the family.

Right, done. Same for the SRAM and DMA controller nodes.

New patch coming shortly.

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