linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add a simple 405EP based board
@ 2008-08-21  8:07 Markus Brunner
  2008-08-21  8:52 ` Stephen Rothwell
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Markus Brunner @ 2008-08-21  8:07 UTC (permalink / raw)
  To: linuxppc-dev

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.

Signed-off-by: Markus Brunner <super.firetwister@googlemail.com>
---
 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
--- linux-2.6.27-rc4-orig/arch/powerpc/boot/dts/ppc405ep.dts	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.27-rc4/arch/powerpc/boot/dts/ppc405ep.dts	2008-08-21 09:35:45.722031912 +0200
@@ -0,0 +1,218 @@
+/*
+ * Device Tree Source for ppc405ep
+ *
+ * (c) 2008 Markus Brunner <super.firetwister@googlemail.com>
+ *
+ * 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
--- linux-2.6.27-rc4-orig/arch/powerpc/platforms/40x/Kconfig	2008-07-13 23:51:29.000000000 +0200
+++ linux-2.6.27-rc4/arch/powerpc/platforms/40x/Kconfig	2008-08-21 09:35:45.722031912 +0200
@@ -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
--- linux-2.6.27-rc4-orig/arch/powerpc/platforms/40x/Makefile	2008-07-13 23:51:29.000000000 +0200
+++ linux-2.6.27-rc4/arch/powerpc/platforms/40x/Makefile	2008-08-21 10:03:54.718530907 +0200
@@ -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
--- linux-2.6.27-rc4-orig/arch/powerpc/platforms/40x/ppc405ep.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.27-rc4/arch/powerpc/platforms/40x/ppc405ep.c	2008-08-21 09:35:45.728701197 +0200
@@ -0,0 +1,58 @@
+/*
+ * Powerpc 405EP board setup. Not aimed at any particular board.
+ *
+ * Copyright(c) 2008 Markus Brunner <super.firetwister@googlemail.com>
+ *
+ * Based on the Walnut code by
+ * Josh Boyer <jwboyer@linux.vnet.ibm.com>
+ * Copyright 2007 IBM Corporation
+ *
+ * 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.
+ */
+
+#include <linux/init.h>
+#include <linux/of_platform.h>
+
+#include <asm/machdep.h>
+#include <asm/ppc4xx.h>
+#include <asm/time.h>
+#include <asm/udbg.h>
+#include <asm/uic.h>
+
+
+static __initdata struct of_device_id ppc405ep_of_bus[] = {
+	{ .compatible = "ibm,plb3", },
+	{ .compatible = "ibm,opb", },
+	{ .compatible = "ibm,ebc", },
+	{},
+};
+
+static int __init ppc405ep_device_probe(void)
+{
+	of_platform_bus_probe(NULL, ppc405ep_of_bus, NULL);
+
+	return 0;
+}
+machine_device_initcall(ppc405ep, ppc405ep_device_probe);
+
+static int __init ppc405ep_probe(void)
+{
+	unsigned long root = of_get_flat_dt_root();
+	if (!of_flat_dt_is_compatible(root, "company,ppc405ep"))
+		return 0;
+
+	return 1;
+}
+
+define_machine(ppc405ep) {
+	.name 				= "ppc405ep",
+	.probe 				= ppc405ep_probe,
+	.progress 			= udbg_progress,
+	.init_IRQ 			= uic_init_tree,
+	.get_irq 			= uic_get_irq,
+	.restart			= ppc4xx_reset_system,
+	.calibrate_decr			= generic_calibrate_decr,
+};

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add a simple 405EP based board
  2008-08-21  8:07 [PATCH] add a simple 405EP based board Markus Brunner
@ 2008-08-21  8:52 ` Stephen Rothwell
  2008-08-21 11:55 ` Josh Boyer
  2008-08-26  0:41 ` David Gibson
  2 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2008-08-21  8:52 UTC (permalink / raw)
  To: Markus Brunner; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 673 bytes --]

Hi Markus,

One small nit:

