Patchwork Freescale MPC5554 device tree (was: cross-compiling Linux for PowerPC e200 core?)

login
register
mail settings
Submitter Németh Márton
Date March 12, 2010, 6:26 a.m.
Message ID <4B99DE95.8010304@freemail.hu>
Download mbox | patch
Permalink /patch/47664/
State Not Applicable
Headers show

Comments

Németh Márton - March 12, 2010, 6:26 a.m.
Hi,

thank you for the comments, I reworked the Freescale MPC5554 device tree
accordingly. I'm listening for comments on this draft.

Regards,

	Márton Németh

---
From: Márton Németh <nm127@freemail.hu>

Add device tree for Freescale MPC5554.

Signed-off-by: Márton Németh <nm127@freemail.hu>
---
Grant Likely - March 12, 2010, 12:14 p.m.
2010/3/11 Németh Márton <nm127@freemail.hu>:
> Hi,
>
> thank you for the comments, I reworked the Freescale MPC5554 device tree
> accordingly. I'm listening for comments on this draft.
>
> Regards,
>
>        Márton Németh
>
> ---
> From: Márton Németh <nm127@freemail.hu>
>
> Add device tree for Freescale MPC5554.
>
> Signed-off-by: Márton Németh <nm127@freemail.hu>
> ---
> diff -uprN linux-2.6.33.orig/arch/powerpc/boot/dts/mpc5554.dts linux/arch/powerpc/boot/dts/mpc5554.dts
> --- linux-2.6.33.orig/arch/powerpc/boot/dts/mpc5554.dts 1970-01-01 01:00:00.000000000 +0100
> +++ linux/arch/powerpc/boot/dts/mpc5554.dts     2010-03-12 07:22:37.000000000 +0100
> @@ -0,0 +1,189 @@
> +/*
> + * Freescale MPC5554 Device Tree Source
> + *
> + * Based on MPC5553/5554 Microcontroller Reference Manual, Rev. 4.0, 04/2007
> + * http://www.freescale.com/files/32bit/doc/ref_manual/MPC5553_MPC5554_RM.pdf
> + *
> + * Copyright 2010 Márton Németh
> + * Márton Németh <nm127@freemail.hu>
> + *
> + * This program is free software; you can redistribute  it and/or modify it
> + * under  the terms of  the GNU General  Public License as published by the
> + * Free Software Foundation;  either version 2 of the  License, or (at your
> + * option) any later version.
> + */
> +
> +/dts-v1/;
> +
> +/ {
> +       model = "MPC5554";
> +       compatible = "fsl,MPC5554EVB";          // Freescale MPC5554 Evaluation Board
> +       #address-cells = <1>;
> +       #size-cells = <1>;

also need: interrupt-parent = <&intc>;

I describe why later...

> +
> +       cpus {
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +
> +               cpu@0 {
> +                       device_type = "cpu";
> +                       compatible = "PowerPC,5554";

I'd rather see the same convention used here as for all the other
compatible values in this file.  ie:

compatible = "fsl,mpc5554-e200z6", "fsl,powerpc-e200z6";

Dave, what do you think?

> +                       reg = <0>;
> +                       d-cache-line-size = <32>;
> +                       i-cache-line-size = <32>;
> +                       d-cache-size = <0x8000>;        // L1, 32KiB
> +                       i-cache-size = <0x8000>;        // L1, 32KiB
> +                       timebase-frequency = <0>;       // from bootloader
> +                       bus-frequency = <0>;            // from bootloader
> +                       clock-frequency = <0>;          // from bootloader
> +               };
> +       };
> +
> +       memory@40000000 {
> +               device_type = "memory";
> +               reg = <0x40000000 0x10000>;     // 32KiB internal SRAM
> +       };
> +
> +       xbar@fff04000 {         // System Bus Crossbar Switch (XBAR)
> +               compatible = "fsl,mpc5554-xbar";
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +               // The full memory range is covered by XBAR
> +               ranges = <>;

An empty ranges property looks like this:

ranges;

> +               bridge@fff00000 {
> +                       compatible = "fsl,mpc5554-pbridge-b";
> +                       #address-cells = <1>;
> +                       #size-cells = <1>;
> +                       ranges = <0 0xe0000000 0x20000000>;
> +                       reg = <0xfff00000 0x4000>;
> +
> +                       ecsm@fff40000 {         // Error Correction Status Module (ECSM)
> +                               compatible = "fsl,mpc5554-ecsm";
> +                               reg = <0xfff40000 0x4000>;
> +                       };
> +
> +                       edma@fff44000 {         // Enhanced DMA Controller (eDMA)
> +                               compatible = "fsl,mpc5554-edma";
> +                               reg = <0xfff44000 0x4000>;
> +                       };
> +
> +                       intc@fff48000 {         // Interrupt Controller (INTC)
> +                               compatible = "fsl,mpc5554-intc";
> +                               reg = <0xfff48000 0x4000>;
> +                       };

Need a label on this node so that the rest of the tree can find it,
and it needs the interrupt-controller and #interrupt-cells properties:

                       intc: intc@fff48000 {         // Interrupt
Controller (INTC)
                               compatible = "fsl,mpc5554-intc";
                               interrupt-controller;
                               #interrupt-cells = <2>;
                               reg = <0xfff48000 0x4000>;
                       };

I've set #interrupt-cells to 2 which is fairly typical on fsl parts,
but that may or may not make sense.  You need to decide how each
device is going to specify it's interrupt line.  Often the first cell
is the hardware interrupt number, and the second cell encodes the
sense (high, low, edge).  Conversely, PCI interrupts only use
#interrupt-cells = <1> because all PCI irqs use the active low sense.

Then, each device in the tree should have an 'interrupts = < [hwirq#]
[sense]>;' property.

Otherwise, starting to look pretty good.

g.
David Gibson - March 12, 2010, 10:36 p.m.
On Fri, Mar 12, 2010 at 05:14:56AM -0700, Grant Likely wrote:
> 2010/3/11 Németh Márton <nm127@freemail.hu>:
[snip]
> > +
> > +       cpus {
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
> > +
> > +               cpu@0 {
> > +                       device_type = "cpu";
> > +                       compatible = "PowerPC,5554";
> 
> I'd rather see the same convention used here as for all the other
> compatible values in this file.  ie:
> 
> compatible = "fsl,mpc5554-e200z6", "fsl,powerpc-e200z6";
> 
> Dave, what do you think?

Well, you could add those too, but "PowerPC,5554" should probably
remain.

The historical background here is that in the original OF spec, driver
matching was done on node name, and only then on compatible.
Essentially the node name was treated as an implicit first entry in
the compatible list.  The the generic names convention came along, and
instead name became a human readable generic type for the device
("ethernet", "i2c", etc..).

That convention has been widely used since long before flat trees
existed, but for some reason it was never really used for cpu nodes;
they remained as "PowerPC,XXXX" or whatever.  Because the varying
names of cpu nodes was sometimes awkward to deal with in bootloaders,
we decided it would be sensible to apply the generic names convention
here too, so "cpu@X".  But then, the previous node name, which was
treated as being prepended to compatible, should now explicitly be put
into compatible.
Grant Likely - March 12, 2010, 11:04 p.m.
On Fri, Mar 12, 2010 at 3:36 PM, David Gibson
<david@gibson.dropbear.id.au> wrote:
> On Fri, Mar 12, 2010 at 05:14:56AM -0700, Grant Likely wrote:
>> 2010/3/11 Németh Márton <nm127@freemail.hu>:
> [snip]
>> > +
>> > +       cpus {
>> > +               #address-cells = <1>;
>> > +               #size-cells = <0>;
>> > +
>> > +               cpu@0 {
>> > +                       device_type = "cpu";
>> > +                       compatible = "PowerPC,5554";
>>
>> I'd rather see the same convention used here as for all the other
>> compatible values in this file.  ie:
>>
>> compatible = "fsl,mpc5554-e200z6", "fsl,powerpc-e200z6";
>>
>> Dave, what do you think?
>
> Well, you could add those too, but "PowerPC,5554" should probably
> remain.
>
> The historical background here is that in the original OF spec, driver
> matching was done on node name, and only then on compatible.
> Essentially the node name was treated as an implicit first entry in
> the compatible list.  The the generic names convention came along, and
> instead name became a human readable generic type for the device
> ("ethernet", "i2c", etc..).
>
> That convention has been widely used since long before flat trees
> existed, but for some reason it was never really used for cpu nodes;
> they remained as "PowerPC,XXXX" or whatever.  Because the varying
> names of cpu nodes was sometimes awkward to deal with in bootloaders,
> we decided it would be sensible to apply the generic names convention
> here too, so "cpu@X".  But then, the previous node name, which was
> treated as being prepended to compatible, should now explicitly be put
> into compatible.

In this particular case, we're talking about a part that has never
previously been described in a device tree.  So, since this is
something entirely new, what is the value in preserving the
PowerPC,XXXX style when there isn't any code that will be relying on
it?

g.
Segher Boessenkool - March 13, 2010, 3:21 a.m.
> The historical background here is that in the original OF spec, driver
> matching was done on node name, and only then on compatible.
> Essentially the node name was treated as an implicit first entry in
> the compatible list.  The the generic names convention came along, and
> instead name became a human readable generic type for the device
> ("ethernet", "i2c", etc..).

Even with the generic names recommended practice, matching is _still_
done on "name" first, and only then "compatible".  It isn't expected
that anything will try to match one the generic names, so for "new style"
nodes that in effect means matching on "compatible" only, but it is
important for compatibility.

> That convention has been widely used since long before flat trees
> existed, but for some reason it was never really used for cpu nodes;
> they remained as "PowerPC,XXXX" or whatever.

The PowerPC binding was not updated for generic names.

> Because the varying
> names of cpu nodes was sometimes awkward to deal with in bootloaders,
> we decided it would be sensible to apply the generic names convention
> here too, so "cpu@X".  But then, the previous node name, which was
> treated as being prepended to compatible, should now explicitly be put
> into compatible.

Yes.


Segher
Segher Boessenkool - March 13, 2010, 3:22 a.m.
> In this particular case, we're talking about a part that has never
> previously been described in a device tree.  So, since this is
> something entirely new, what is the value in preserving the
> PowerPC,XXXX style when there isn't any code that will be relying on
> it?

There could be code that matches anything starting with "PowerPC,".
Also, consistency is a good thing no matter what.


Segher

Patch

diff -uprN linux-2.6.33.orig/arch/powerpc/boot/dts/mpc5554.dts linux/arch/powerpc/boot/dts/mpc5554.dts
--- linux-2.6.33.orig/arch/powerpc/boot/dts/mpc5554.dts	1970-01-01 01:00:00.000000000 +0100
+++ linux/arch/powerpc/boot/dts/mpc5554.dts	2010-03-12 07:22:37.000000000 +0100
@@ -0,0 +1,189 @@ 
+/*
+ * Freescale MPC5554 Device Tree Source
+ *
+ * Based on MPC5553/5554 Microcontroller Reference Manual, Rev. 4.0, 04/2007
+ * http://www.freescale.com/files/32bit/doc/ref_manual/MPC5553_MPC5554_RM.pdf
+ *
+ * Copyright 2010 Márton Németh
+ * Márton Németh <nm127@freemail.hu>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+/dts-v1/;
+
+/ {
+	model = "MPC5554";
+	compatible = "fsl,MPC5554EVB";		// Freescale MPC5554 Evaluation Board
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu@0 {
+			device_type = "cpu";
+			compatible = "PowerPC,5554";
+			reg = <0>;
+			d-cache-line-size = <32>;
+			i-cache-line-size = <32>;
+			d-cache-size = <0x8000>;	// L1, 32KiB
+			i-cache-size = <0x8000>;	// L1, 32KiB
+			timebase-frequency = <0>;	// from bootloader
+			bus-frequency = <0>;		// from bootloader
+			clock-frequency = <0>;		// from bootloader
+		};
+	};
+
+	memory@40000000 {
+		device_type = "memory";
+		reg = <0x40000000 0x10000>;	// 32KiB internal SRAM
+	};
+
+	xbar@fff04000 {		// System Bus Crossbar Switch (XBAR)
+		compatible = "fsl,mpc5554-xbar";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		// The full memory range is covered by XBAR
+		ranges = <>;
+		reg = <0xfff04000 0x4000>;
+
+		flash@0 {	// read-only FLASH
+			compatible = "fsl,mpc5554-flash";
+			reg = <0x00000000 0x200000>;	// 2MiB internal FLASH
+		};
+
+		bridge@c3f00000 {
+			compatible = "fsl,mpc5554-pbridge-a";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0xc0000000 0x20000000>;
+			reg = <0xc3f00000 0x4000>;
+
+			fmpll@3f80000 {		// Frequency Modulated PLL
+				compatible = "fsl,mpc5554-fmpll";
+				reg = <0x03f80000 0x4000>;
+			};
+
+			flashconfig@3f88000 {	// Flash Configuration
+				compatible = "fsl,mpc5554-flashconfig";
+				reg = <0x03f88000 0x4000>;
+			};
+
+			siu@3f89000 {		// System Integration Unit
+				compatible = "fsl,mpc5554-siu";
+				reg = <0x03f90000 0x4000>;
+			};
+
+			emios@3fa0000 {		// Modular Timer System
+				compatible = "fsl,mpc5554-emios";
+				reg = <0x03fa0000 0x4000>;
+			};
+
+			etpu@3fc0000 {		// Enhanced Time Processing Unit
+				compatible = "fsl,mpc5554-etpu";
+				reg = <0x03fc0000 0x4000>;
+			};
+
+			etpudata@3fc8000 {	// eTPU Shared Data Memory (Parameter RAM)
+				compatible = "fsl,mpc5554-etpudata";
+				reg = <0x03fc8000 0x4000>;
+			};
+
+			etpudata@3fcc000 {	// eTPU Shared Data Memory (Parameter RAM) mirror
+				compatible = "fsl,mpc5554-etpudata";
+				reg = <0x03fcc000 0x4000>;
+			};
+
+			etpucode@3fd0000 {		// eTPU Shared Code RAM
+				compatible = "fsl,mpc5554-etpucode";
+				reg = <0x03fd0000 0x4000>;
+			};
+		};
+
+		bridge@fff00000 {
+			compatible = "fsl,mpc5554-pbridge-b";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0xe0000000 0x20000000>;
+			reg = <0xfff00000 0x4000>;
+
+			ecsm@fff40000 {		// Error Correction Status Module (ECSM)
+				compatible = "fsl,mpc5554-ecsm";
+				reg = <0xfff40000 0x4000>;
+			};
+
+			edma@fff44000 {		// Enhanced DMA Controller (eDMA)
+				compatible = "fsl,mpc5554-edma";
+				reg = <0xfff44000 0x4000>;
+			};
+
+			intc@fff48000 {		// Interrupt Controller (INTC)
+				compatible = "fsl,mpc5554-intc";
+				reg = <0xfff48000 0x4000>;
+			};
+
+			eqadc@fff80000 {	// Enhanced Queued Analog-to-Digital Converter (eQADC)
+				compatible = "fsl,mpc5554-eqacd";
+				reg = <0xfff80000 0x4000>;
+			};
+
+			dspi@fff90000 {		// Deserial Serial Peripheral Interface (DSPI_A)
+				compatible = "fsl,mpc5554-dspi";
+				reg = <0xfff90000 0x4000>;
+			};
+
+			dspi@fff94000 {		// Deserial Serial Peripheral Interface (DSPI_B)
+				compatible = "fsl,mpc5554-dspi";
+				reg = <0xfff94000 0x4000>;
+			};
+
+			dspi@fff98000 {		// Deserial Serial Peripheral Interface (DSPI_C)
+				compatible = "fsl,mpc5554-dspi";
+				reg = <0xfff98000 0x4000>;
+			};
+
+			dspi@fff9c000 {		// Deserial Serial Peripheral Interface (DSPI_D)
+				compatible = "fsl,mpc5554-dspi";
+				reg = <0xfff9c000 0x4000>;
+			};
+
+			sci@fffb0000 {		// Serial Communications Interface (SCI_A)
+				compatible = "fsl,mpc5554-sci";
+				reg = <0xfffb0000 0x4000>;
+			};
+
+			sci@fffb4000 {		// Serial Communications Interface (SCI_B)
+				compatible = "fsl,mpc5554-sci";
+				reg = <0xfffb4000 0x4000>;
+			};
+
+			can@fffc0000 {		// Controller Area Network (FlexCAN_A)
+				compatible = "fsl,mpc5554-flexcan";
+				reg = <0xfffc0000 0x4000>;
+			};
+
+			can@fffc4000 {		// Controller Area Network (FlexCAN_B)
+				compatible = "fsl,mpc5554-flexcan";
+				reg = <0xfffc4000 0x4000>;
+			};
+
+			can@fffc8000 {		// Controller Area Network (FlexCAN_C)
+				compatible = "fsl,mpc5554-flexcan";
+				reg = <0xfffc8000 0x4000>;
+			};
+
+			bam@ffffc000 {		// Boot Assist Module (BAM)
+				compatible = "fsl,mpc5554-bam";
+				reg = <0xffffc000 0x4000>;
+			};
+
+		};
+
+	};
+
+};