Skip to contentSkip to conversation

Patchset to establish sanity in Xilinx Virtex support

PATCH In review Grant Likely 4 participants 21 messages Apr 15, 2007 – May 1, 2007 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

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(-)
#1 lore raw

PATCH 1/5 Rework Kconfig dependancies for Xilinx Virtex ppc405 platform

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.

---
 arch/ppc/platforms/4xx/Kconfig |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
arch/ppc/platforms/4xx/Kconfig +7 -6
index 705ae56..f74e25b 100644
@@ -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
Signature · 1 line
1.5.1
#2 lore raw

PATCH 2/5 Merge common virtex header files

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

---
 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
arch/ppc/platforms/4xx/virtex.h +29 -11
index c14325d..e9f58a7 100644
@@ -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.
- *         [email protected]
- *
- * 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__ */
arch/ppc/platforms/4xx/xilinx_ml300.c +1 -0
index fb5f0b5..4e4aca4 100644
@@ -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)
 
arch/ppc/platforms/4xx/xilinx_ml300.h deleted +0 -45

45 lines not on this page · raw message

arch/ppc/platforms/4xx/xilinx_ml403.c +1 -0
index cb3bf7a..c98e40a 100644
@@ -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)
 
arch/ppc/platforms/4xx/xilinx_ml403.h deleted +0 -49

49 lines not on this page · raw message

include/asm-ppc/ibm4xx.h +2 -6
index 92fd02d..ed6891a 100644
@@ -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__
Signature · 1 line
1.5.1
#3 lore raw

PATCH 3/5 New registration for common Xilinx Virtex ppc405 platform devices

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.

---
 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
arch/ppc/syslib/virtex_devices.c new file +209 -0
new file mode 100644
index 0000000..096fb2a
@@ -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);
arch/ppc/syslib/virtex_devices.h new file +27 -0
new file mode 100644
index 0000000..4a17dd3
@@ -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__ */
Signature · 1 line
1.5.1
#4 lore raw

PATCH 4/5 Stop using ppc_sys for Xilinx Virtex boards

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.

---
 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
arch/ppc/platforms/4xx/Makefile +0 -1
index fa6610b..723ad79 100644
@@ -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
 
arch/ppc/platforms/4xx/virtex.c deleted +0 -56

56 lines not on this page · raw message

arch/ppc/platforms/4xx/virtex.h +1 -6
index e9f58a7..4fc76da 100644
@@ -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 */
arch/ppc/platforms/4xx/xilinx_ml300.c +4 -60

105 lines not on this page · raw message

arch/ppc/platforms/4xx/xilinx_ml403.c +4 -61

111 lines not on this page · raw message

arch/ppc/syslib/Makefile +2 -1
index 0991111..9569415 100644
@@ -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
include/asm-ppc/ppc_sys.h +0 -2
index 40f197a..de99e92 100644
@@ -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
Signature · 1 line
1.5.1
#5 lore raw

PATCH 5/5 Add uartlite boot console driver for the zImage wrapper

---
 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
arch/ppc/boot/common/misc-common.c +10 -5
index 8e1fccd..9589969 100644
@@ -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 */
arch/ppc/boot/simple/Makefile +1 -0
index bcfb6cd..5b87779 100644
@@ -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)
arch/ppc/boot/simple/uartlite_tty.c new file +37 -0
new file mode 100644
index 0000000..0eae1ea
@@ -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);
+}
Signature · 1 line
1.5.1
Acked-by on v1 4/5
#7 lore raw

Re: [PATCH 4/5] [PPC] Stop using ppc_sys for Xilinx Virtex boards

In reply to Grant Likely
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"GL" == Grant Likely <[email protected]> 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.

Signature · 1 line
Bye, Peter Korsgaard
Acked-by on v1 3/5
#8 lore raw

Re: [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices

In reply to Grant Likely
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"GL" == Grant Likely <[email protected]> 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,

Signature · 1 line
Bye, Peter Korsgaard
#9 lore raw

Re: [PATCH 3/5] [PPC] New registration for common Xilinx Virtex ppc405 platform devices

Quoted 2 lines · Peter Korsgaard

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.

Signature · 4 lines
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
Acked-by on v1 2/5
#10 lore raw

Re: [PATCH 2/5] [PPC] Merge common virtex header files

In reply to Grant Likely
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"GL" == Grant Likely <[email protected]> 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,

Signature · 1 line
Bye, Peter Korsgaard
#11 lore raw

Re: [PATCH 2/5] [PPC] Merge common virtex header files

Quoted 11 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"GL" == Grant Likely <[email protected]> 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

Quoted 6 lines

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.

Signature · 4 lines
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#12 lore raw

Re: [PATCH 2/5] [PPC] Merge common virtex header files

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"GL" == Grant Likely <[email protected]> writes:

Hi,

Quoted 2 lines
Quoted 2 lines

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

Signature · 1 line
Bye, Peter Korsgaard
#13 lore raw

Re: [PATCH 2/5] [PPC] Merge common virtex header files

Quoted 14 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"GL" == Grant Likely <[email protected]> writes:

Hi,

Quoted 2 lines
Quoted 2 lines

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.

Quoted 2 lines

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.

Signature · 4 lines
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#14 lore raw

Re: [PATCH 2/5] [PPC] Merge common virtex header files

Quoted 8 lines · Grant Likely

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
Signature · 8 lines
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       [email protected] 	  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
#15 lore raw

Re: [PATCH 2/5] [PPC] Merge common virtex header files

Quoted 3 lines · David H. Lynch Jr.

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.

Quoted 2 lines

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.

Quoted 2 lines

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.

Signature · 4 lines
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#16 lore raw

Re: [PATCH 2/5] [PPC] Merge common virtex header files

In reply to Peter Korsgaard
Quoted 13 lines · Peter Korsgaard

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

Quoted 7 lines
	
	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 ?

Signature · 8 lines
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       [email protected] 	  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
#17 lore raw

Re: [PATCH 2/5] [PPC] Merge common virtex header files

Quoted 26 lines · David H. Lynch Jr.
Quoted 13 lines · Peter Korsgaard

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

Quoted 7 lines

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 ?

Quoted 8 lines

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.

Quoted 4 lines

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.

Signature · 4 lines
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#18 lore raw

Re: [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform

In reply to Grant Likely

In article <[email protected]> you write:

Quoted 29 lines

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.

---
 arch/ppc/platforms/4xx/Kconfig |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
arch/ppc/platforms/4xx/Kconfig +2 -0
index 705ae56..f74e25b 100644
@@ -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

arch/ppc/platforms/4xx/Kconfig config 405GPR · line 221

Quoted 7 lines
arch/ppc/platforms/4xx/Kconfig +2 -2
@@ -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.

Quoted 17 lines
arch/ppc/platforms/4xx/Kconfig +3 -4
 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
Signature · 1 line
1.5.1

-Dale

#19 lore raw

Re: [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform

Quoted 10 lines · Dale Farnsworth

In article <[email protected]> you write:

arch/ppc/platforms/4xx/Kconfig config 405GPR · line 221

Quoted 6 lines

config XILINX_VIRTEX_II_PRO
bool

arch/ppc/platforms/4xx/Kconfig +2 -2
-     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.

Signature · 4 lines
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
Acked-by on v1 1/5
#20 lore raw

Re: [PATCH 1/5] [PPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform

In reply to Grant Likely
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"GL" == Grant Likely <[email protected]> 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 <[email protected]> ---

Signature · 1 line
Bye, Peter Korsgaard