Skip to contentSkip to conversation

add a simple 405EP based board

PATCH In review Markus Brunner 5 participants 8 messages Aug 21, 2008 – Aug 26, 2008

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

PATCH 1/1 add a simple 405EP based board

This adds support for a simple ppc405ep board.
At the moment, there are no 405ep boards in arch/powerpc, so this can be used as a template for new boards, or migrating them from arch/ppc.
I2c, UART and EMAC are working. PCI could not be tested, so it was not included in the dts.

---
 boot/dts/ppc405ep.dts    |  218 +++++++++++++++++++++++++++++++++++++++++++++++
 platforms/40x/Kconfig    |    8 +
 platforms/40x/Makefile   |    1
 platforms/40x/ppc405ep.c |   58 ++++++++++++
 4 files changed, 285 insertions(+)

diff -upNr linux-2.6.27-rc4-orig/arch/powerpc/boot/dts/ppc405ep.dts linux-2.6.27-rc4/arch/powerpc/boot/dts/ppc405ep.dts

arch/powerpc/boot/dts/ppc405ep.dts +218 -0
@@ -0,0 +1,218 @@
+/*
+ * Device Tree Source for ppc405ep
+ *
+ * (c) 2008 Markus Brunner <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without
+ * any warranty of any kind, whether express or implied.
+ */
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	model = "company,ppc405ep";
+	compatible = "company,ppc405ep";
+	dcr-parent = <&/cpus/cpu@0>;
+
+	aliases {
+		ethernet0 = &EMAC0;
+		ethernet1 = &EMAC1;
+		serial0 = &UART0;
+		serial1 = &UART1;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu@0 {
+			device_type = "cpu";
+			model = "PowerPC,405EP";
+			reg = <0>;
+			clock-frequency = <0>; /* Filled in by u-boot */
+			timebase-frequency = <0>; /* Filled in by u-boot */
+			i-cache-line-size = <20>;
+			d-cache-line-size = <20>;
+			i-cache-size = <4000>;
+			d-cache-size = <4000>;
+			dcr-controller;
+			dcr-access-method = "native";
+		};
+	};
+
+	memory {
+		device_type = "memory";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		reg = <00000000 00000000>;	/* Filled in by u-boot */
+	};
+
+	UIC0: interrupt-controller {
+		compatible = "ibm,uic";
+		interrupt-controller;
+		cell-index = <0>;
+		dcr-reg = <0c0 9>;
+		#address-cells = <0>;
+		#size-cells = <0>;
+		#interrupt-cells = <2>;
+	};
+
+	plb {
+		compatible = "ibm,plb3";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+		clock-frequency = <0>; /* Filled in by u-boot */
+
+		SDRAM0: memory-controller {
+			compatible = "ibm,sdram-405ep";
+			dcr-reg = <010 2>;
+		};
+
+		MAL: mcmal {
+			compatible = "ibm,mcmal-405ep", "ibm,mcmal";
+			dcr-reg = <180 62>;
+			num-tx-chans = <4>;
+			num-rx-chans = <4>;
+			interrupt-parent = <&UIC0>;
+			interrupts = <
+				b 4 /* TXEOB */
+				c 4 /* RXEOB */
+				a 4 /* SERR */
+				d 4 /* TXDE */
+				e 4 /* RXDE */>;
+		};
+
+		POB0: opb {
+			compatible = "ibm,opb-405ep", "ibm,opb";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <ef600000 ef600000 a00000>;
+			dcr-reg = <0a0 5>;
+			clock-frequency = <0>; /* Filled in by u-boot */
+
+			UART0: serial@ef600300 {
+				device_type = "serial";
+				compatible = "ns16550";
+				reg = <ef600300 8>;
+				virtual-reg = <ef600300>;
+				clock-frequency = <0>; /* Filled in by u-boot */
+				current-speed = <1c200>;
+				interrupt-parent = <&UIC0>;
+				interrupts = <0 4>;
+			};
+
+			UART1: serial@ef600400 {
+				device_type = "serial";
+				compatible = "ns16550";
+				reg = <ef600400 8>;
+				virtual-reg = <ef600400>;
+				clock-frequency = <0>; /* Filled in by u-boot */
+				current-speed = <1c200>;
+				interrupt-parent = <&UIC0>;
+				interrupts = <1 4>;
+			};
+
+			IIC: i2c@ef600500 {
+				compatible = "ibm,iic-405ep", "ibm,iic";
+				reg = <ef600500 11>;
+				interrupt-parent = <&UIC0>;
+				interrupts = <2 4>;
+			};
+
+			GPIO: gpio@ef600700 {
+				compatible = "ibm,gpio-405ep";
+				reg = <ef600700 38>;
+			};
+
+			EMAC0: ethernet@ef600800 {
+				linux,network-index = <0>;
+				device_type = "network";
+				compatible = "ibm,emac-405ep", "ibm,emac";
+				interrupt-parent = <&UIC0>;
+				interrupts = <
+					f 4 /* Ethernet */
+					9 4 /* Ethernet Wake Up */>;
+				local-mac-address = [000000000000]; /* Filled in by u-boot */
+				reg = <ef600800 70>;
+				mal-device = <&MAL>;
+				mal-tx-channel = <0>;
+				mal-rx-channel = <0>;
+				cell-index = <0>;
+				max-frame-size = <5dc>;
+				rx-fifo-size = <1000>;
+				tx-fifo-size = <800>;
+				phy-mode = "mii";
+				phy-map = <00000000>;
+			};
+
+			EMAC1: ethernet@ef600900 {
+				linux,network-index = <1>;
+				device_type = "network";
+				compatible = "ibm,emac-405ep", "ibm,emac";
+				interrupt-parent = <&UIC0>;
+				interrupts = <
+					11 4 /* Ethernet */
+					9 4 /* Ethernet Wake Up */>;
+				local-mac-address = [000000000000]; /* Filled in by u-boot */
+				reg = <ef600900 70>;
+				mal-device = <&MAL>;
+				mal-tx-channel = <2>;
+				mal-rx-channel = <1>;
+				cell-index = <1>;
+				max-frame-size = <5dc>;
+				rx-fifo-size = <1000>;
+				tx-fifo-size = <800>;
+				mdio-device = <&EMAC0>;
+				phy-mode = "mii";
+				phy-map = <00000020>;
+			};
+
+
+		};
+
+		EBC0: ebc {
+			compatible = "ibm,ebc-405ep", "ibm,ebc";
+			dcr-reg = <012 2>;
+			#address-cells = <2>;
+			#size-cells = <1>;
+			ranges = <0 0 f8000000 8000000
+				  1 0 0c000000  100000
+				  2 0 0C100000  100000
+				  3 0 0C200000  100000
+				  4 0 80000000  100000>;
+
+			clock-frequency = <0>; /* Filled in by u-boot */
+
+			nor_flash@0,0 {
+				compatible = "amd,s29gl01gp", "cfi-flash";
+				bank-width = <2>;
+				reg = <0 000000 8000000>;
+				#address-cells = <1>;
+				#size-cells = <1>;
+				partition@0 {
+					label = "jffs2";
+					reg = <0 a00000>;
+				};
+				partition@a00000 {
+					label = "foo";
+					reg = <a00000 400000>;
+				};
+				partition@e00000 {
+					label = "bar";
+					reg = <e00000 7180000>;
+				};
+				partition@7f80000 {
+					label = "u-boot";
+					reg = <7f80000 80000>;
+				};
+			};
+		};
+		/* PCI0: pci@ec000000 { PCI was not tested } */
+	};
+
+	chosen {
+		linux,stdout-path = "/plb/opb/serial@ef600300";
+	};
+};

