Subject: [PATCH 1/2] Move Virtex-II Pro / ML300 port over to the platform bus.

From: Grant Likely <[email-masked]>
Date: Sat, 10 Sep 2005 01:36:28 -0600

This is a large patch that moves the ML300 to the platform bus.

It also isolates most of the linux tree from changes to the xparameters.h
file.  Ultimately, the goal is to move everything over to the flattened
device tree for telling the kernel about devices.  That way xparameters.h
can go away entirely for the kernel proper.  (Isolated to the bootloader)

This patch will be split up into smaller parts before submitting to mainline

Comments are appreciated.

---

 arch/ppc/Kconfig.debug                           |    2 -
 arch/ppc/boot/common/ns16550.c                   |   15 ++++
 arch/ppc/boot/simple/embed_config.c              |    3 +
 arch/ppc/platforms/4xx/Kconfig                   |    5 -
 arch/ppc/platforms/4xx/Makefile                  |    3 -
 arch/ppc/platforms/4xx/virtex-ii_pro.c           |   60 ------------------
 arch/ppc/platforms/4xx/virtex-ii_pro.h           |   74 ++--------------------
 arch/ppc/platforms/4xx/xilinx_ml300.c            |   60 +++++++++++-------
 arch/ppc/platforms/4xx/xilinx_ml300.h            |    2 -
 arch/ppc/platforms/4xx/xilinx_ml300_devices.c    |   71 +++++++++++++++++++++
 arch/ppc/platforms/4xx/xparameters/xparameters.h |   51 +++++++++++++++
 arch/ppc/syslib/Makefile                         |    2 -
 arch/ppc/syslib/gen550_dbg.c                     |    2 +
 arch/ppc/syslib/xilinx_pic.c                     |   12 ++--
 include/asm-ppc/ppc_sys.h                        |    2 +
 include/asm-ppc/xparameters.h                    |   18 -----
 16 files changed, 196 insertions(+), 186 deletions(-)
 delete mode 100644 arch/ppc/platforms/4xx/virtex-ii_pro.c
 create mode 100644 arch/ppc/platforms/4xx/xilinx_ml300_devices.c
 create mode 100644 arch/ppc/platforms/4xx/xparameters/xparameters.h
 delete mode 100644 include/asm-ppc/xparameters.h

c434b6a7edfa498ed01ee9c3677e687bad87d805
diff --git a/arch/ppc/Kconfig.debug b/arch/ppc/Kconfig.debug
--- a/arch/ppc/Kconfig.debug
+++ b/arch/ppc/Kconfig.debug
@@ -66,7 +66,7 @@ config SERIAL_TEXT_DEBUG
 
 config PPC_OCP
 	bool
-	depends on IBM_OCP || XILINX_OCP
+	depends on IBM_OCP
 	default y
 
 endmenu
diff --git a/arch/ppc/boot/common/ns16550.c b/arch/ppc/boot/common/ns16550.c
--- a/arch/ppc/boot/common/ns16550.c
+++ b/arch/ppc/boot/common/ns16550.c
@@ -11,6 +11,10 @@
 #include "nonstdio.h"
 #include "serial.h"
 
+#if defined(CONFIG_VIRTEX_II_PRO)
+#include <platforms/4xx/xparameters/xparameters.h>
+#endif
+
 #define SERIAL_BAUD	9600
 
 extern unsigned long ISA_io;