On Thu, 21 Aug 2008 10:07:58 +0200 Markus Brunner <super.firetwister@googlemail.com> wrote:
>
> +#include <linux/init.h>
> +#include <linux/of_platform.h>
> +
> +#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.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add a simple 405EP based board
  2008-08-21  8:07 [PATCH] add a simple 405EP based board Markus Brunner
  2008-08-21  8:52 ` Stephen Rothwell
@ 2008-08-21 11:55 ` Josh Boyer
  2008-08-21 12:46   ` M B
  2008-08-21 13:42   ` Arnd Bergmann
  2008-08-26  0:41 ` David Gibson
  2 siblings, 2 replies; 8+ messages in thread
From: Josh Boyer @ 2008-08-21 11:55 UTC (permalink / raw)
  To: Markus Brunner; +Cc: linuxppc-dev

On Thu, 2008-08-21 at 10:07 +0200, Markus Brunner wrote:
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add a simple 405EP based board
  2008-08-21 11:55 ` Josh Boyer
@ 2008-08-21 12:46   ` M B
  2008-08-21 13:42   ` Arnd Bergmann
  1 sibling, 0 replies; 8+ messages in thread
From: M B @ 2008-08-21 12:46 UTC (permalink / raw)
  To: jwboyer; +Cc: linuxppc-dev

On 8/21/08, Josh Boyer <jwboyer@linux.vnet.ibm.com> wrote:

> 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.

> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add a simple 405EP based board
  2008-08-21 11:55 ` Josh Boyer
  2008-08-21 12:46   ` M B
@ 2008-08-21 13:42   ` Arnd Bergmann
  2008-08-21 16:10     ` Josh Boyer
  1 sibling, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2008-08-21 13:42 UTC (permalink / raw)
  To: linuxppc-dev, jwboyer; +Cc: Markus Brunner

On Thursday 21 August 2008, Josh Boyer wrote:
> On Thu, 2008-08-21 at 10:07 +0200, Markus Brunner wrote:
> > 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
> > 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.
>=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 <><

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add a simple 405EP based board
  2008-08-21 13:42   ` Arnd Bergmann
@ 2008-08-21 16:10     ` Josh Boyer
  2008-08-22 12:39       ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Josh Boyer @ 2008-08-21 16:10 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Markus Brunner, linuxppc-dev

On Thu, 2008-08-21 at 15:42 +0200, Arnd Bergmann wrote:
> On Thursday 21 August 2008, Josh Boyer wrote:
> > On Thu, 2008-08-21 at 10:07 +0200, Markus Brunner wrote:
> > > 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.
> > 
> 
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add a simple 405EP based board
  2008-08-21 16:10     ` Josh Boyer
@ 2008-08-22 12:39       ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2008-08-22 12:39 UTC (permalink / raw)
  To: linuxppc-dev, jwboyer; +Cc: Markus Brunner

On Thursday 21 August 2008, Josh Boyer wrote:
> I can understand why, as they are really two different platforms. =A0So
> logically it makes sense to have them separate.

Ok, fair enough.

	Arnd <><

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add a simple 405EP based board
  2008-08-21  8:07 [PATCH] add a simple 405EP based board Markus Brunner
  2008-08-21  8:52 ` Stephen Rothwell
  2008-08-21 11:55 ` Josh Boyer
@ 2008-08-26  0:41 ` David Gibson
  2 siblings, 0 replies; 8+ messages in thread
From: David Gibson @ 2008-08-26  0:41 UTC (permalink / raw)
  To: Markus Brunner; +Cc: linuxppc-dev

On Thu, Aug 21, 2008 at 10:07:58AM +0200, Markus Brunner wrote:
> 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.
> 
> Signed-off-by: Markus Brunner <super.firetwister@googlemail.com>

[snip]
> +			EMAC0: ethernet@ef600800 {
> +				linux,network-index = <0>;

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

-- 
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-08-26  0:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-21  8:07 [PATCH] add a simple 405EP based board Markus Brunner
2008-08-21  8:52 ` Stephen Rothwell
2008-08-21 11:55 ` Josh Boyer
2008-08-21 12:46   ` M B
2008-08-21 13:42   ` Arnd Bergmann
2008-08-21 16:10     ` Josh Boyer
2008-08-22 12:39       ` Arnd Bergmann
2008-08-26  0:41 ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).