diff -upNr linux-2.6.27-rc4-orig/arch/powerpc/platforms/40x/Kconfig linux-2.6.27-rc4/arch/powerpc/platforms/40x/Kconfig

arch/powerpc/platforms/40x/Kconfig +8 -0
@@ -42,6 +42,14 @@ config MAKALU
 	help
 	  This option enables support for the AMCC PPC405EX board.
 
+config PPC405EP
+	bool "ppc405ep"
+	depends on 40x
+	default n
+	select 405EP
+	help
+	  This option enables support for a simple ppc 405ep board.
+
 #config REDWOOD_5
 #	bool "Redwood-5"
 #	depends on 40x

diff -upNr linux-2.6.27-rc4-orig/arch/powerpc/platforms/40x/Makefile linux-2.6.27-rc4/arch/powerpc/platforms/40x/Makefile

arch/powerpc/platforms/40x/Makefile +1 -0
@@ -3,3 +3,4 @@ obj-$(CONFIG_MAKALU)				+= makalu.o
 obj-$(CONFIG_WALNUT)				+= walnut.o
 obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD)	+= virtex.o
 obj-$(CONFIG_EP405)				+= ep405.o
+obj-$(CONFIG_PPC405EP)				+= ppc405ep.o

diff -upNr linux-2.6.27-rc4-orig/arch/powerpc/platforms/40x/ppc405ep.c linux-2.6.27-rc4/arch/powerpc/platforms/40x/ppc405ep.c

arch/powerpc/platforms/40x/ppc405ep.c +58 -0

58 lines not on this page · raw message

#1 lore raw

Hi Markus,

One small nit:

Quoted 4 lines · On Thu, 21 Aug 2008 10:07:58 +0200 Markus Brunner…
arch/powerpc/platforms/40x/ppc405ep.c +3 -0
+#include <linux/init.h>
+#include <linux/of_platform.h>
+

arch/powerpc/platforms/40x/ppc405ep.c line 44

