linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Patchset to establish sanity in Xilinx Virtex support
@ 2007-04-15  7:27 Grant Likely
  2007-04-15  7:27 ` [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform Grant Likely
  0 siblings, 1 reply; 21+ messages in thread
From: Grant Likely @ 2007-04-15  7:27 UTC (permalink / raw)
  To: linuxppc-embedded, Andrei Konovalov, Peter Korsgaard,
	Rick Moleres, Paul Mackerras

The Virtex support in Linus' tree is a mess.  When I ported the common
devices over to using the platform bus I tried the use the ppc_sys
infrastructure.  ppc_sys is intended for SoCs that have a fixed set of
devices.  It is the *wrong* approach for FPGA support, and I made a
royal mess of things.  This patch set fixes that problem and makes
a number of other changes that make supporting Virtex boards easier.

I do know that changes to arch/ppc are frowned upon at the moment.  However,
4xx support in arch/powerpc is not merged yet, and Virtex support needs
additional work beyond that.  I suspect that arch/ppc support for the
4xx parts is going to need to stay alive for the next 2-3 kernel releases
anyway while arch/powerpc support stablizes.  Getting these patches in
will make it easier to support the Virtex ports while I hack on getting
arch/powerpc stuff figured out.

 arch/ppc/boot/common/misc-common.c    |   15 ++-
 arch/ppc/boot/simple/Makefile         |    1 +
 arch/ppc/boot/simple/uartlite_tty.c   |   37 ++++++
 arch/ppc/platforms/4xx/Kconfig        |   13 +-
 arch/ppc/platforms/4xx/Makefile       |    1 -
 arch/ppc/platforms/4xx/virtex.c       |   56 ---------
 arch/ppc/platforms/4xx/virtex.h       |   47 +++++---
 arch/ppc/platforms/4xx/xilinx_ml300.c |   65 +----------
 arch/ppc/platforms/4xx/xilinx_ml300.h |   45 -------
 arch/ppc/platforms/4xx/xilinx_ml403.c |   66 +----------
 arch/ppc/platforms/4xx/xilinx_ml403.h |   49 --------
 arch/ppc/syslib/Makefile              |    3 +-
 arch/ppc/syslib/virtex_devices.c      |  209 +++++++++++++++++++++++++++++++++
 arch/ppc/syslib/virtex_devices.h      |   27 +++++
 include/asm-ppc/ibm4xx.h              |    8 +-
 include/asm-ppc/ppc_sys.h             |    2 -
 16 files changed, 335 insertions(+), 309 deletions(-)

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

* [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform
  2007-04-15  7:27 Patchset to establish sanity in Xilinx Virtex support Grant Likely
@ 2007-04-15  7:27 ` Grant Likely
  2007-04-15  7:27   ` [PATCH 2/5] [PPC] Merge common virtex header files Grant Likely
                     ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Grant Likely @ 2007-04-15  7:27 UTC (permalink / raw)
  To: linuxppc-embedded, Andrei Konovalov, Peter Korsgaard,
	Rick Moleres, Paul Mackerras

Reverse dependency order for Xilinx Virtex parts.  For these parts, It
makes more sense for boards/chips to specify which features they
provide instead of the features listing the parts they are implemented
in.  I think it also makes adding new board ports simpler.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 arch/ppc/platforms/4xx/Kconfig |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
index 705ae56..f74e25b 100644
--- a/arch/ppc/platforms/4xx/Kconfig
+++ b/arch/ppc/platforms/4xx/Kconfig
@@ -54,11 +54,13 @@ config WALNUT
 
 config XILINX_ML300
 	bool "Xilinx-ML300"
+	select XILINX_VIRTEX_II_PRO
 	help
 	  This option enables support for the Xilinx ML300 evaluation board.
 
 config XILINX_ML403
 	bool "Xilinx-ML403"
+	select XILINX_VIRTEX_4_FX
 	help
 	  This option enables support for the Xilinx ML403 evaluation board.
 endchoice
@@ -215,18 +217,17 @@ config 405GPR
 
 config XILINX_VIRTEX_II_PRO
 	bool
-	depends on XILINX_ML300
-	default y
+	select XILINX_VIRTEX
+	default n
 
 config XILINX_VIRTEX_4_FX
 	bool
-	depends on XILINX_ML403
-	default y
+	select XILINX_VIRTEX
+	default n
 
 config XILINX_VIRTEX
 	bool
-	depends on XILINX_VIRTEX_II_PRO || XILINX_VIRTEX_4_FX
-	default y
+	default n
 
 config STB03xxx
 	bool
-- 
1.5.1

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

* [PATCH 2/5] [PPC] Merge common virtex header files
  2007-04-15  7:27 ` [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform Grant Likely
@ 2007-04-15  7:27   ` Grant Likely
  2007-04-15  7:27     ` [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices Grant Likely
  2007-04-25 12:07     ` [PATCH 2/5] [PPC] Merge common virtex header files Peter Korsgaard
  2007-04-15 10:48   ` [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform Dale Farnsworth
  2007-04-25 12:03   ` Peter Korsgaard
  2 siblings, 2 replies; 21+ messages in thread
From: Grant Likely @ 2007-04-15  7:27 UTC (permalink / raw)
  To: linuxppc-embedded, Andrei Konovalov, Peter Korsgaard,
	Rick Moleres, Paul Mackerras

The header files for the ml403 and ml300 are virtually identical, merge
them into a single file.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 arch/ppc/platforms/4xx/virtex.h       |   40 +++++++++++++++++++-------
 arch/ppc/platforms/4xx/xilinx_ml300.c |    1 +
 arch/ppc/platforms/4xx/xilinx_ml300.h |   45 ------------------------------
 arch/ppc/platforms/4xx/xilinx_ml403.c |    1 +
 arch/ppc/platforms/4xx/xilinx_ml403.h |   49 ---------------------------------
 include/asm-ppc/ibm4xx.h              |    8 +----
 6 files changed, 33 insertions(+), 111 deletions(-)
 delete mode 100644 arch/ppc/platforms/4xx/xilinx_ml300.h
 delete mode 100644 arch/ppc/platforms/4xx/xilinx_ml403.h

diff --git a/arch/ppc/platforms/4xx/virtex.h b/arch/ppc/platforms/4xx/virtex.h
index c14325d..e9f58a7 100644
--- a/arch/ppc/platforms/4xx/virtex.h
+++ b/arch/ppc/platforms/4xx/virtex.h
@@ -1,22 +1,18 @@
 /*
- * arch/ppc/platforms/4xx/virtex.h
+ * Basic Virtex platform defines, included by <asm/ibm4xx.h>
  *
- * Include file that defines the Xilinx Virtex-II Pro processor
+ * 2005-2007 (c) Secret Lab Technologies Ltd.
+ * 2002-2004 (c) MontaVista Software, Inc.
  *
- * Author: MontaVista Software, Inc.
- *         source@mvista.com
- *
- * 2002-2004 (c) MontaVista Software, Inc.  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.
+ * 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.
  */
 
 #ifdef __KERNEL__
 #ifndef __ASM_VIRTEX_H__
 #define __ASM_VIRTEX_H__
 
-/* serial defines */
-
 #include <asm/ibm405.h>
 
 /* Ugly, ugly, ugly! BASE_BAUD defined here to keep 8250.c happy. */
@@ -29,7 +25,29 @@
 enum ppc_sys_devices {
 	VIRTEX_UART, NUM_PPC_SYS_DEVS,
 };
-#endif
   
+typedef struct board_info {
+	unsigned int	 bi_memsize;		/* DRAM installed, in bytes */
+	unsigned char	 bi_enetaddr[6];	/* Local Ethernet MAC address */
+	unsigned int	 bi_intfreq;		/* Processor speed, in Hz */
+	unsigned int	 bi_busfreq;		/* PLB Bus speed, in Hz */
+	unsigned int	 bi_pci_busfreq;	/* PCI Bus speed, in Hz */
+} bd_t;
+
+/* Some 4xx parts use a different timebase frequency from the internal clock.
+ * the Virtex 405 does not, so just use a macro to make tbfreq match intfreq
+*/
+#define bi_tbfreq bi_intfreq
+
+extern const char* virtex_machine_name;
+#define PPC4xx_MACHINE_NAME (virtex_machine_name)
+
+#endif /* !__ASSEMBLY__ */
+
+/* We don't need anything mapped.  Size of zero will accomplish that. */
+#define PPC4xx_ONB_IO_PADDR	0u
+#define PPC4xx_ONB_IO_VADDR	0u
+#define PPC4xx_ONB_IO_SIZE	0u
+
 #endif				/* __ASM_VIRTEX_H__ */
 #endif				/* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.c b/arch/ppc/platforms/4xx/xilinx_ml300.c
index fb5f0b5..4e4aca4 100644
--- a/arch/ppc/platforms/4xx/xilinx_ml300.c
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.c
@@ -68,6 +68,7 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 		},
 	},
 };
+const char* virtex_machine_name = "ML300 Reference Design";
 
 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
 
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.h b/arch/ppc/platforms/4xx/xilinx_ml300.h
deleted file mode 100644
index 3d57332..0000000
--- a/arch/ppc/platforms/4xx/xilinx_ml300.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Include file that defines the Xilinx ML300 evaluation board
- *
- * Author: MontaVista Software, Inc.
- *         source@mvista.com
- *
- * 2002-2004 (c) MontaVista Software, Inc.  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.
- */
-
-#ifdef __KERNEL__
-#ifndef __ASM_XILINX_ML300_H__
-#define __ASM_XILINX_ML300_H__
-
-/* ML300 has a Xilinx Virtex-II Pro processor */
-#include <platforms/4xx/virtex.h>
-
-#ifndef __ASSEMBLY__
-
-#include <linux/types.h>
-
-typedef struct board_info {
-	unsigned int	 bi_memsize;		/* DRAM installed, in bytes */
-	unsigned char	 bi_enetaddr[6];	/* Local Ethernet MAC address */
-	unsigned int	 bi_intfreq;		/* Processor speed, in Hz */
-	unsigned int	 bi_busfreq;		/* PLB Bus speed, in Hz */
-	unsigned int	 bi_pci_busfreq;	/* PCI Bus speed, in Hz */
-} bd_t;
-
-/* Some 4xx parts use a different timebase frequency from the internal clock.
-*/
-#define bi_tbfreq bi_intfreq
-
-#endif /* !__ASSEMBLY__ */
-
-/* We don't need anything mapped.  Size of zero will accomplish that. */
-#define PPC4xx_ONB_IO_PADDR	0u
-#define PPC4xx_ONB_IO_VADDR	0u
-#define PPC4xx_ONB_IO_SIZE	0u
-
-#define PPC4xx_MACHINE_NAME "Xilinx ML300 Reference System"
-
-#endif /* __ASM_XILINX_ML300_H__ */
-#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/xilinx_ml403.c b/arch/ppc/platforms/4xx/xilinx_ml403.c
index cb3bf7a..c98e40a 100644
--- a/arch/ppc/platforms/4xx/xilinx_ml403.c
+++ b/arch/ppc/platforms/4xx/xilinx_ml403.c
@@ -72,6 +72,7 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 		},
 	},
 };
+const char* virtex_machine_name = "ML403 Reference Design";
 
 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
 
diff --git a/arch/ppc/platforms/4xx/xilinx_ml403.h b/arch/ppc/platforms/4xx/xilinx_ml403.h
deleted file mode 100644
index 4735969..0000000
--- a/arch/ppc/platforms/4xx/xilinx_ml403.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * arch/ppc/platforms/4xx/xilinx_ml403.h
- *
- * Include file that defines the Xilinx ML403 reference design
- *
- * Author: Grant Likely <grant.likely@secretlab.ca>
- *
- * 2005 (c) Secret Lab Technologies Ltd.
- * 2002-2004 (c) MontaVista Software, Inc.
- *
- * 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.
- */
-
-#ifdef __KERNEL__
-#ifndef __ASM_XILINX_ML403_H__
-#define __ASM_XILINX_ML403_H__
-
-/* ML403 has a Xilinx Virtex-4 FPGA with a PPC405 hard core */
-#include <platforms/4xx/virtex.h>
-
-#ifndef __ASSEMBLY__
-
-#include <linux/types.h>
-
-typedef struct board_info {
-	unsigned int	 bi_memsize;		/* DRAM installed, in bytes */
-	unsigned char	 bi_enetaddr[6];	/* Local Ethernet MAC address */
-	unsigned int	 bi_intfreq;		/* Processor speed, in Hz */
-	unsigned int	 bi_busfreq;		/* PLB Bus speed, in Hz */
-	unsigned int	 bi_pci_busfreq;	/* PCI Bus speed, in Hz */
-} bd_t;
-
-/* Some 4xx parts use a different timebase frequency from the internal clock.
-*/
-#define bi_tbfreq bi_intfreq
-
-#endif /* !__ASSEMBLY__ */
-
-/* We don't need anything mapped.  Size of zero will accomplish that. */
-#define PPC4xx_ONB_IO_PADDR	0u
-#define PPC4xx_ONB_IO_VADDR	0u
-#define PPC4xx_ONB_IO_SIZE	0u
-
-#define PPC4xx_MACHINE_NAME "Xilinx ML403 Reference Design"
-
-#endif /* __ASM_XILINX_ML403_H__ */
-#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
index 92fd02d..ed6891a 100644
--- a/include/asm-ppc/ibm4xx.h
+++ b/include/asm-ppc/ibm4xx.h
@@ -47,12 +47,8 @@
 #include <platforms/4xx/walnut.h>
 #endif
 
-#if defined(CONFIG_XILINX_ML300)
-#include <platforms/4xx/xilinx_ml300.h>
-#endif
-
-#if defined(CONFIG_XILINX_ML403)
-#include <platforms/4xx/xilinx_ml403.h>
+#if defined(CONFIG_XILINX_VIRTEX)
+#include <platforms/4xx/virtex.h>
 #endif
 
 #ifndef __ASSEMBLY__
-- 
1.5.1

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

* [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices
  2007-04-15  7:27   ` [PATCH 2/5] [PPC] Merge common virtex header files Grant Likely
@ 2007-04-15  7:27     ` Grant Likely
  2007-04-15  7:27       ` [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards Grant Likely
  2007-04-25 12:11       ` [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices Peter Korsgaard
  2007-04-25 12:07     ` [PATCH 2/5] [PPC] Merge common virtex header files Peter Korsgaard
  1 sibling, 2 replies; 21+ messages in thread
From: Grant Likely @ 2007-04-15  7:27 UTC (permalink / raw)
  To: linuxppc-embedded, Andrei Konovalov, Peter Korsgaard,
	Rick Moleres, Paul Mackerras

Currently virtex support in mainline make use of the infrastructure in
arch/ppc/syslib/ppc_sys.c for registering common devices on virtex ppc405
platforms.  The ppc_sys.c code is not well suited to the dynamic nature of
FPGA designs and makes adding new board ports more complex.  This patch
adds a new listing of common devices which does not depend on the ppc_sys.c
infrastructure.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 arch/ppc/syslib/virtex_devices.c |  209 ++++++++++++++++++++++++++++++++++++++
 arch/ppc/syslib/virtex_devices.h |   27 +++++
 2 files changed, 236 insertions(+), 0 deletions(-)
 create mode 100644 arch/ppc/syslib/virtex_devices.c
 create mode 100644 arch/ppc/syslib/virtex_devices.h

diff --git a/arch/ppc/syslib/virtex_devices.c b/arch/ppc/syslib/virtex_devices.c
new file mode 100644
index 0000000..096fb2a
--- /dev/null
+++ b/arch/ppc/syslib/virtex_devices.c
@@ -0,0 +1,209 @@
+/*
+ * Virtex hard ppc405 core common device listing
+ *
+ * Copyright 2005-2007 Secret Lab Technologies Ltd.
+ * Copyright 2005 Freescale Semiconductor Inc.
+ * Copyright 2002-2004 MontaVista Software, Inc.
+ *
+ * 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/module.h>
+#include <linux/device.h>
+#include <linux/serial_8250.h>
+#include <syslib/virtex_devices.h>
+#include <platforms/4xx/xparameters/xparameters.h>
+#include <asm/io.h>
+
+/*
+ * UARTLITE: shortcut macro for single instance
+ */
+#define XPAR_UARTLITE(num) { \
+	.name = "uartlite", \
+	.id = num, \
+	.num_resources = 2, \
+	.resource = (struct resource[]) { \
+		{ \
+			.start = XPAR_UARTLITE_##num##_BASEADDR + 3, \
+			.end = XPAR_UARTLITE_##num##_HIGHADDR, \
+			.flags = IORESOURCE_MEM, \
+		}, \
+		{ \
+			.start = XPAR_INTC_0_UARTLITE_##num##_VEC_ID, \
+			.flags = IORESOURCE_IRQ, \
+		}, \
+	}, \
+}
+
+/*
+ * Full UART: shortcut macro for single instance + platform data structure
+ */
+#define XPAR_UART(num) { \
+	.mapbase = XPAR_UARTNS550_##num##_BASEADDR + 3, \
+	.irq = XPAR_INTC_0_UARTNS550_##num##_VEC_ID, \
+	.iotype = UPIO_MEM, \
+	.uartclk = XPAR_UARTNS550_##num##_CLOCK_FREQ_HZ, \
+	.flags = UPF_BOOT_AUTOCONF, \
+	.regshift = 2, \
+}
+
+/*
+ * SystemACE: shortcut macro for single instance
+ */
+#define XPAR_SYSACE(num) { \
+	.name		= "xsysace", \
+	.id		= XPAR_SYSACE_##num##_DEVICE_ID, \
+	.num_resources	= 2, \
+	.resource = (struct resource[]) { \
+		{ \
+			.start	= XPAR_SYSACE_##num##_BASEADDR, \
+			.end	= XPAR_SYSACE_##num##_HIGHADDR, \
+			.flags	= IORESOURCE_MEM, \
+		}, \
+		{ \
+			.start	= XPAR_INTC_0_SYSACE_##num##_VEC_ID, \
+			.flags	= IORESOURCE_IRQ, \
+		}, \
+	}, \
+}
+
+
+/* UART 8250 driver platform data table */
+struct plat_serial8250_port virtex_serial_platform_data[] = {
+#if defined(XPAR_UARTNS550_0_BASEADDR)
+	XPAR_UART(0),
+#endif
+#if defined(XPAR_UARTNS550_1_BASEADDR)
+	XPAR_UART(1),
+#endif
+#if defined(XPAR_UARTNS550_2_BASEADDR)
+	XPAR_UART(2),
+#endif
+#if defined(XPAR_UARTNS550_3_BASEADDR)
+	XPAR_UART(3),
+#endif
+	{ }, /* terminated by empty record */
+};
+
+
+struct platform_device virtex_platform_devices[] = {
+	/* UARTLITE instances */
+#if defined(XPAR_UARTLITE_0_BASEADDR)
+	XPAR_UARTLITE(0),
+#endif
+#if defined(XPAR_UARTLITE_1_BASEADDR)
+	XPAR_UARTLITE(1),
+#endif
+#if defined(XPAR_UARTLITE_2_BASEADDR)
+	XPAR_UARTLITE(2),
+#endif
+#if defined(XPAR_UARTLITE_3_BASEADDR)
+	XPAR_UARTLITE(3),
+#endif
+
+	/* Full UART instances */
+#if defined(XPAR_UARTNS550_0_BASEADDR)
+	{
+		.name		= "serial8250",
+		.id		= 0,
+		.dev.platform_data = virtex_serial_platform_data,
+	},
+#endif
+
+	/* SystemACE instances */
+#if defined(XPAR_SYSACE_0_BASEADDR)
+	XPAR_SYSACE(0),
+#endif
+#if defined(XPAR_SYSACE_1_BASEADDR)
+	XPAR_SYSACE(1),
+#endif
+
+	/* ML300/403 reference design framebuffer */
+#if defined(XPAR_TFT_0_BASEADDR)
+	{
+		.name		= "xilinxfb",
+		.id		= 0,
+		.num_resources	= 1,
+		.resource = (struct resource[]) {
+			{
+				.start	= XPAR_TFT_0_BASEADDR,
+				.end	= XPAR_TFT_0_BASEADDR+7,
+				.flags	= IORESOURCE_IO,
+			},
+		},
+	},
+#endif
+};
+
+/* Early serial support functions */
+static void __init
+virtex_early_serial_init(int num, struct plat_serial8250_port *pdata)
+{
+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+	struct uart_port serial_req;
+
+	memset(&serial_req, 0, sizeof(serial_req));
+	serial_req.mapbase	= pdata->mapbase;
+	serial_req.membase	= pdata->membase;
+	serial_req.irq		= pdata->irq;
+	serial_req.uartclk	= pdata->uartclk;
+	serial_req.regshift	= pdata->regshift;
+	serial_req.iotype	= pdata->iotype;
+	serial_req.flags	= pdata->flags;
+	gen550_init(num, &serial_req);
+#endif
+}
+
+void __init
+virtex_early_serial_map(void)
+{
+#ifdef CONFIG_SERIAL_8250
+	struct plat_serial8250_port *pdata;
+	int i = 0;
+
+	pdata = virtex_serial_platform_data;
+	while(pdata && pdata->flags) {
+		pdata->membase = ioremap(pdata->mapbase, 0x100);
+		virtex_early_serial_init(i, pdata);
+		pdata++;
+		i++;
+	}
+#endif /* CONFIG_SERIAL_8250 */
+}
+
+/*
+ * default fixup routine; do nothing and return success.
+ *
+ * Reimplement this routine in your custom board support file to
+ * override the default behaviour
+ */
+int __attribute__ ((weak))
+virtex_device_fixup(struct platform_device *dev)
+{
+	return 0;
+}
+
+static int __init virtex_init(void)
+{
+	struct platform_device *index = virtex_platform_devices;
+	unsigned int ret = 0;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(virtex_platform_devices); i++, index++) {
+		if (virtex_device_fixup(index) != 0)
+			continue;
+
+		if (platform_device_register(index)) {
+			ret = 1;
+			printk(KERN_ERR "cannot register dev %s:%d\n",
+			       index->name, index->id);
+		}
+	}
+	return ret;
+}
+
+subsys_initcall(virtex_init);
diff --git a/arch/ppc/syslib/virtex_devices.h b/arch/ppc/syslib/virtex_devices.h
new file mode 100644
index 0000000..4a17dd3
--- /dev/null
+++ b/arch/ppc/syslib/virtex_devices.h
@@ -0,0 +1,27 @@
+/*
+ * Common support header for virtex ppc405 platforms
+ *
+ * Copyright 2007 Secret Lab Technologies Ltd.
+ *
+ * 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.
+ */
+
+#ifndef __ASM_VIRTEX_DEVICES_H__
+#define __ASM_VIRTEX_DEVICES_H__
+
+#include <linux/platform_device.h>
+
+void __init virtex_early_serial_map(void);
+
+/* Prototype for device fixup routine.  Implement this routine in the
+ * board specific fixup code and the generic setup code will call it for
+ * each device is the platform device list.
+ *
+ * If the hook returns a non-zero value, then the device will not get
+ * registered with the platform bus
+ */
+int virtex_device_fixup(struct platform_device *dev);
+
+#endif  /* __ASM_VIRTEX_DEVICES_H__ */
-- 
1.5.1

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