@@ -25,6 +29,7 @@ unsigned long serial_init(int chan, void
 {
 	unsigned long com_port;
 	unsigned char lcr, dlm;
+	unsigned long baud_base;
 
 	/* We need to find out which type io we're expecting.  If it's
 	 * 'SERIAL_IO_PORT', we get an offset from the isa_io_base.
@@ -43,6 +48,12 @@ unsigned long serial_init(int chan, void
 
 	/* How far apart the registers are. */
 	shift = rs_table[chan].iomem_reg_shift;
+	baud_base = rs_table[chan].baud_base;
+#if defined(BASE_BAUD)
+	if (!baud_base)
+		baud_base = BASE_BAUD;
+#endif
+
 	
 	/* save the LCR */
 	lcr = inb(com_port + (UART_LCR << shift));
@@ -62,9 +73,9 @@ unsigned long serial_init(int chan, void
 	else {
 		/* Input clock. */
 		outb(com_port + (UART_DLL << shift),
-		     (BASE_BAUD / SERIAL_BAUD) & 0xFF);
+		     (baud_base / SERIAL_BAUD) & 0xFF);
 		outb(com_port + (UART_DLM << shift),
-		     (BASE_BAUD / SERIAL_BAUD) >> 8);
+		     (baud_base / SERIAL_BAUD) >> 8);
 		/* 8 data, 1 stop, no parity */
 		outb(com_port + (UART_LCR << shift), 0x03);
 		/* RTS/DTR */
diff --git a/arch/ppc/boot/simple/embed_config.c
b/arch/ppc/boot/simple/embed_config.c
--- a/arch/ppc/boot/simple/embed_config.c
+++ b/arch/ppc/boot/simple/embed_config.c
@@ -21,6 +21,9 @@
 #ifdef CONFIG_40x
 #include <asm/io.h>
 #endif
+#ifdef CONFIG_VIRTEX_II_PRO
+#include <platforms/4xx/xparameters/xparameters.h>
+#endif
 extern unsigned long timebase_period_ns;
 
 /* For those boards that don't provide one.
diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
--- a/arch/ppc/platforms/4xx/Kconfig
+++ b/arch/ppc/platforms/4xx/Kconfig
@@ -212,11 +212,6 @@ config VIRTEX_II_PRO_TLB_FIX
 	  It is safe to say Y here, but there is a performance impact.
 	  Say N if unsure.
 
-config XILINX_OCP
-	bool
-	depends on VIRTEX_II_PRO
-	default y
-
 config STB03xxx
 	bool
 	depends on REDWOOD_5 || REDWOOD_6
diff --git a/arch/ppc/platforms/4xx/Makefile b/arch/ppc/platforms/4xx/Makefile
--- a/arch/ppc/platforms/4xx/Makefile
+++ b/arch/ppc/platforms/4xx/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_REDWOOD_5)		+= redwood5.o
 obj-$(CONFIG_REDWOOD_6)		+= redwood6.o
 obj-$(CONFIG_SYCAMORE)		+= sycamore.o
 obj-$(CONFIG_WALNUT)		+= walnut.o
-obj-$(CONFIG_XILINX_ML300)	+= xilinx_ml300.o
+obj-$(CONFIG_XILINX_ML300)	+= xilinx_ml300.o xilinx_ml300_devices.o
 
 obj-$(CONFIG_405GP)		+= ibm405gp.o
 obj-$(CONFIG_REDWOOD_5)		+= ibmstb4.o
@@ -26,4 +26,3 @@ obj-$(CONFIG_440GX)		+= ibm440gx.o
 obj-$(CONFIG_440SP)		+= ibm440sp.o
 obj-$(CONFIG_405EP)		+= ibm405ep.o
 obj-$(CONFIG_405GPR)		+= ibm405gpr.o
-obj-$(CONFIG_VIRTEX_II_PRO)	+= virtex-ii_pro.o
diff --git a/arch/ppc/platforms/4xx/virtex-ii_pro.c
b/arch/ppc/platforms/4xx/virtex-ii_pro.c
deleted file mode 100644
--- a/arch/ppc/platforms/4xx/virtex-ii_pro.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * arch/ppc/platforms/4xx/virtex-ii_pro.c
- *
- * Author: MontaVista Software, Inc.
- *         [email-masked]
- *
- * 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.
- */
-
-#include <linux/config.h>
-#include <linux/init.h>
-#include <asm/ocp.h>
-#include "virtex-ii_pro.h"
-
-/* Have OCP take care of the serial ports. */
-struct ocp_def core_ocp[] = {
-#ifdef XPAR_UARTNS550_0_BASEADDR
-	{ .vendor	= OCP_VENDOR_XILINX,
-	  .function	= OCP_FUNC_16550,
-	  .index	= 0,
-	  .paddr	= XPAR_UARTNS550_0_BASEADDR,
-	  .irq		= XPAR_INTC_0_UARTNS550_0_VEC_ID,
-	  .pm		= OCP_CPM_NA
-	},
-#ifdef XPAR_UARTNS550_1_BASEADDR
-	{ .vendor	= OCP_VENDOR_XILINX,
-	  .function	= OCP_FUNC_16550,
-	  .index	= 1,
-	  .paddr	= XPAR_UARTNS550_1_BASEADDR,
-	  .irq		= XPAR_INTC_0_UARTNS550_1_VEC_ID,
-	  .pm		= OCP_CPM_NA
-	},
-#ifdef XPAR_UARTNS550_2_BASEADDR
-	{ .vendor	= OCP_VENDOR_XILINX,
-	  .function	= OCP_FUNC_16550,
-	  .index	= 2,
-	  .paddr	= XPAR_UARTNS550_2_BASEADDR,
-	  .irq		= XPAR_INTC_0_UARTNS550_2_VEC_ID,
-	  .pm		= OCP_CPM_NA
-	},
-#ifdef XPAR_UARTNS550_3_BASEADDR
-	{ .vendor	= OCP_VENDOR_XILINX,
-	  .function	= OCP_FUNC_16550,
-	  .index	= 3,
-	  .paddr	= XPAR_UARTNS550_3_BASEADDR,
-	  .irq		= XPAR_INTC_0_UARTNS550_3_VEC_ID,
-	  .pm		= OCP_CPM_NA
-	},
-#ifdef XPAR_UARTNS550_4_BASEADDR
-#error Edit this file to add more devices.
-#endif			/* 4 */
-#endif			/* 3 */
-#endif			/* 2 */
-#endif			/* 1 */
-#endif			/* 0 */
-	{ .vendor	= OCP_VENDOR_INVALID
-	}
-};
diff --git a/arch/ppc/platforms/4xx/virtex-ii_pro.h
b/arch/ppc/platforms/4xx/virtex-ii_pro.h
--- a/arch/ppc/platforms/4xx/virtex-ii_pro.h
+++ b/arch/ppc/platforms/4xx/virtex-ii_pro.h
@@ -15,84 +15,26 @@
 #ifndef __ASM_VIRTEXIIPRO_H__
 #define __ASM_VIRTEXIIPRO_H__
 
-#include <linux/config.h>
-#include <asm/xparameters.h>
-
 /* serial defines */
 
 #define RS_TABLE_SIZE  4	/* change this and add more devices below
 				   if you have more then 4 16x50 UARTs */
 
-#define BASE_BAUD		(XPAR_UARTNS550_0_CLOCK_FREQ_HZ/16)
-
-/* The serial ports in the Virtex-II Pro have each I/O byte in the
- * LSByte of a word.  This means that iomem_reg_shift needs to be 2 to
- * change the byte offsets into word offsets.  In addition the base
- * addresses need to have 3 added to them to get to the LSByte.
+/* Ugly, ugly, ugly! BASE_BAUD defined here to keep 8250.c happy.
  */
-#define STD_UART_OP(num)						 \
-	{ 0, BASE_BAUD, 0, XPAR_INTC_0_UARTNS550_##num##_VEC_ID,	 \
-		ASYNC_BOOT_AUTOCONF,		 			 \
-		.iomem_base = (u8 *)XPAR_UARTNS550_##num##_BASEADDR + 3, \
-		.iomem_reg_shift = 2,					 \
-		.io_type = SERIAL_IO_MEM},
-
-#if defined(XPAR_INTC_0_UARTNS550_0_VEC_ID)
-#define ML300_UART0 STD_UART_OP(0)
-#else
-#define ML300_UART0
-#endif
-
-#if defined(XPAR_INTC_0_UARTNS550_1_VEC_ID)
-#define ML300_UART1 STD_UART_OP(1)
-#else
-#define ML300_UART1
+#if !defined(BASE_BAUD)
+ #define BASE_BAUD		(0) /* dummy value; not used */
 #endif
 
-#if defined(XPAR_INTC_0_UARTNS550_2_VEC_ID)
-#define ML300_UART2 STD_UART_OP(2)
-#else
-#define ML300_UART2
-#endif
+#ifndef __ASSEMBLY__
 
-#if defined(XPAR_INTC_0_UARTNS550_3_VEC_ID)
-#define ML300_UART3 STD_UART_OP(3)
-#else
-#define ML300_UART3
-#endif
+/* Device type enumeration for platform bus definitions */
+enum ppc_sys_devices {
+	V2PRO_UART,
+};
 
-#if defined(XPAR_INTC_0_UARTNS550_4_VEC_ID)
-#error Edit this file to add more devices.
-#elif defined(XPAR_INTC_0_UARTNS550_3_VEC_ID)
-#define NR_SER_PORTS	4
-#elif defined(XPAR_INTC_0_UARTNS550_2_VEC_ID)
-#define NR_SER_PORTS	3
-#elif defined(XPAR_INTC_0_UARTNS550_1_VEC_ID)
-#define NR_SER_PORTS	2
-#elif defined(XPAR_INTC_0_UARTNS550_0_VEC_ID)
-#define NR_SER_PORTS	1
-#else
-#define NR_SER_PORTS	0
 #endif
 
-#if defined(CONFIG_UART0_TTYS0)
-#define SERIAL_PORT_DFNS	\
-	ML300_UART0		\
-	ML300_UART1		\
-	ML300_UART2		\
-	ML300_UART3
-#endif
-
-#if defined(CONFIG_UART0_TTYS1)
-#define SERIAL_PORT_DFNS	\
-	ML300_UART1		\
-	ML300_UART0		\
-	ML300_UART2		\
-	ML300_UART3
-#endif
-
-#define DCRN_CPMFR_BASE	0
-
 #include <asm/ibm405.h>
 
 #endif				/* __ASM_VIRTEXIIPRO_H__ */
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.c
b/arch/ppc/platforms/4xx/xilinx_ml300.c
--- a/arch/ppc/platforms/4xx/xilinx_ml300.c
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.c
@@ -17,12 +17,14 @@
 #include <linux/tty.h>
 #include <linux/serial.h>
 #include <linux/serial_core.h>
+#include <linux/serial_8250.h>
 #include <linux/serialP.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
-#include <asm/ocp.h>
+#include <asm/ppc_sys.h>
 
-#include <platforms/4xx/virtex-ii_pro.h>	/* for NR_SER_PORTS */
+#include <syslib/gen550.h>
+#include "xparameters/xparameters.h"
 
 /*
  * As an overview of how the following functions (platform_init,
@@ -80,38 +82,46 @@ ml300_map_io(void)
 #endif
 }
 
+#ifdef CONFIG_SERIAL_8250
 static void __init
 ml300_early_serial_map(void)
 {
-#ifdef CONFIG_SERIAL_8250
-	struct serial_state old_ports[] = { SERIAL_PORT_DFNS };
-	struct uart_port port;
-	int i;
-
-	/* Setup ioremapped serial port access */
-	for (i = 0; i < ARRAY_SIZE(old_ports); i++ ) {
-		memset(&port, 0, sizeof(port));
-		port.membase = ioremap((phys_addr_t)(old_ports[i].iomem_base), 16);
-		port.irq = old_ports[i].irq;
-		port.uartclk = old_ports[i].baud_base * 16;
-		port.regshift = old_ports[i].iomem_reg_shift;
-		port.iotype = SERIAL_IO_MEM;
-		port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
-		port.line = i;
-
-		if (early_serial_setup(&port) != 0) {
-			printk("Early serial init of port %d failed\n", i);
-		}
+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+	struct uart_port serial_req;
+#endif
+	struct plat_serial8250_port *pdata;
+	int i = 0;
+
+	pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(V2PRO_UART);
+	while(pdata && pdata->flags)
+	{
+		pdata->membase = ioremap(pdata->mapbase, 0x100);
+
+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+		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(i, &serial_req);
+#endif
+		pdata++;
+		i++;
 	}
-#endif /* CONFIG_SERIAL_8250 */
 }
+#endif /* CONFIG_SERIAL_8250 */
 
 void __init
 ml300_setup_arch(void)
 {
-	ppc4xx_setup_arch();	/* calls ppc4xx_find_bridges() */
-
+#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_KGDB)
 	ml300_early_serial_map();
+#endif
+
+	ppc4xx_setup_arch();	/* calls ppc4xx_find_bridges() */
 
 	/* Identify the system */
 	printk(KERN_INFO "Xilinx Virtex-II Pro port\n");
@@ -131,6 +141,8 @@ platform_init(unsigned long r3, unsigned
 {
 	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;
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300.h
b/arch/ppc/platforms/4xx/xilinx_ml300.h
--- a/arch/ppc/platforms/4xx/xilinx_ml300.h
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.h
@@ -41,7 +41,7 @@ typedef struct board_info {
 #define PPC4xx_ONB_IO_VADDR	0u
 #define PPC4xx_ONB_IO_SIZE	0u
 
-#define PPC4xx_MACHINE_NAME "Xilinx ML300"
+#define PPC4xx_MACHINE_NAME "Xilinx ML300 Reference System"
 
 #endif /* __ASM_XILINX_ML300_H__ */
 #endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/4xx/xilinx_ml300_devices.c
b/arch/ppc/platforms/4xx/xilinx_ml300_devices.c
new file mode 100644
--- /dev/null
+++ b/arch/ppc/platforms/4xx/xilinx_ml300_devices.c
@@ -0,0 +1,71 @@
+/*
+ * arch/ppc/syslib/virtex2pro_devices.c
+ *
+ * Virtex-II Pro Device descriptions
+ *
+ * Maintainer: Grant Likely <[email-masked]>
+ *
+ * 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 "virtex-ii_pro.h"
+#include "xparameters/xparameters.h"
+
+struct plat_serial8250_port serial_platform_data[] = {
+#ifdef XPAR_OPB_UART16550_0_BASEADDR
+	{
+		.mapbase  = XPAR_OPB_UART16550_0_BASEADDR + 3,
+		.irq	  = XPAR_DCR_INTC_0_OPB_UART16550_0_IP2INTC_IRPT_INTR,
+		.iotype	  = UPIO_MEM,
+		.uartclk  = XPAR_XUARTNS550_CLOCK_HZ,
+		.flags	  = UPF_BOOT_AUTOCONF,
+		.regshift = 2,
+	},
+#endif
+#ifdef XPAR_OPB_UART16550_1_BASEADDR
+	{
+		.mapbase  = XPAR_OPB_UART16550_1_BASEADDR + 3,
+		.irq	  = XPAR_DCR_INTC_0_OPB_UART16550_1_IP2INTC_IRPT_INTR,
+		.iotype	  = UPIO_MEM,
+		.uartclk  = XPAR_XUARTNS550_CLOCK_HZ,
+		.flags	  = UPF_BOOT_AUTOCONF,
+		.regshift = 2,
+	},
+#endif
+	{ }, /* terminated by empty record */
+};
+
+struct platform_device ppc_sys_platform_devices[] = {
+	[V2PRO_UART] = {
+		.name		= "serial8250",
+		.id		= 0,
+		.dev.platform_data = serial_platform_data,
+	},
+};
+
+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[])
+		{
+			V2PRO_UART,
+		},
+	},
+};
+
diff --git a/arch/ppc/platforms/4xx/xparameters/xparameters.h
b/arch/ppc/platforms/4xx/xparameters/xparameters.h
new file mode 100644
--- /dev/null
+++ b/arch/ppc/platforms/4xx/xparameters/xparameters.h
@@ -0,0 +1,51 @@
+/*
+ * arch/ppc/platforms/4xx/xparameters/xparameters.h
+ *
+ * This file includes the correct xparameters.h for the CONFIG'ed board
+ *
+ * Authors:
+ *    Grant C. Likely, [email-masked]
+ *    MontaVista Software, Inc. [email-masked]
+ *
+ * 2005 (c) Grant C. Likely, [email-masked]
+ * 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 has three purposes:
+ * 1. Include the correct xparameters.h for the configured design
+ * 2. Translate design specific macros from xparam to common names
+ * 3. Provide a SERIAL_PORT_DFNS macro to setup up very early serial ports
+ *    zImage debug.  Later serial ports are advertised via the platform bus
+ *
+ * The xparameters.h file is the pristine copy generated from Xilinx EDK
+ * toolset.  If you need to make changes, make the changes in this file
+ * rather than modifying the generated file.  That way if the design changes
+ * then you just need to drop in the new xparameters.h
+ */
+
+#if defined(CONFIG_XILINX_ML300)
+  #include "xparameters_ml300.h"
+
+  /* Values for setting up interrupt controller */
+  #define V2PRO_XINTC_USE_DCR           XPAR_XINTC_USE_DCR
+  #define V2PRO_INTC_BASEADDR           XPAR_INTC_0_BASEADDR
+  #define V2PRO_INTC_KIND_OF_INTR       XPAR_INTC_0_KIND_OF_INTR
+
+  /* zImage serial port definitions */
+  #define SERIAL_PORT_DFNS {                                            \
+        .baud_base       = XPAR_XUARTNS550_CLOCK_HZ/16,                 \
+        .irq             = XPAR_DCR_INTC_0_OPB_UART16550_0_IP2INTC_IRPT_INTR, \
+        .flags           = ASYNC_BOOT_AUTOCONF,                         \
+        .iomem_base      = (u8 *)XPAR_OPB_UART16550_0_BASEADDR + 3,     \
+        .iomem_reg_shift = 2,                                           \
+        .io_type         = SERIAL_IO_MEM,                               \
+  },
+#else
+  /* Add other board xparameter includes here before the #else */
+  #error No *_xparameters.h file included
+#endif
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
--- a/arch/ppc/syslib/Makefile
+++ b/arch/ppc/syslib/Makefile
@@ -17,7 +17,7 @@ obj-$(CONFIG_440GX)		+= ibm440gx_common.
 obj-$(CONFIG_440SP)		+= ibm440gx_common.o ibm440sp_common.o
 ifeq ($(CONFIG_4xx),y)
 ifeq ($(CONFIG_VIRTEX_II_PRO),y)
-obj-$(CONFIG_40x)		+= xilinx_pic.o
+obj-$(CONFIG_40x)		+= xilinx_pic.o ppc_sys.o
 else
 ifeq ($(CONFIG_403),y)
 obj-$(CONFIG_40x)		+= ppc403_pic.o
diff --git a/arch/ppc/syslib/gen550_dbg.c b/arch/ppc/syslib/gen550_dbg.c
--- a/arch/ppc/syslib/gen550_dbg.c
+++ b/arch/ppc/syslib/gen550_dbg.c
@@ -155,6 +155,8 @@ serial_close(unsigned long com_port)
 void
 gen550_init(int i, struct uart_port *serial_req)
 {
+	if (i > RS_TABLE_SIZE)
+		return;
 	rs_table[i].io_type = serial_req->iotype;
 	rs_table[i].port = serial_req->iobase;
 	rs_table[i].iomem_base = serial_req->membase;
diff --git a/arch/ppc/syslib/xilinx_pic.c b/arch/ppc/syslib/xilinx_pic.c
--- a/arch/ppc/syslib/xilinx_pic.c
+++ b/arch/ppc/syslib/xilinx_pic.c
@@ -15,7 +15,7 @@
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <asm/io.h>
-#include <asm/xparameters.h>
+#include <platforms/4xx/xparameters/xparameters.h>
 #include <asm/ibm4xx.h>
 
 /* No one else should require these constants, so define them locally here. */
@@ -122,14 +122,14 @@ ppc4xx_pic_init(void)
 #error NR_IRQS > 32 not supported
 #endif
 
-#if XPAR_XINTC_USE_DCR == 0
-	intc = ioremap(XPAR_INTC_0_BASEADDR, 32);
+#if V2PRO_XINTC_USE_DCR == 0
+	intc = ioremap(V2PRO_INTC_BASEADDR, 32);
 
 	printk(KERN_INFO "Xilinx INTC #0 at 0x%08lX mapped to 0x%08lX\n",
-	       (unsigned long) XPAR_INTC_0_BASEADDR, (unsigned long) intc);
+	       (unsigned long) V2PRO_INTC_BASEADDR, (unsigned long) intc);
 #else
 	printk(KERN_INFO "Xilinx INTC #0 at 0x%08lX (DCR)\n",
-	       (unsigned long) XPAR_INTC_0_BASEADDR);
+	       (unsigned long) V2PRO_INTC_BASEADDR);
 #endif
 
 	/*
@@ -149,7 +149,7 @@ ppc4xx_pic_init(void)
 	for (i = 0; i < NR_IRQS; ++i) {
 		irq_desc[i].handler = &xilinx_intc;
 
-		if (XPAR_INTC_0_KIND_OF_INTR & (0x00000001 << i))
+		if (V2PRO_INTC_KIND_OF_INTR & (0x00000001 << i))
 			irq_desc[i].status &= ~IRQ_LEVEL;
 		else
 			irq_desc[i].status |= IRQ_LEVEL;
diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
--- a/include/asm-ppc/ppc_sys.h
+++ b/include/asm-ppc/ppc_sys.h
@@ -29,6 +29,8 @@
 #include <asm/mpc52xx.h>
 #elif defined(CONFIG_MPC10X_BRIDGE)
 #include <asm/mpc10x.h>
+#elif defined(CONFIG_VIRTEX_II_PRO)
+#include <platforms/4xx/virtex-ii_pro.h>
 #else
 #error "need definition of ppc_sys_devices"
 #endif
diff --git a/include/asm-ppc/xparameters.h b/include/asm-ppc/xparameters.h
deleted file mode 100644
--- a/include/asm-ppc/xparameters.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * include/asm-ppc/xparameters.h
- *
- * This file includes the correct xparameters.h for the CONFIG'ed board
- *
- * Author: MontaVista Software, Inc.
- *         [email-masked]
- *
- * 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.
- */
-
-#include <linux/config.h>
-
-#if defined(CONFIG_XILINX_ML300)
-#include <platforms/4xx/xparameters/xparameters_ml300.h>
-#endif