Quoted 10 lines
arch/powerpc/platforms/40x/ppc405ep.c +10 -0
+#include <asm/machdep.h>
+#include <asm/ppc4xx.h>
+#include <asm/time.h>
+#include <asm/udbg.h>
+#include <asm/uic.h>
+
+static int __init ppc405ep_probe(void)
+{
+	unsigned long root = of_get_flat_dt_root();
+	if (!of_flat_dt_is_compatible(root, "company,ppc405ep"))

You need to include <asm/prom.h> to use the of_flat ... routines.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#2 lore raw
In reply to Markus Brunner
Quoted 4 lines · Markus Brunner

This adds support for a simple ppc405ep board.
At the moment, there are no 405ep boards in arch/powerpc, so this can be used as a template for new boards, or migrating them from arch/ppc.
I2c, UART and EMAC are working. PCI could not be tested, so it was not included in the dts.

I plan on adding more 405 board support very soon. When I do, it'll be along the lines of the patch series I just sent out for 44x. There's really no reason to have a per CPU/board file if we can avoid it.

Your code is simple enough overall, so I might even use it as a starting point. If I do, I'll certainly give you credit. Though it's incomplete in that you have a DTS that requires something to poke values into it, and nothing readily apparent to do so. A cuImage wrapper is probably warranted here.

josh

author
#3 lore raw
Quoted 7 lines · Josh Boyer

I plan on adding more 405 board support very soon. When I do, it'll be along the lines of the patch series I just sent out for 44x. There's really no reason to have a per CPU/board file if we can avoid it.

Your code is simple enough overall, so I might even use it as a starting

I've seen your patches for 44x support and I like the idea of a general board setup.
I wanted to make the dts public, because I needed some help to figure out the "mdio-device" tag. So if you have further use for this you're welcome.

Quoted 4 lines

Though it's incomplete
in that you have a DTS that requires something to poke values into it, and nothing readily apparent to do so. A cuImage wrapper is probably warranted here.

The missing values in the dts get filled in by ft_cpu_setup(...) from uboot, it's generic code and not board specific, but the board setup in u-boot must call it, so it won't work for all boards.

Best regards

Markus

#4 lore raw
In reply to Josh Boyer
Quoted 3 lines · Josh Boyer
Quoted 2 lines · Markus Brunner

This adds support for a simple ppc405ep board.=20
At the moment, there are no 405ep boards in arch/powerpc, so this can b=

e used as a template

Quoted 2 lines
Quoted 2 lines

for new boards, or migrating them from arch/ppc.
I2c, UART and EMAC are working. PCI could not be tested, so it was not =

included in the dts.

Quoted 5 lines

=20
I plan on adding more 405 board support very soon. =A0When I do, it'll be along the lines of the patch series I just sent out for 44x. =A0There's really no reason to have a per CPU/board file if we can avoid it. =20

This may be a stupid question, but is there really a reason to keep 40x and=
44x
setup files separate? AFAICT, the ppc_md structures are the same, so even y= ou
can never have a common binary between 40x and 44x, you may have the same p= latform
file.

	Arnd <><
#5 lore raw
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · Josh Boyer
Quoted 4 lines · Markus Brunner

This adds support for a simple ppc405ep board.
At the moment, there are no 405ep boards in arch/powerpc, so this can be used as a template for new boards, or migrating them from arch/ppc.
I2c, UART and EMAC are working. PCI could not be tested, so it was not included in the dts.

I plan on adding more 405 board support very soon. When I do, it'll be along the lines of the patch series I just sent out for 44x. There's really no reason to have a per CPU/board file if we can avoid it.

Quoted 4 lines

This may be a stupid question, but is there really a reason to keep 40x and 44x setup files separate? AFAICT, the ppc_md structures are the same, so even you can never have a common binary between 40x and 44x, you may have the same platform file.

arch/ppc had them all lumped under platforms/4xx, but this was split in the original arch/powerpc port when arch/powerpc/platforms/44x was created. That left arch/powerpc/platforms/4xx for 40x which didn't really make sense, so it was renamed to 40x.

I can understand why, as they are really two different platforms. So logically it makes sense to have them separate. I'm not overly motivated to convert it back to the old way but I might be able to be convinced.

josh

#6 lore raw
Quoted 2 lines · Josh Boyer

I can understand why, as they are really two different platforms. =A0So logically it makes sense to have them separate.

Ok, fair enough.

	Arnd <><
#7 lore raw
In reply to Markus Brunner
Quoted 6 lines · Markus Brunner

This adds support for a simple ppc405ep board.
At the moment, there are no 405ep boards in arch/powerpc, so this can be used as a template for new boards, or migrating them from arch/ppc.
I2c, UART and EMAC are working. PCI could not be tested, so it was not included in the dts.

[snip]

arch/powerpc/boot/dts/ppc405ep.dts line 130

Quoted 2 lines
arch/powerpc/boot/dts/ppc405ep.dts +2 -0
+			EMAC0: ethernet@ef600800 {
+				linux,network-index = <0>;

The network-index property is obsolete, you shouldn't need it any more.

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