* [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards
  2007-04-15  7:27     ` [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices Grant Likely
@ 2007-04-15  7:27       ` Grant Likely
  2007-04-15  7:27         ` [PATCH 5/5] [PPC] Add uartlite boot console driver for the zImage wrapper Grant Likely
  2007-04-25 12:12         ` [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards Peter Korsgaard
  2007-04-25 12:11       ` [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices Peter Korsgaard
  1 sibling, 2 replies; 21+ messages in thread
From: Grant Likely @ 2007-04-15  7:27 UTC (permalink / raw)
  To: linuxppc-embedded, Andrei Konovalov, Peter Korsgaard,
	Rick Moleres, Paul Mackerras

The arch/ppc/syslib/ppc_sys.c infrastructure does not work well for the
virtex ports.  Move the ml300 and ml403 board ports over to use the new
virtex_devices infrastructure.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 arch/ppc/platforms/4xx/Makefile       |    1 -
 arch/ppc/platforms/4xx/virtex.c       |   56 ----------------------------
 arch/ppc/platforms/4xx/virtex.h       |    7 +---
 arch/ppc/platforms/4xx/xilinx_ml300.c |   64 ++------------------------------
 arch/ppc/platforms/4xx/xilinx_ml403.c |   65 ++-------------------------------
 arch/ppc/syslib/Makefile              |    3 +-
 include/asm-ppc/ppc_sys.h             |    2 -
 7 files changed, 11 insertions(+), 187 deletions(-)
 delete mode 100644 arch/ppc/platforms/4xx/virtex.c

diff --git a/arch/ppc/platforms/4xx/Makefile b/arch/ppc/platforms/4xx/Makefile
index fa6610b..723ad79 100644
--- a/arch/ppc/platforms/4xx/Makefile
+++ b/arch/ppc/platforms/4xx/Makefile
@@ -28,5 +28,4 @@ obj-$(CONFIG_440SP)		+= ibm440sp.o
 obj-$(CONFIG_440SPE)		+= ppc440spe.o
 obj-$(CONFIG_405EP)		+= ibm405ep.o
 obj-$(CONFIG_405GPR)		+= ibm405gpr.o
-obj-$(CONFIG_XILINX_VIRTEX)	+= virtex.o
 
diff --git a/arch/ppc/platforms/4xx/virtex.c b/arch/ppc/platforms/4xx/virtex.c
deleted file mode 100644
index 133a831..0000000
--- a/arch/ppc/platforms/4xx/virtex.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Virtex-II Pro & Virtex-4 FX common infrastructure
- *
- * Maintainer: Grant Likely <grant.likely@secretlab.ca>
- *
- * Copyright 2005 Secret Lab Technologies Ltd.
- * Copyright 2005 General Dynamics Canada Ltd.
- * Copyright 2005 Freescale Semiconductor Inc.
- *
- * 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/module.h>
-#include <linux/device.h>
-#include <linux/serial_8250.h>
-#include <asm/ppc_sys.h>
-#include <platforms/4xx/virtex.h>
-#include <platforms/4xx/xparameters/xparameters.h>
-
-#define XPAR_UART(num) { \
-		.mapbase  = XPAR_UARTNS550_##num##_BASEADDR + 3, \
-		.irq	  = XPAR_INTC_0_UARTNS550_##num##_VEC_ID, \
-		.iotype	  = UPIO_MEM, \
-		.uartclk  = XPAR_UARTNS550_##num##_CLOCK_FREQ_HZ, \
-		.flags	  = UPF_BOOT_AUTOCONF, \
-		.regshift = 2, \
-	}
-
-struct plat_serial8250_port serial_platform_data[] = {
-#ifdef XPAR_UARTNS550_0_BASEADDR
-	XPAR_UART(0),
-#endif
-#ifdef XPAR_UARTNS550_1_BASEADDR
-	XPAR_UART(1),
-#endif
-#ifdef XPAR_UARTNS550_2_BASEADDR
-	XPAR_UART(2),
-#endif
-#ifdef XPAR_UARTNS550_3_BASEADDR
-	XPAR_UART(3),
-#endif
-	{ }, /* terminated by empty record */
-};
-
-struct platform_device ppc_sys_platform_devices[] = {
-	[VIRTEX_UART] = {
-		.name		= "serial8250",
-		.id		= 0,
-		.dev.platform_data = serial_platform_data,
-	},
-};
-
diff --git a/arch/ppc/platforms/4xx/virtex.h b/arch/ppc/platforms/4xx/virtex.h
index e9f58a7..4fc76da 100644
--- a/arch/ppc/platforms/4xx/virtex.h
+++ b/arch/ppc/platforms/4xx/virtex.h
@@ -19,13 +19,8 @@
 #if !defined(BASE_BAUD)
  #define BASE_BAUD		(0) /* dummy value; not used */
 #endif
-  
-/* Device type enumeration for platform bus definitions */
+
 #ifndef __ASSEMBLY__
-enum ppc_sys_devices {
-	VIRTEX_UART, NUM_PPC_SYS_DEVS,
-};
-  
 typedef struct board_info {
 	unsigned int	 bi_memsize;		/* DRAM installed, in bytes */
 	unsigned char	 bi_enetaddr[6];	/* Local Ethernet MAC address */
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.c b/arch/ppc/platforms/4xx/xilinx_ml300.c
index 4e4aca4..6e522fe 100644
--- a/arch/ppc/platforms/4xx/xilinx_ml300.c
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.c
@@ -18,9 +18,9 @@
 #include <linux/serialP.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
-#include <asm/ppc_sys.h>
 
 #include <syslib/gen550.h>
+#include <syslib/virtex_devices.h>
 #include <platforms/4xx/xparameters/xparameters.h>
 
 /*
@@ -53,25 +53,9 @@
  *          ppc4xx_pic_init			arch/ppc/syslib/xilinx_pic.c
  */
 
-/* Board specifications structures */
-struct ppc_sys_spec *cur_ppc_sys_spec;
-struct ppc_sys_spec ppc_sys_specs[] = {
-	{
-		/* Only one entry, always assume the same design */
-		.ppc_sys_name	= "Xilinx ML300 Reference Design",
-		.mask 		= 0x00000000,
-		.value 		= 0x00000000,
-		.num_devices	= 1,
-		.device_list	= (enum ppc_sys_devices[])
-		{
-			VIRTEX_UART,
-		},
-	},
-};
 const char* virtex_machine_name = "ML300 Reference Design";
 
 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
-
 static volatile unsigned *powerdown_base =
     (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR;
 
@@ -96,52 +80,14 @@ ml300_map_io(void)
 #endif
 }
 
-/* Early serial support functions */
-static void __init
-ml300_early_serial_init(int num, struct plat_serial8250_port *pdata)
-{
-#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
-	struct uart_port serial_req;
-
-	memset(&serial_req, 0, sizeof(serial_req));
-	serial_req.mapbase	= pdata->mapbase;
-	serial_req.membase	= pdata->membase;
-	serial_req.irq		= pdata->irq;
-	serial_req.uartclk	= pdata->uartclk;
-	serial_req.regshift	= pdata->regshift;
-	serial_req.iotype	= pdata->iotype;
-	serial_req.flags	= pdata->flags;
-	gen550_init(num, &serial_req);
-#endif
-}
-
-void __init
-ml300_early_serial_map(void)
-{
-#ifdef CONFIG_SERIAL_8250
-	struct plat_serial8250_port *pdata;
-	int i = 0;
-
-	pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(VIRTEX_UART);
-	while(pdata && pdata->flags)
-	{
-		pdata->membase = ioremap(pdata->mapbase, 0x100);
-		ml300_early_serial_init(i, pdata);
-		pdata++;
-		i++;
-	}
-#endif /* CONFIG_SERIAL_8250 */
-}
-
 void __init
 ml300_setup_arch(void)
 {
-	ml300_early_serial_map();
+	virtex_early_serial_map();
 	ppc4xx_setup_arch();	/* calls ppc4xx_find_bridges() */
 
 	/* Identify the system */
-	printk(KERN_INFO "Xilinx Virtex-II Pro port\n");
-	printk(KERN_INFO "Port by MontaVista Software, Inc. (source@mvista.com)\n");
+	printk(KERN_INFO "Xilinx ML300 Reference System (Virtex-II Pro)\n");
 }
 
 /* Called after board_setup_irq from ppc4xx_init_IRQ(). */
@@ -157,8 +103,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 {
 	ppc4xx_init(r3, r4, r5, r6, r7);
 
-	identify_ppc_sys_by_id(mfspr(SPRN_PVR));
-
 	ppc_md.setup_arch = ml300_setup_arch;
 	ppc_md.setup_io_mappings = ml300_map_io;
 	ppc_md.init_IRQ = ml300_init_irq;
@@ -168,7 +112,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 #endif
 
 #ifdef CONFIG_KGDB
-	ppc_md.early_serial_map = ml300_early_serial_map;
+	ppc_md.early_serial_map = virtex_early_serial_map;
 #endif
 }
 
diff --git a/arch/ppc/platforms/4xx/xilinx_ml403.c b/arch/ppc/platforms/4xx/xilinx_ml403.c
index c98e40a..bc3ace3 100644
--- a/arch/ppc/platforms/4xx/xilinx_ml403.c
+++ b/arch/ppc/platforms/4xx/xilinx_ml403.c
@@ -1,11 +1,9 @@
 /*
- * arch/ppc/platforms/4xx/xilinx_ml403.c
- *
  * Xilinx ML403 evaluation board initialization
  *
  * Author: Grant Likely <grant.likely@secretlab.ca>
  *
- * 2005 (c) Secret Lab Technologies Ltd.
+ * 2005-2007 (c) Secret Lab Technologies Ltd.
  * 2002-2004 (c) MontaVista Software, Inc.
  *
  * This file is licensed under the terms of the GNU General Public License
@@ -22,9 +20,9 @@
 #include <linux/serialP.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
-#include <asm/ppc_sys.h>
 
 #include <syslib/gen550.h>
+#include <syslib/virtex_devices.h>
 #include <platforms/4xx/xparameters/xparameters.h>
 
 /*
@@ -57,25 +55,9 @@
  *          ppc4xx_pic_init			arch/ppc/syslib/xilinx_pic.c
  */
 
-/* Board specifications structures */
-struct ppc_sys_spec *cur_ppc_sys_spec;
-struct ppc_sys_spec ppc_sys_specs[] = {
-	{
-		/* Only one entry, always assume the same design */
-		.ppc_sys_name	= "Xilinx ML403 Reference Design",
-		.mask 		= 0x00000000,
-		.value 		= 0x00000000,
-		.num_devices	= 1,
-		.device_list	= (enum ppc_sys_devices[])
-		{
-			VIRTEX_UART,
-		},
-	},
-};
 const char* virtex_machine_name = "ML403 Reference Design";
 
 #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
-
 static volatile unsigned *powerdown_base =
     (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR;
 
@@ -100,47 +82,10 @@ ml403_map_io(void)
 #endif
 }
 
-/* Early serial support functions */
-static void __init
-ml403_early_serial_init(int num, struct plat_serial8250_port *pdata)
-{
-#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
-	struct uart_port serial_req;
-
-	memset(&serial_req, 0, sizeof(serial_req));
-	serial_req.mapbase	= pdata->mapbase;
-	serial_req.membase	= pdata->membase;
-	serial_req.irq		= pdata->irq;
-	serial_req.uartclk	= pdata->uartclk;
-	serial_req.regshift	= pdata->regshift;
-	serial_req.iotype	= pdata->iotype;
-	serial_req.flags	= pdata->flags;
-	gen550_init(num, &serial_req);
-#endif
-}
-
-void __init
-ml403_early_serial_map(void)
-{
-#ifdef CONFIG_SERIAL_8250
-	struct plat_serial8250_port *pdata;
-	int i = 0;
-
-	pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(VIRTEX_UART);
-	while(pdata && pdata->flags)
-	{
-		pdata->membase = ioremap(pdata->mapbase, 0x100);
-		ml403_early_serial_init(i, pdata);
-		pdata++;
-		i++;
-	}
-#endif /* CONFIG_SERIAL_8250 */
-}
-
 void __init
 ml403_setup_arch(void)
 {
-	ml403_early_serial_map();
+	virtex_early_serial_map();
 	ppc4xx_setup_arch();	/* calls ppc4xx_find_bridges() */
 
 	/* Identify the system */
@@ -160,8 +105,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 {
 	ppc4xx_init(r3, r4, r5, r6, r7);
 
-	identify_ppc_sys_by_id(mfspr(SPRN_PVR));
-
 	ppc_md.setup_arch = ml403_setup_arch;
 	ppc_md.setup_io_mappings = ml403_map_io;
 	ppc_md.init_IRQ = ml403_init_irq;
@@ -171,7 +114,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 #endif
 
 #ifdef CONFIG_KGDB
-	ppc_md.early_serial_map = ml403_early_serial_map;
+	ppc_md.early_serial_map = virtex_early_serial_map;
 #endif
 }
 
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
index 0991111..9569415 100644
--- a/arch/ppc/syslib/Makefile
+++ b/arch/ppc/syslib/Makefile
@@ -18,7 +18,8 @@ obj-$(CONFIG_440SP)		+= ibm440gx_common.o ibm440sp_common.o
 obj-$(CONFIG_440SPE)		+= ibm440gx_common.o ibm440sp_common.o ppc440spe_pcie.o
 ifeq ($(CONFIG_4xx),y)
 ifeq ($(CONFIG_XILINX_VIRTEX),y)
-obj-$(CONFIG_40x)		+= xilinx_pic.o ppc_sys.o
+obj-$(CONFIG_40x)		+= xilinx_pic.o
+obj-y				+= virtex_devices.o
 else
 ifeq ($(CONFIG_403),y)
 obj-$(CONFIG_40x)		+= ppc403_pic.o
diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
index 40f197a..de99e92 100644
--- a/include/asm-ppc/ppc_sys.h
+++ b/include/asm-ppc/ppc_sys.h
@@ -33,8 +33,6 @@
 #include <asm/mpc52xx.h>
 #elif defined(CONFIG_MPC10X_BRIDGE)
 #include <asm/mpc10x.h>
-#elif defined(CONFIG_XILINX_VIRTEX)
-#include <platforms/4xx/virtex.h>
 #else
 #error "need definition of ppc_sys_devices"
 #endif
-- 
1.5.1

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

* [PATCH 5/5] [PPC] Add uartlite boot console driver for the zImage wrapper
  2007-04-15  7:27       ` [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards Grant Likely
@ 2007-04-15  7:27         ` Grant Likely
  2007-04-25 12:13           ` Peter Korsgaard
  2007-04-25 12:12         ` [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards Peter Korsgaard
  1 sibling, 1 reply; 21+ messages in thread
From: Grant Likely @ 2007-04-15  7:27 UTC (permalink / raw)
  To: linuxppc-embedded, Andrei Konovalov, Peter Korsgaard,
	Rick Moleres, Paul Mackerras

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 arch/ppc/boot/common/misc-common.c  |   15 +++++++++----
 arch/ppc/boot/simple/Makefile       |    1 +
 arch/ppc/boot/simple/uartlite_tty.c |   37 +++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 5 deletions(-)
 create mode 100644 arch/ppc/boot/simple/uartlite_tty.c

diff --git a/arch/ppc/boot/common/misc-common.c b/arch/ppc/boot/common/misc-common.c
index 8e1fccd..9589969 100644
--- a/arch/ppc/boot/common/misc-common.c
+++ b/arch/ppc/boot/common/misc-common.c
@@ -57,7 +57,8 @@ unsigned char *ISA_io = NULL;
 
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 extern unsigned long com_port;
 
 extern int serial_tstc(unsigned long com_port);
@@ -80,7 +81,8 @@ int tstc(void)
 {
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 	if(keyb_present)
 		return (CRT_tstc() || serial_tstc(com_port));
 	else
@@ -95,7 +97,8 @@ int getc(void)
 	while (1) {
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 		if (serial_tstc(com_port))
 			return (serial_getc(com_port));
 #endif /* serial console */
@@ -112,7 +115,8 @@ putc(const char c)
 
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 	serial_putc(com_port, c);
 	if ( c == '\n' )
 		serial_putc(com_port, '\r');
@@ -161,7 +165,8 @@ void puts(const char *s)
 	while ( ( c = *s++ ) != '\0' ) {
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 	        serial_putc(com_port, c);
 	        if ( c == '\n' ) serial_putc(com_port, '\r');
 #endif /* serial console */
diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
index bcfb6cd..5b87779 100644
--- a/arch/ppc/boot/simple/Makefile
+++ b/arch/ppc/boot/simple/Makefile
@@ -201,6 +201,7 @@ boot-$(CONFIG_8260)		+= m8260_tty.o
 endif
 boot-$(CONFIG_SERIAL_MPC52xx_CONSOLE)	+= mpc52xx_tty.o
 boot-$(CONFIG_SERIAL_MPSC_CONSOLE)	+= mv64x60_tty.o
+boot-$(CONFIG_SERIAL_UARTLITE_CONSOLE)	+= uartlite_tty.o
 
 LIBS				:= $(common)/lib.a $(bootlib)/lib.a
 ifeq ($(CONFIG_PPC_PREP),y)
diff --git a/arch/ppc/boot/simple/uartlite_tty.c b/arch/ppc/boot/simple/uartlite_tty.c
new file mode 100644
index 0000000..0eae1ea
--- /dev/null
+++ b/arch/ppc/boot/simple/uartlite_tty.c
@@ -0,0 +1,37 @@
+/*
+ * Xilinx UARTLITE bootloader driver
+ *
+ * Copyright (c) 2007 Secret Lab Technologies Ltd.
+ *
+ * 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/types.h>
+#include <asm/serial.h>
+#include <asm/io.h>
+#include <platforms/4xx/xparameters/xparameters.h>
+
+#define UARTLITE_BASEADDR ((void*)(XPAR_UARTLITE_0_BASEADDR))
+
+void
+serial_putc(unsigned long com_port, unsigned char c)
+{
+	while ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x08) != 0); /* spin */
+	out_be32(UARTLITE_BASEADDR + 0x4, c);
+}
+
+unsigned char
+serial_getc(unsigned long com_port)
+{
+	while ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x01) == 0); /* spin */
+	return in_be32(UARTLITE_BASEADDR);
+}
+
+int
+serial_tstc(unsigned long com_port)
+{
+	return ((in_be32(UARTLITE_BASEADDR + 0x8) & 0x01) != 0);
+}
-- 
1.5.1

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

* Re: [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform
  2007-04-15  7:27 ` [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform Grant Likely
  2007-04-15  7:27   ` [PATCH 2/5] [PPC] Merge common virtex header files Grant Likely
@ 2007-04-15 10:48   ` Dale Farnsworth
  2007-04-15 14:20     ` Grant Likely
  2007-04-25 12:03   ` Peter Korsgaard
  2 siblings, 1 reply; 21+ messages in thread
From: Dale Farnsworth @ 2007-04-15 10:48 UTC (permalink / raw)
  To: grant.likely, Linuxppc-embedded

In article <11766220692537-git-send-email-grant.likely@secretlab.ca> you write:
> Reverse dependency order for Xilinx Virtex parts.  For these parts, It
> makes more sense for boards/chips to specify which features they
> provide instead of the features listing the parts they are implemented
> in.  I think it also makes adding new board ports simpler.
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>  arch/ppc/platforms/4xx/Kconfig |   13 +++++++------
>  1 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
> index 705ae56..f74e25b 100644
> --- a/arch/ppc/platforms/4xx/Kconfig
> +++ b/arch/ppc/platforms/4xx/Kconfig
> @@ -54,11 +54,13 @@ config WALNUT
>  
>  config XILINX_ML300
>  	bool "Xilinx-ML300"
> +	select XILINX_VIRTEX_II_PRO
>  	help
>  	  This option enables support for the Xilinx ML300 evaluation board.
>  
>  config XILINX_ML403
>  	bool "Xilinx-ML403"
> +	select XILINX_VIRTEX_4_FX
>  	help
>  	  This option enables support for the Xilinx ML403 evaluation board.
>  endchoice
> @@ -215,18 +217,17 @@ config 405GPR
>  
>  config XILINX_VIRTEX_II_PRO
>  	bool
> -	depends on XILINX_ML300
> -	default y
> +	select XILINX_VIRTEX
> +	default n

Since these variables are not user selectable, it's better to
remove the "default n", so they don't show up when not selected.

>  config XILINX_VIRTEX_4_FX
>  	bool
> -	depends on XILINX_ML403
> -	default y
> +	select XILINX_VIRTEX
> +	default n
>  
>  config XILINX_VIRTEX
>  	bool
> -	depends on XILINX_VIRTEX_II_PRO || XILINX_VIRTEX_4_FX
> -	default y
> +	default n
>  
>  config STB03xxx
>  	bool
> -- 
> 1.5.1

-Dale

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

* Re: [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform
  2007-04-15 10:48   ` [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform Dale Farnsworth
@ 2007-04-15 14:20     ` Grant Likely
  0 siblings, 0 replies; 21+ messages in thread
From: Grant Likely @ 2007-04-15 14:20 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: Linuxppc-embedded

On 15 Apr 2007 03:48:19 -0700, Dale Farnsworth <dale@farnsworth.org> wrote:
> In article <11766220692537-git-send-email-grant.likely@secretlab.ca> you write:
> >  config XILINX_VIRTEX_II_PRO
> >       bool
> > -     depends on XILINX_ML300
> > -     default y
> > +     select XILINX_VIRTEX
> > +     default n
>
> Since these variables are not user selectable, it's better to
> remove the "default n", so they don't show up when not selected.

Ah, okay.  I didn't know that.  Thanks.  I'll make that change.
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

* Re: [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform
  2007-04-15  7:27 ` [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform Grant Likely
  2007-04-15  7:27   ` [PATCH 2/5] [PPC] Merge common virtex header files Grant Likely
  2007-04-15 10:48   ` [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform Dale Farnsworth
@ 2007-04-25 12:03   ` Peter Korsgaard
  2 siblings, 0 replies; 21+ messages in thread
From: Peter Korsgaard @ 2007-04-25 12:03 UTC (permalink / raw)
  To: linuxppc-embedded

>>>>> "GL" == Grant Likely <grant.likely@secretlab.ca> writes:

GL> Reverse dependency order for Xilinx Virtex parts.  For these
GL> parts, It makes more sense for boards/chips to specify which
GL> features they provide instead of the features listing the parts
GL> they are implemented in.  I think it also makes adding new board
GL> ports simpler.

GL> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> ---

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

-- 
Bye, Peter Korsgaard

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

* Re: [PATCH 2/5] [PPC] Merge common virtex header files
  2007-04-15  7:27   ` [PATCH 2/5] [PPC] Merge common virtex header files Grant Likely
  2007-04-15  7:27     ` [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices Grant Likely
@ 2007-04-25 12:07     ` Peter Korsgaard
  2007-04-27 18:49       ` Grant Likely
  1 sibling, 1 reply; 21+ messages in thread
From: Peter Korsgaard @ 2007-04-25 12:07 UTC (permalink / raw)
  To: linuxppc-embedded

>>>>> "GL" == Grant Likely <grant.likely@secretlab.ca> writes:

Hi,

GL> The header files for the ml403 and ml300 are virtually identical,
GL> merge them into a single file.

GL> diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
GL> index 92fd02d..ed6891a 100644
GL> --- a/include/asm-ppc/ibm4xx.h
GL> +++ b/include/asm-ppc/ibm4xx.h
GL> @@ -47,12 +47,8 @@
GL>  #include <platforms/4xx/walnut.h>
GL>  #endif
GL>  
GL> -#if defined(CONFIG_XILINX_ML300)
GL> -#include <platforms/4xx/xilinx_ml300.h>
GL> -#endif
GL> -
GL> -#if defined(CONFIG_XILINX_ML403)
GL> -#include <platforms/4xx/xilinx_ml403.h>
GL> +#if defined(CONFIG_XILINX_VIRTEX)
GL> +#include <platforms/4xx/virtex.h>
GL>  #endif

Could we make that

#if defined(CONFIG_XILINX_ML300) || defined(CONFIG_XILINX_ML403)

instead? I'm using RedBoot on a virtex platform, and hence another
struct bd_info than the ML300/ML403.

Other than that,

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

-- 
Bye, Peter Korsgaard

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

* Re: [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices
  2007-04-15  7:27     ` [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices Grant Likely
  2007-04-15  7:27       ` [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards Grant Likely
@ 2007-04-25 12:11       ` Peter Korsgaard
  2007-04-27 18:50         ` Grant Likely
  1 sibling, 1 reply; 21+ messages in thread
From: Peter Korsgaard @ 2007-04-25 12:11 UTC (permalink / raw)
  To: linuxppc-embedded

>>>>> "GL" == Grant Likely <grant.likely@secretlab.ca> writes:

Hi,

GL> Currently virtex support in mainline make use of the
GL> infrastructure in arch/ppc/syslib/ppc_sys.c for registering common
GL> devices on virtex ppc405 platforms.  The ppc_sys.c code is not
GL> well suited to the dynamic nature of FPGA designs and makes adding
GL> new board ports more complex.  This patch adds a new listing of
GL> common devices which does not depend on the ppc_sys.c
GL> infrastructure.

GL> +/* UART 8250 driver platform data table */
GL> +struct plat_serial8250_port virtex_serial_platform_data[] = {
GL> +#if defined(XPAR_UARTNS550_0_BASEADDR)
GL> +	XPAR_UART(0),
GL> +#endif
GL> +#if defined(XPAR_UARTNS550_1_BASEADDR)
GL> +	XPAR_UART(1),
GL> +#endif
GL> +#if defined(XPAR_UARTNS550_2_BASEADDR)
GL> +	XPAR_UART(2),
GL> +#endif
GL> +#if defined(XPAR_UARTNS550_3_BASEADDR)
GL> +	XPAR_UART(3),
GL> +#endif
GL> +	{ }, /* terminated by empty record */
GL> +};

Could we at the same time increase the amount of UARTs supported? We
have designs with 5 16550s.

Other than that,

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

-- 
Bye, Peter Korsgaard

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

* Re: [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards
  2007-04-15  7:27       ` [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards Grant Likely
  2007-04-15  7:27         ` [PATCH 5/5] [PPC] Add uartlite boot console driver for the zImage wrapper Grant Likely
@ 2007-04-25 12:12         ` Peter Korsgaard
  1 sibling, 0 replies; 21+ messages in thread
From: Peter Korsgaard @ 2007-04-25 12:12 UTC (permalink / raw)
  To: linuxppc-embedded

>>>>> "GL" == Grant Likely <grant.likely@secretlab.ca> writes:

Hi,

GL> The arch/ppc/syslib/ppc_sys.c infrastructure does not work well
GL> for the virtex ports.  Move the ml300 and ml403 board ports over
GL> to use the new virtex_devices infrastructure.

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

-- 
Bye, Peter Korsgaard

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

* Re: [PATCH 5/5] [PPC] Add uartlite boot console driver for the zImage wrapper
  2007-04-15  7:27         ` [PATCH 5/5] [PPC] Add uartlite boot console driver for the zImage wrapper Grant Likely
@ 2007-04-25 12:13           ` Peter Korsgaard
  0 siblings, 0 replies; 21+ messages in thread
From: Peter Korsgaard @ 2007-04-25 12:13 UTC (permalink / raw)
  To: linuxppc-embedded

>>>>> "GL" == Grant Likely <grant.likely@secretlab.ca> writes:

Hi,

GL> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> ---

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

-- 
Bye, Peter Korsgaard

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

* Re: [PATCH 2/5] [PPC] Merge common virtex header files
  2007-04-25 12:07     ` [PATCH 2/5] [PPC] Merge common virtex header files Peter Korsgaard
@ 2007-04-27 18:49       ` Grant Likely
  2007-04-30  4:26         ` Peter Korsgaard
  0 siblings, 1 reply; 21+ messages in thread
From: Grant Likely @ 2007-04-27 18:49 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: linuxppc-embedded

On 4/25/07, Peter Korsgaard <peter.korsgaard@barco.com> wrote:
> >>>>> "GL" == Grant Likely <grant.likely@secretlab.ca> writes:
> GL> -#if defined(CONFIG_XILINX_ML300)
> GL> -#include <platforms/4xx/xilinx_ml300.h>
> GL> -#endif
> GL> -
> GL> -#if defined(CONFIG_XILINX_ML403)
> GL> -#include <platforms/4xx/xilinx_ml403.h>
> GL> +#if defined(CONFIG_XILINX_VIRTEX)
> GL> +#include <platforms/4xx/virtex.h>
> GL>  #endif
>
> Could we make that
>
> #if defined(CONFIG_XILINX_ML300) || defined(CONFIG_XILINX_ML403)
>
> instead? I'm using RedBoot on a virtex platform, and hence another
> struct bd_info than the ML300/ML403.

Alternate suggestion: Can we change virtex support to use the
structure defined in ppcboot.h instead?  (I've actually got that
change in my tree and was planning on posting it for review today or
tomorrow).  bd_t is a stinking ugly mess, but things would be better
if we standardize all virtex platforms on the stinking ugly mess
shared by almost all the other ppc embedded board ports.

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

* Re: [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices
  2007-04-25 12:11       ` [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices Peter Korsgaard
@ 2007-04-27 18:50         ` Grant Likely
  0 siblings, 0 replies; 21+ messages in thread
From: Grant Likely @ 2007-04-27 18:50 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: linuxppc-embedded

On 4/25/07, Peter Korsgaard <peter.korsgaard@barco.com> wrote:
> Could we at the same time increase the amount of UARTs supported? We
> have designs with 5 16550s.

Absolutely, I'll make that change right now.

g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

* Re: [PATCH 2/5] [PPC] Merge common virtex header files
  2007-04-27 18:49       ` Grant Likely
@ 2007-04-30  4:26         ` Peter Korsgaard
  2007-04-30  4:41           ` Grant Likely
  2007-05-01  4:28           ` David H. Lynch Jr.
  0 siblings, 2 replies; 21+ messages in thread
From: Peter Korsgaard @ 2007-04-30  4:26 UTC (permalink / raw)
  To: linuxppc-embedded

>>>>> "GL" == Grant Likely <grant.likely@secretlab.ca> writes:

Hi,

>> instead? I'm using RedBoot on a virtex platform, and hence another
>> struct bd_info than the ML300/ML403.

GL> Alternate suggestion: Can we change virtex support to use the
GL> structure defined in ppcboot.h instead?  (I've actually got that
GL> change in my tree and was planning on posting it for review today
GL> or tomorrow).  bd_t is a stinking ugly mess, but things would be
GL> better if we standardize all virtex platforms on the stinking ugly
GL> mess shared by almost all the other ppc embedded board ports.

That's where the ugly mess pops up - RedBoot uses another
(incompatible) bd_t definition than U-boot, E.G:

typedef struct bd_info {
	unsigned int   bi_tag;        /* Should be 0x42444944 "BDID" */
	unsigned int   bi_size;       /* Size of this structure */
	unsigned int   bi_revision;   /* revision of this structure */
	unsigned int   bi_bdate;      /* bootstrap date, i.e. 0x11061997 */
	unsigned int   bi_memstart;   /* Memory start address */
	unsigned int   bi_memsize;    /* Memory (end) size in bytes */
	unsigned int   bi_intfreq;    /* Internal Freq, in Hz */
	unsigned int   bi_busfreq;    /* Bus Freq, in Hz */
	unsigned int   bi_cpmfreq;    /* CPM Freq, in Hz */
	unsigned int   bi_brgfreq;    /* BRG Freq, in Hz */
	unsigned int   bi_vco;        /* VCO Out from PLL */
	unsigned int   bi_pci_freq;   /* PCI Freq, in Hz */
	unsigned int   bi_baudrate;   /* Default console baud rate */
	unsigned int   bi_immr;       /* IMMR when called from boot rom */
	unsigned char  bi_enetaddr[6];
	unsigned int   bi_flashbase;  /* Physical address of FLASH memory */
	unsigned int   bi_flashsize;  /* Length of FLASH memory */
	int            bi_flashwidth; /* Width (8,16,32,64) */
	unsigned char *bi_cmdline;    /* Pointer to command line */
} bd_t;

I should probably migrate to U-boot anyway, but still ..

-- 
Bye, Peter Korsgaard

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

* Re: [PATCH 2/5] [PPC] Merge common virtex header files
  2007-04-30  4:26         ` Peter Korsgaard
@ 2007-04-30  4:41           ` Grant Likely
  2007-05-01  4:35             ` David H. Lynch Jr.
  2007-05-01  4:28           ` David H. Lynch Jr.
  1 sibling, 1 reply; 21+ messages in thread
From: Grant Likely @ 2007-04-30  4:41 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: linuxppc-embedded

On 4/29/07, Peter Korsgaard <peter.korsgaard@barco.com> wrote:
> >>>>> "GL" == Grant Likely <grant.likely@secretlab.ca> writes:
>
> Hi,
>
> >> instead? I'm using RedBoot on a virtex platform, and hence another
> >> struct bd_info than the ML300/ML403.
>
> GL> Alternate suggestion: Can we change virtex support to use the
> GL> structure defined in ppcboot.h instead?  (I've actually got that
> GL> change in my tree and was planning on posting it for review today
> GL> or tomorrow).  bd_t is a stinking ugly mess, but things would be
> GL> better if we standardize all virtex platforms on the stinking ugly
> GL> mess shared by almost all the other ppc embedded board ports.
>
> That's where the ugly mess pops up - RedBoot uses another
> (incompatible) bd_t definition than U-boot, E.G:

Is the redboot bd_info structure already in the kernel tree?  We could
use a config option to select between the u-boot and redboot
structures for all virtex platforms.  That would keep the uglyness
down to a minimum.

g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

* Re: [PATCH 2/5] [PPC] Merge common virtex header files
  2007-04-30  4:26         ` Peter Korsgaard
  2007-04-30  4:41           ` Grant Likely
@ 2007-05-01  4:28           ` David H. Lynch Jr.
  2007-05-01  6:54             ` Grant Likely
  1 sibling, 1 reply; 21+ messages in thread
From: David H. Lynch Jr. @ 2007-05-01  4:28 UTC (permalink / raw)
  To: linuxppc-embedded

Peter Korsgaard wrote:
> GL> Alternate suggestion: Can we change virtex support to use the
> GL> structure defined in ppcboot.h instead?  (I've actually got that
> GL> change in my tree and was planning on posting it for review today
> GL> or tomorrow).  bd_t is a stinking ugly mess, but things would be
> GL> better if we standardize all virtex platforms on the stinking ugly
> GL> mess shared by almost all the other ppc embedded board ports.
>
> That's where the ugly mess pops up - RedBoot uses another
> (incompatible) bd_t definition than U-boot, E.G:
>
> typedef struct bd_info {
> 	unsigned int   bi_tag;        /* Should be 0x42444944 "BDID" */
>   
snip
> 	
> 	int            bi_flashwidth; /* Width (8,16,32,64) */
> 	unsigned char *bi_cmdline;    /* Pointer to command line */
> } bd_t;
>
> I should probably migrate to U-boot anyway, but still ..
>   

    Can we please not standardize on some specific implimentation of
bd_info ?
   
    We have our own bootloader - actually a monitor. It does alot of
things besides boot Linux.
    and it does so in less than 16K.
    our bd_info struct is used to pass info to OS's besides Linux.
    It does not have all the crap the u-boot bd_info has in it that has
no meaning for us.
    But it does have some things that are very specific to our
hardware/firmware.

    It took a quick look at Grant's virtex patches, and will try to test
them with our cards,
    as soon as I can, but the inclusion of a specific virtex bd_info
leapt out instantly as something
    I would have to patch.

    Besides, I am not current on the powerpc tree but isn't this kind of
thing what device trees are
    supposed to be about and don't we have to do that anyway to migrate
to the powerpc tree ?




-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein

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

* Re: [PATCH 2/5] [PPC] Merge common virtex header files
  2007-04-30  4:41           ` Grant Likely
@ 2007-05-01  4:35             ` David H. Lynch Jr.
  2007-05-01  7:16               ` Grant Likely
  0 siblings, 1 reply; 21+ messages in thread
From: David H. Lynch Jr. @ 2007-05-01  4:35 UTC (permalink / raw)
  To: linuxppc-embedded

Grant Likely wrote:
>
> Is the redboot bd_info structure already in the kernel tree?  We could
> use a config option to select between the u-boot and redboot
> structures for all virtex platforms.  That would keep the uglyness
> down to a minimum.
>
> g.
>   
There are a plethora of bd_info's in the kernel tree. I think that
u-boot is probably the most common,
but the u-boot one is huge and full of cruft.
There are also likely to be any number for board/loader combinations
that are not in the kernel.
I have cut an pasted ours below - not that I am trying to sell it.

But I would prefer that if there is a bd_info struct that it be defined
by the board not virtex.h or virtex.c.

 //Information passed to program when it is executed.
 typedef struct _BOARD_INFO
   {uint32_t  bi_signature;       // 0x00 valid bi signature
    uint32_t  bi_memMax;          // 0x04 DRAM installed, maximum byte
address
    uint32_t  bi_intfreq;         // 0x08 Processor speed, in Hz
    uint32_t  bi_busfreq;         // 0x0C PLB Bus speed, in Hz
    uint32_t  bi_version;         // 0x10 local pico number format #.##,
eg 3.09
    uint8_t  *bi_cmdline;         // 0x14
    uint32_t  bi_capabilities;    // 0x18 Pico capabilities mask
    uint32_t  bi_debug;           // 0x1C Pico flags mask
    uint32_t  bi_flashstart;      // 0x20 start of FLASH memory
    uint32_t  bi_flashsize;       // 0x24 size  of FLASH memory
    uint32_t  bi_envSize;         // 0x28 environment size
    uint8_t   bi_enetaddr[6];     // 0x2C Local Ethernet MAC address
    uint16_t  bi_cflags;          // 0x32 console flags
    char     *bi_envP;            // 0x34 pointer to environment string
    uint32_t  bi_model;           // 0x38 0x0E16'FX', (ie 0x0E164658) etc 
    uint32_t  bi_resv;            // 0x38 reserved
   } BOARD_INFO;                  // 0x40




-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein

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

* Re: [PATCH 2/5] [PPC] Merge common virtex header files
  2007-05-01  4:28           ` David H. Lynch Jr.
@ 2007-05-01  6:54             ` Grant Likely
  0 siblings, 0 replies; 21+ messages in thread
From: Grant Likely @ 2007-05-01  6:54 UTC (permalink / raw)
  To: David H. Lynch Jr.; +Cc: linuxppc-embedded

On 4/30/07, David H. Lynch Jr. <dhlii@dlasys.net> wrote:
> Peter Korsgaard wrote:
> > GL> Alternate suggestion: Can we change virtex support to use the
> > GL> structure defined in ppcboot.h instead?  (I've actually got that
> > GL> change in my tree and was planning on posting it for review today
> > GL> or tomorrow).  bd_t is a stinking ugly mess, but things would be
> > GL> better if we standardize all virtex platforms on the stinking ugly
> > GL> mess shared by almost all the other ppc embedded board ports.
> >
> > That's where the ugly mess pops up - RedBoot uses another
> > (incompatible) bd_t definition than U-boot, E.G:
> >
> > typedef struct bd_info {
> >       unsigned int   bi_tag;        /* Should be 0x42444944 "BDID" */
> >
> snip
> >
> >       int            bi_flashwidth; /* Width (8,16,32,64) */
> >       unsigned char *bi_cmdline;    /* Pointer to command line */
> > } bd_t;
> >
> > I should probably migrate to U-boot anyway, but still ..
> >
>
>     Can we please not standardize on some specific implimentation of
> bd_info ?
>
>     We have our own bootloader - actually a monitor. It does alot of
> things besides boot Linux.
>     and it does so in less than 16K.
>     our bd_info struct is used to pass info to OS's besides Linux.
>     It does not have all the crap the u-boot bd_info has in it that has
> no meaning for us.
>     But it does have some things that are very specific to our
> hardware/firmware.

I understand your concerns.  Here are my thoughts when I put together
this patch:

- Only the ML300 and ML403 board ports are in mainline.  There has
been no serious push to get other Virtex platforms supported from
mainline; so patches need to be applied *regardless* for any boards
other than the ml300 and ml403 ref designs.  Patching to a different
bd_t is trivial.
- Even ml300 and ml403 ports in mainline don't work for anything other
than zImage.  The custom bd_t doesn't buy us anything.
- bd_t is a truly awful solution to the problem of passing information
from bootloader to kernel.  In arch/ppc, we cannot get away from it,
so I want to minimize it's stinkyness as much as possible.  By moving
from the custom virtex bd_t to the one in ppcboot.h at least makes it
work with one of the boot loaders (u-boot).
3. Unfortunately, even in moving to arch/powerpc we're still stuck
with bd_t as long as we continue to support older boot loaders (via
the boot wrapper).  As such, I'm actively discouraging the practice of
board specific bd_t.  Between now and the move to arch/powerpc there
will be plenty of people starting new virtex board ports, and I want
to make it clear that custom bd_t's are strongly discouraged.
However, if you already have a board port w/ a different bd_t, then
it's still no problem.  It is trivial to conditionally omit
#include<ppcboot.h> in favor of a different bd_t.

>     Besides, I am not current on the powerpc tree but isn't this kind of
> thing what device trees are
>     supposed to be about and don't we have to do that anyway to migrate
> to the powerpc tree ?

Yes, the ideal is that a single kernel image will be bootable on any
Virtex FPGA design if it is passed the correct device tree by a
compliant boot loader, but we're not there yet and I don't want to
make the situation any worse between now and then.

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

* Re: [PATCH 2/5] [PPC] Merge common virtex header files
  2007-05-01  4:35             ` David H. Lynch Jr.
@ 2007-05-01  7:16               ` Grant Likely
  0 siblings, 0 replies; 21+ messages in thread
From: Grant Likely @ 2007-05-01  7:16 UTC (permalink / raw)
  To: David H. Lynch Jr.; +Cc: linuxppc-embedded

On 4/30/07, David H. Lynch Jr. <dhlii@dlasys.net> wrote:
> There are a plethora of bd_info's in the kernel tree. I think that
> u-boot is probably the most common,
> but the u-boot one is huge and full of cruft.

Be realistic; we're talking about 124 bytes (vs 64 bytes for the pico
bd_t).  If memory consumption is a concern, there are far more
interesting targets.  ppcboot.h is butt-ugly, but at least it's
somewhat common.

> There are also likely to be any number for board/loader combinations
> that are not in the kernel.

If its not in mainline, then I'm not concerned about it because then
you're patching anyway.  I made sure it is easy to patch in a new bd_t
so nobody is screwed.

When those board ports are pushed for mainline inclusion, then we can
add the appropriate conditionals to virtex.h, but in the mean time
it's a moot point.

> But I would prefer that if there is a bd_info struct that it be defined
> by the board not virtex.h or virtex.c.

Understood, but  I do not want to encourage that approach between now
and when we jump to arch/powerpc (legacy bootloader support, yadda,
yadda).

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

end of thread, other threads:[~2007-05-01  7:16 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-15  7:27 Patchset to establish sanity in Xilinx Virtex support Grant Likely
2007-04-15  7:27 ` [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform Grant Likely
2007-04-15  7:27   ` [PATCH 2/5] [PPC] Merge common virtex header files Grant Likely
2007-04-15  7:27     ` [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices Grant Likely
2007-04-15  7:27       ` [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards Grant Likely
2007-04-15  7:27         ` [PATCH 5/5] [PPC] Add uartlite boot console driver for the zImage wrapper Grant Likely
2007-04-25 12:13           ` Peter Korsgaard
2007-04-25 12:12         ` [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards Peter Korsgaard
2007-04-25 12:11       ` [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices Peter Korsgaard
2007-04-27 18:50         ` Grant Likely
2007-04-25 12:07     ` [PATCH 2/5] [PPC] Merge common virtex header files Peter Korsgaard
2007-04-27 18:49       ` Grant Likely
2007-04-30  4:26         ` Peter Korsgaard
2007-04-30  4:41           ` Grant Likely
2007-05-01  4:35             ` David H. Lynch Jr.
2007-05-01  7:16               ` Grant Likely
2007-05-01  4:28           ` David H. Lynch Jr.
2007-05-01  6:54             ` Grant Likely
2007-04-15 10:48   ` [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform Dale Farnsworth
2007-04-15 14:20     ` Grant Likely
2007-04-25 12:03   ` Peter Korsgaard

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