[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] PS/2 Controller



Hello,

we have already integrated the driver in our platform. Here is a patch
for this.

You can apply it in the main directory with

patch -p1 < xilinx_ps2.patch

Hope this helps,
   Hans
-------------------- snip ----------------
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/Kconfig b/software/linux-2.6.x-petalogix/drivers/input/serio/Kconfig
index adef447..a2485fe 100644
--- a/software/linux-2.6.x-petalogix/drivers/input/serio/Kconfig
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/Kconfig
@@ -156,6 +156,15 @@ config SERIO_MACEPS2
 	  To compile this driver as a module, choose M here: the
 	  module will be called maceps2.
 
+config SERIO_XILINXPS2
+	tristate "Xilinx PS/2 IP core"
+	depends on MICROBLAZE
+	help
+	  Say Y here if you have a Xilinx PS/2 core on a Virtex FPGA.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called xilinx_ps2.
+
 config SERIO_LIBPS2
 	tristate "PS/2 driver library" if EMBEDDED
 	help
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/Makefile b/software/linux-2.6.x-petalogix/drivers/input/serio/Makefile
index 4155197..0352911 100644
--- a/software/linux-2.6.x-petalogix/drivers/input/serio/Makefile
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/Makefile
@@ -18,5 +18,6 @@ obj-$(CONFIG_HP_SDC)		+= hp_sdc.o
 obj-$(CONFIG_HIL_MLC)		+= hp_sdc_mlc.o hil_mlc.o
 obj-$(CONFIG_SERIO_PCIPS2)	+= pcips2.o
 obj-$(CONFIG_SERIO_MACEPS2)	+= maceps2.o
+obj-$(CONFIG_SERIO_XILINXPS2)	+= xilinx_ps2/
 obj-$(CONFIG_SERIO_LIBPS2)	+= libps2.o
 obj-$(CONFIG_SERIO_RAW)		+= serio_raw.o
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/Makefile b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/Makefile
new file mode 100644
index 0000000..4abf159
--- /dev/null
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/Makefile
@@ -0,0 +1,14 @@
+#
+# Makefile for the Xilinx PS/2 driver
+#
+
+EXTRA_CFLAGS    += -I$(TOPDIR)/drivers/xilinx_common
+
+obj-$(CONFIG_SERIO_XILINXPS2)	:= xilinx_ps2.o
+
+# Linux adapter code
+xilinx_ps2-objs	:= adapter.o
+
+# The Xilinx OS independent code.
+xilinx_ps2-objs	+= xps2.o xps2_g.o xps2_intr.o xps2_l.o
+
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/adapter.c b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/adapter.c
new file mode 100644
index 0000000..f787dcb
--- /dev/null
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/adapter.c
@@ -0,0 +1,308 @@
+/*
+ * x8042.c
+ *
+ * Expose the Xilinx PS/2 components as a typical PC 8042 keyboard controller
+ *
+ * Author: MontaVista Software, Inc.
+ *         source@xxxxxxxxxx
+ *
+ * 2002 (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 code is a bit unusual in a few ways.  The first is that it is
+ * emulating a hardware component: the typical PC's 8042 keyboard
+ * controller.  With the current implementation of the keyboard code in
+ * Linux, it seemed to make the most sense to not have yet another
+ * hacked up pc_keyb.c to handle the unique interface that has been
+ * exposed by Xilinx.  They basically expose the PS/2 interfaces just
+ * like serial ports.
+ *
+ * This code defines four functions that are called by the typical PC
+ * keyboard code when it wants to talk to the 8042.  These functions in
+ * turn expose the Xilinx PS/2 interfaces via the typical 8042
+ * interface.
+ *
+ * This brings us to another unusual aspect of this code.  Xilinx
+ * provides drivers with their FPGA IP.  Their drivers are composed of
+ * two logical parts where one part is the OS independent code and the
+ * other part is the OS dependent code.  This file exposes their OS
+ * independent functions as an 8042 keyboard controller.  The other
+ * files in this directory are the OS independent files as provided by
+ * Xilinx with no changes made to them.  The names exported by those
+ * files begin with XPs2_.  All functions in this file that are called
+ * by Linux have names that begin with x8042_.  The functions in this
+ * file that have Handler in their name are registered as callbacks with
+ * the underlying Xilinx OS independent layer.  Any other functions are
+ * static helper functions.
+ *
+ * One more thing should be noted.  The words input and output can be
+ * confusing in this context.  It depends upon whether you look at it
+ * from the perspective of the main CPU or from the perspective of the
+ * 8042 keyboard controller.  The KBD_STAT_OBF, KBD_STAT_MOUSE_OBF and
+ * KBD_STAT_IBF defines from pc_keyb.h are from the perspective of the
+ * 8042: OBF means Output Buffer Full which means that there is a byte
+ * available to be read from the keyboard controller.  However,
+ * pc_keyb.c also calls the functions kbd_read_input, kbd_read_status,
+ * kbd_write_output and kbd_write_command.  The naming of these
+ * functions is from the other perspective, that of the main CPU.
+ *
+ * There are some lurking issues that I have not addressed yet.  I haven't seen
+ * them raise their heads, but I believe that the potential for a problem is
+ * there.  The first issue is that nothing prevents the mouse from trashing the
+ * keyboard and vice-versa.  I've tried to make this happen by holding down a
+ * key while mucking with the mouse under X, but didn't see any problem, but it
+ * still should probably be addressed.
+ *
+ * The second issue is that whenever we set an Output Buffer Full flag as the
+ * result of a command, we should probably generate an interrupt.  I don't
+ * think this is actually a problem because whenever pc_keyb.c sends a command
+ * where a response is expected, it appears that it goes into a polling loop.
+ * Something to remember though if you run into a problem.
+ *
+ * The final issue is that KBD_MODE_DISABLE_KBD and KBD_MODE_DISABLE_MOUSE are
+ * not yet handled.  DISABLE_KBD is not used and DISABLE_MOUSE is only used
+ * during startup and shutdown.  In short, this is another thing that should be
+ * addressed.
+ *
+ * SAATODO: Address these issues.
+ */
+
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/ioport.h>
+#include <linux/autoconf.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/serio.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+
+#include <xbasic_types.h>
+#include "xps2.h"
+#include "xps2_i.h"
+#include "xparameters_mapping.h"
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@xxxxxx>");
+MODULE_DESCRIPTION("Xilinx PS/2 IP core driver for Virtex FPGA family");
+MODULE_LICENSE("GPL");
+
+/* Our private per device data. */
+struct xilinx_ps2_dev {
+	int index;		/* Which interface is this */
+	int irq;
+	u32 phys_addr;		/* Saved physical base address */
+	struct serio *serio;	/* Registered serio object for this instance */
+	/*
+	 * The underlying OS independent code needs space as well.  A
+	 * pointer to the following XPs2 structure will be passed to
+	 * any XPs2_ function that requires it.  However, we treat the
+	 * data as an opaque object in this file (meaning that we never
+	 * reference any of the fields inside of the structure).
+	 */
+	XPs2 Ps2;
+};
+static struct xilinx_ps2_dev keyboard = {
+	.index = 0,
+	.irq = XPAR_OPB_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR1_INTR,
+};
+static struct xilinx_ps2_dev mouse = {
+	.index = 1,
+	.irq = XPAR_OPB_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR2_INTR,
+};
+
+/* SAATODO: This function will be moved into the Xilinx code. */
+/*****************************************************************************/
+/**
+*
+* Lookup the device configuration based on the PS/2 instance.  The table
+* XPs2_ConfigTable contains the configuration info for each device in the system.
+*
+* @param Instance is the index of the PS/2 interface being looked up.
+*
+* @return
+*
+* A pointer to the configuration table entry corresponding to the given
+* device ID, or NULL if no match is found.
+*
+* @note
+*
+* None.
+*
+******************************************************************************/
+static XPs2_Config*
+XPs2_GetConfig(int Instance)
+{
+	if (Instance < 0 || Instance >= XPAR_XPS2_NUM_INSTANCES)
+	{
+		return NULL;
+	}
+
+	return &XPs2_ConfigTable[Instance];
+}
+
+static int
+xilinx_ps2_open(struct serio *serio)
+{
+	struct xilinx_ps2_dev *dev = serio->port_data;
+	printk(KERN_INFO "xilinx_ps2_open(serio=%p)\n", serio);
+	XPs2_EnableInterrupt(&dev->Ps2);
+	return 0;
+}
+
+static void
+xilinx_ps2_close(struct serio *serio)
+{
+	//struct xilinx_ps2_dev *dev = serio->port_data;
+	printk(KERN_INFO "xilinx_ps2_close(serio=%p)\n", serio);
+	//XPs2_DisableInterrupt(&dev->Ps2);
+}
+
+static int
+xilinx_ps2_write(struct serio *serio, unsigned char c)
+{
+	struct xilinx_ps2_dev *dev = serio->port_data;
+	//printk(KERN_INFO "xilinx_ps2_write(serio=%p, c=%x)\n", serio, c);
+	XPs2_Send(&dev->Ps2, &c, 1);
+	return 0;
+}
+
+static irqreturn_t
+xilinx_ps2_interrupt(int irq, void *dev_id)
+{
+	struct xilinx_ps2_dev *dev = dev_id;
+	//printk(KERN_ERR "xilinx_ps2: irq(irq=%d, dev_id=%p)\n", irq, dev_id);
+	XPs2_InterruptHandler(&dev->Ps2);
+	return IRQ_HANDLED;
+}
+
+static void
+xilinx_ps2_interrupt_handler(void *ref, u32 event, unsigned int data)
+{
+	struct xilinx_ps2_dev *dev = ref;
+	u8 c = 0;
+
+	switch (event) {
+	case XPS2_EVENT_RECV_DATA:
+		//printk(KERN_WARNING "xilinx_ps2: rx data %u\n", event);
+		if (XPs2_Recv(&dev->Ps2, &c, 1) != 1) {
+			printk(KERN_ERR "xilinx_ps2: missing rx data\n");
+		}
+		serio_interrupt(dev->serio, c, 0);
+		break;
+
+	case XPS2_EVENT_RECV_ERROR:
+		serio_reconnect(dev->serio);
+		break;
+
+	case XPS2_EVENT_RECV_OVF:
+		serio_reconnect(dev->serio);
+		return;
+
+	case XPS2_EVENT_SENT_DATA:
+		return;
+
+	default:
+		printk(KERN_WARNING "xilinx_ps2: unknown event %u\n", event);
+		return;
+	}
+
+}
+
+static int
+xilinx_ps2_probe(struct xilinx_ps2_dev *dev)
+{
+	struct platform_device *pdev;
+	struct serio *serio;
+	XPs2_Config *cfg;
+	int rc;
+
+	/* Find the config for our device. */
+	cfg = XPs2_GetConfig(dev->index);
+	if (!cfg) {
+		printk(KERN_ERR
+		       "xilinx_ps2: no config for device %d\n",
+		       dev->index);
+		return -ENODEV;
+	}
+
+	/* Map the device into virtual memory.  save physical address for
+	 * restoring later. */
+	dev->phys_addr = cfg->BaseAddress;
+	cfg->BaseAddress = (u32) ioremap(dev->phys_addr, PS2_REMAP_SIZE);
+
+	/* Initialize the device */
+	if (XPs2_CfgInitialize(&dev->Ps2, cfg, cfg->BaseAddress) != XST_SUCCESS) {
+		printk(KERN_ERR
+		       "Xilinx PS/2 #%d: Could not initialize device.\n",
+		       dev->index);
+		return -ENODEV;
+	}
+
+	/* The device exists, create a platform device for it */
+	pdev = platform_device_register_simple("xilinx_ps2", dev->index, NULL, 0);
+	if (!pdev)
+		return -ENOMEM;
+
+	/* The serio stuct tells the input layer how to talk to the PS/2 device;
+	 * Allocate and initialize it. */
+	serio = kmalloc(sizeof(struct serio), GFP_KERNEL);
+	if (!serio) {
+		printk(KERN_ERR "xilinx_ps2: could not alloc serio struct\n");
+		return -ENOMEM;
+	}
+
+	/* Initialize the serio structure */
+	memset(serio, 0, sizeof(struct serio));
+	serio->id.type = SERIO_8042;
+	serio->open = xilinx_ps2_open;
+	serio->close = xilinx_ps2_close;
+	serio->write = xilinx_ps2_write;
+	serio->port_data = dev;
+	serio->dev.parent = &pdev->dev;
+	snprintf(serio->name, sizeof(serio->name),
+		 "Xilinx PS2 port %i", dev->index);
+	snprintf(serio->phys, sizeof(serio->phys),
+		 "xilinx/serio%i", dev->index);
+	serio_register_port(serio);
+	dev->serio = serio;
+
+	/* Set up the interrupt handler. */
+	rc = request_irq(dev->irq, xilinx_ps2_interrupt, 0, "xilinx_ps2", dev);
+	if (rc) {
+		printk(KERN_ERR "xilinx_ps2: Could not allocate interrupt %d.\n",
+			dev->irq);
+	}
+	XPs2_SetHandler(&dev->Ps2, xilinx_ps2_interrupt_handler, dev);
+
+	printk(KERN_INFO "Xilinx PS/2 #%d at 0x%08X mapped to 0x%08X\n",
+	       dev->index, dev->phys_addr, cfg->BaseAddress);
+
+	return 0;
+}
+
+static int __init
+xilinx_ps2_init(void)
+{
+	int rc;
+	printk(KERN_INFO "xilinx_ps2_init()\n");
+	if ((rc = xilinx_ps2_probe(&mouse)))
+		printk(KERN_ERR "xilinx_ps2: error initializing mouse (%d)\n", rc);
+	if ((rc = xilinx_ps2_probe(&keyboard)))
+		printk(KERN_ERR "xilinx_ps2: error initializing keyboard (%d)\n", rc);
+	return 0;
+}
+
+static void __exit
+xilinx_ps2_exit(void)
+{
+}
+
+module_init(xilinx_ps2_init);
+module_exit(xilinx_ps2_exit);
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xparameters_mapping.h b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xparameters_mapping.h
new file mode 100644
index 0000000..332d503
--- /dev/null
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xparameters_mapping.h
@@ -0,0 +1,59 @@
+#if defined (CONFIG_XILINX_PS2_0_BASEADDR)
+#define XPAR_OPB_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR1_INTR CONFIG_XILINX_PS2_0_IP2INTC_IRPT_1_IRQ
+#define XPAR_OPB_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR2_INTR CONFIG_XILINX_PS2_0_IP2INTC_IRPT_2_IRQ
+#define XPAR_XPS2_NUM_INSTANCES (2*CONFIG_XILINX_PS2_NUM_INSTANCES)
+#define XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_0 CONFIG_XILINX_PS2_0_BASEADDR
+#define XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_1 (CONFIG_XILINX_PS2_0_BASEADDR + 0x1000)
+
+#define XPAR_PS2_REMAP_SIZE		(CONFIG_XILINX_PS2_0_HIGHADDR - \
+				 CONFIG_XILINX_PS2_0_BASEADDR + 1)
+#define XPs2_EnableInterrupt(a) do { XPs2_IntrEnable(a, XPS2_IPIXR_ALL); XPs2_IntrGlobalEnable(a); }while(0)
+#define XPs2_InterruptHandler XPs2_IntrHandler
+
+#define XPS2_EVENT_RECV_DATA  XPS2_IPIXR_RX_FULL
+#define XPS2_EVENT_RECV_ERROR XPS2_IPIXR_RX_ERR
+#define XPS2_EVENT_RECV_OVF XPS2_IPIXR_RX_OVF
+#define XPS2_EVENT_SENT_DATA XPS2_IPIXR_TX_ACK
+#define XPAR_PS2_0_DEVICE_ID 0
+#define XPAR_PS2_1_DEVICE_ID 1
+
+#if 0
+#define XPS2_IPIXR_WDT_TOUT	0x00000001 /**< Watchdog Timeout Interrupt */
+#define XPS2_IPIXR_TX_NOACK	0x00000002 /**< Transmit No ACK Interrupt */
+#define XPS2_IPIXR_TX_ACK	0x00000004 /**< Transmit ACK (Data) Interrupt */
+#define XPS2_IPIXR_RX_OVF	0x00000008 /**< Receive Overflow Interrupt */
+#define XPS2_IPIXR_RX_ERR	0x00000010 /**< Receive Error Interrupt */
+#define XPS2_IPIXR_RX_FULL	0x00000020 /**< Receive Data Interrupt */
+#endif
+
+#define XPAR_PS2_0_BASEADDR CONFIG_XILINX_PS2_0_BASEADDR
+#define XPAR_PS2_1_BASEADDR (XPAR_PS2_0_BASEADDR + 0x1000)
+#endif
+
+#ifndef XPAR_OPB_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR1_INTR
+#define XPAR_OPB_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR1_INTR CONFIG_XILINX_PS2_DUAL_REF_0_SYS_INTR1_IRQ
+#endif
+#ifndef XPAR_OPB_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR2_INTR
+#define XPAR_OPB_INTC_0_OPB_PS2_DUAL_REF_0_SYS_INTR2_INTR CONFIG_XILINX_PS2_DUAL_REF_0_SYS_INTR2_IRQ
+#endif
+#ifndef XPAR_XPS2_NUM_INSTANCES
+#define XPAR_XPS2_NUM_INSTANCES (2*CONFIG_XILINX_PS2_DUAL_REF_NUM_INSTANCES)
+#endif
+#ifndef XPAR_OPB_PS2_DUAL_REF_0_DEVICE_ID_0
+#define XPAR_OPB_PS2_DUAL_REF_0_DEVICE_ID_0 0
+#endif
+#ifndef XPAR_OPB_PS2_DUAL_REF_0_DEVICE_ID_1
+#define XPAR_OPB_PS2_DUAL_REF_0_DEVICE_ID_1 1
+#endif
+#ifndef XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_0
+#define XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_0 CONFIG_XILINX_PS2_DUAL_REF_0_BASEADDR
+#endif
+#ifndef XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_1
+#define XPAR_OPB_PS2_DUAL_REF_0_BASEADDR_1 (CONFIG_XILINX_PS2_DUAL_REF_0_BASEADDR + 0x1000)
+#endif
+
+#ifndef XPAR_PS2_REMAP_SIZE
+#define XPAR_PS2_REMAP_SIZE		(CONFIG_XILINX_PS2_DUAL_REF_0_HIGHADDR - \
+				 CONFIG_XILINX_PS2_DUAL_REF_0_BASEADDR + 1)
+#endif
+
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2.c b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2.c
new file mode 100644
index 0000000..d4d68b4
--- /dev/null
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2.c
@@ -0,0 +1,418 @@
+/* $Id: xps2.c,v 1.1.2.1 2008/02/20 13:15:53 svemula Exp $ */
+/*****************************************************************************
+*
+*       XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
+*       AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
+*       SOLUTIONS FOR XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE,
+*       OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
+*       APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
+*       THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
+*       AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
+*       FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY
+*       WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
+*       IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
+*       REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
+*       INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*       FOR A PARTICULAR PURPOSE.
+*
+*       (c) Copyright 2008 Xilinx Inc.
+*       All rights reserved.
+*
+*****************************************************************************/
+/****************************************************************************/
+/**
+*
+* @file xps2.c
+*
+* This file contains the functions for the PS/2 driver.
+* Refer to the header file xps2.h for more detailed information.
+*
+* @note
+*
+* None.
+*
+* <pre>
+* MODIFICATION HISTORY:
+*
+* Ver   Who      Date     Changes
+* ----- ------   -------- -----------------------------------------------
+* 1.00a sv/sdm   01/25/08 First release
+*
+* </pre>
+*
+*****************************************************************************/
+
+/***************************** Include Files ********************************/
+
+#include "xps2.h"
+
+/************************** Constant Definitions ****************************/
+
+/**************************** Type Definitions ******************************/
+
+/***************** Macros (Inline Functions) Definitions ********************/
+
+/************************** Variable Definitions ****************************/
+
+/************************** Function Prototypes *****************************/
+
+static void XPs2_StubHandler(void *CallBackRef, u32 IntrMask, u32 ByteCount);
+
+u32 XPs2_SendBuffer(XPs2 *InstancePtr);
+
+u32 XPs2_ReceiveBuffer(XPs2 *InstancePtr);
+
+/****************************************************************************/
+/**
+*
+* Initializes a specific PS/2 instance such that it is ready to be used.
+* The default operating mode of the driver is polled mode.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+* @param	ConfigPtr is a reference to a structure containing information
+*		about a specific PS/2 device.
+* @param	EffectiveAddr is the device base address in the virtual memory
+*		address space. If address translation is not used then the
+*		physical address is passed. Unexpected errors may occur if the
+*		address mapping is changed after this function is invoked.
+*
+* @return
+*		- XST_SUCCESS if initialization is successful
+*
+* @note		The PS/2 device will be reset and all the interrupts
+*		are disabled as a part of the initialization.
+*
+*****************************************************************************/
+int XPs2_CfgInitialize(XPs2 *InstancePtr, XPs2_Config *ConfigPtr,
+						u32 EffectiveAddr)
+{
+	/*
+	 * Assert validates the input arguments
+	 */
+	XASSERT_NONVOID(InstancePtr != NULL);
+	XASSERT_NONVOID(ConfigPtr != NULL);
+
+	/*
+	 * Setup the data that is from the configuration information
+	 */
+	InstancePtr->Ps2Config.BaseAddress = EffectiveAddr;
+
+	/*
+	 * Initialize the instance data to some default values and setup a
+	 * default handler
+	 */
+	InstancePtr->Handler = XPs2_StubHandler;
+
+	InstancePtr->SendBuffer.NextBytePtr = NULL;
+	InstancePtr->SendBuffer.RemainingBytes = 0;
+	InstancePtr->SendBuffer.RequestedBytes = 0;
+
+	InstancePtr->ReceiveBuffer.NextBytePtr = NULL;
+	InstancePtr->ReceiveBuffer.RemainingBytes = 0;
+	InstancePtr->ReceiveBuffer.RequestedBytes = 0;
+
+	/*
+	 * Reset the PS/2 Hardware
+	 */
+	XPs2_Reset(InstancePtr);
+
+	/*
+	 * Indicate the instance is now ready to use, initialized without error
+	 */
+	InstancePtr->IsReady = XCOMPONENT_IS_READY;
+
+	return XST_SUCCESS;
+}
+
+/****************************************************************************/
+/**
+*
+* This functions sends the specified buffer of data to the PS/2 port in either
+* polled or interrupt driven modes. This function is non-blocking such that it
+* will return before the data has been sent through PS/2. If the port is busy
+* sending data, it will return and indicate that zero bytes were sent.
+*
+* In polled mode, this function will only send 1 byte which is as much data
+* as the transmitter can buffer. The application may need to call it
+* repeatedly to send a buffer.
+*
+* In interrupt mode, this function will start sending the specified buffer and
+* then the interrupt handler of the driver will continue sending data until the
+* buffer has been sent. A callback function, as specified by the application,
+* will be called to indicate the completion of sending the buffer.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+* @param	BufferPtr is pointer to a buffer of data to be sent.
+* @param	NumBytes contains the number of bytes to be sent. A value of
+*		zero will stop a previous send operation that is in progress in
+*		interrupt mode.
+*
+* @return	The number of bytes actually sent.
+*
+* @note
+*
+* The number of bytes is not asserted so that this function may be called with
+* a value of zero to stop an operation that is already in progress.
+* <br><br>
+* This function modifies shared data such that there may be a need for mutual
+* exclusion in a multithreaded environment
+*
+*****************************************************************************/
+u32 XPs2_Send(XPs2 *InstancePtr, u8 *BufferPtr, u32 NumBytes)
+{
+	u32 BytesSent;
+
+	/*
+	 * Assert validates the input arguments
+	 */
+	XASSERT_NONVOID(InstancePtr != NULL);
+	XASSERT_NONVOID(BufferPtr != NULL);
+	XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);
+
+	/*
+	 * Enter a critical region by disabling the PS/2 transmit interrupts to
+	 * allow this call to stop a previous operation that may be interrupt
+	 * driven, only stop the transmit interrupt since this critical region
+	 * is not really exited in the normal manner
+	 */
+	XPs2_IntrDisable(InstancePtr, XPS2_IPIXR_TX_ALL);
+
+	/*
+	 * Setup the specified buffer to be sent by setting the instance
+	 * variables so it can be sent with polled or interrupt mode
+	 */
+	InstancePtr->SendBuffer.RequestedBytes = NumBytes;
+	InstancePtr->SendBuffer.RemainingBytes = NumBytes;
+	InstancePtr->SendBuffer.NextBytePtr = BufferPtr;
+
+	/*
+	 * Send the buffer and return the number of bytes sent
+	 */
+	BytesSent = XPs2_SendBuffer(InstancePtr);
+
+	/*
+	 * The critical region is not exited in this function because of the way
+	 * the transmit interrupts work. The other function called enables the
+	 * transmit interrupt such that this function can't restore a value to
+	 * the interrupt enable register and does not need to exit the critical
+	 * region
+	 */
+	return BytesSent;
+}
+
+
+/****************************************************************************/
+/**
+*
+* This function will attempt to receive a specified number of bytes of data
+* from PS/2 and store it into the specified buffer. This function is
+* designed for either polled or interrupt driven modes. It is non-blocking
+* such that it will return if no data was received by the PS/2 port.
+*
+* In polled mode, this function will only receive 1 byte which is as much
+* data as the receiver can buffer. The application may need to call it
+* repeatedly to receive a buffer. Polled mode is the default mode of operation
+* for the driver.
+*
+* In interrupt mode, this function will start receiving and then the interrupt
+* handler of the driver will continue receiving data until the buffer has been
+* received. A callback function, as specified by the application, will be called
+* to indicate the completion of receiving the buffer or when any receive errors
+* or timeouts occur. Interrupt mode must be enabled.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+* @param	BufferPtr is pointer to buffer for data to be received into.
+* @param	NumBytes is the number of bytes to be received. A value of zero
+*		will stop a previous receive operation that is in progress in
+*		interrupt mode.
+*
+* @return	The number of bytes received.
+*
+* @note
+*
+* The number of bytes is not asserted so that this function may be called with
+* a value of zero to stop an operation that is already in progress.
+*
+*****************************************************************************/
+u32 XPs2_Recv(XPs2 *InstancePtr, u8 *BufferPtr, u32 NumBytes)
+{
+	u32 ReceivedCount;
+
+	/*
+	 * Assert validates the input arguments
+	 */
+	XASSERT_NONVOID(InstancePtr != NULL);
+	XASSERT_NONVOID(BufferPtr != NULL);
+	XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);
+
+	/*
+	 * Setup the specified buffer to be sent by setting the instance
+	 * variables so it can be sent with polled or interrupt mode
+	 */
+	InstancePtr->ReceiveBuffer.RequestedBytes = NumBytes;
+	InstancePtr->ReceiveBuffer.RemainingBytes = NumBytes;
+	InstancePtr->ReceiveBuffer.NextBytePtr = BufferPtr;
+
+	/*
+	 * Receive the data from PS/2 and return the number of bytes
+	 * received
+	 */
+	ReceivedCount = XPs2_ReceiveBuffer(InstancePtr);
+
+	return ReceivedCount;
+}
+
+/****************************************************************************/
+/**
+*
+* This function sends a buffer that has been previously specified by setting
+* up the instance variables of the instance. This function is designed to be
+* an internal function for the XPs2 component such that it may be called
+* from a shell function that sets up the buffer or from an interrupt handler.
+*
+* This function sends the specified buffer of data to the PS/2 port in either
+* polled or interrupt driven modes. This function is non-blocking such that
+* it will return before the data has been sent.
+*
+* In a polled mode, this function will only send 1 byte which is as much data
+* transmitter can buffer. The application may need to call it repeatedly to
+* send a buffer.
+*
+* In interrupt mode, this function will start sending the specified buffer and
+* then the interrupt handler of the driver will continue until the buffer
+* has been sent. A callback function, as specified by the application, will
+* be called to indicate the completion of sending the buffer.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+*
+* @return	NumBytes is the number of bytes actually sent.
+*
+* @note		None.
+*
+*****************************************************************************/
+u32 XPs2_SendBuffer(XPs2 *InstancePtr)
+{
+	u32 SentCount = 0;
+
+	/*
+	 * If the transmitter is empty send one byte of data
+	 */
+	if (XPs2_IsTxEmpty(InstancePtr->Ps2Config.BaseAddress)) {
+		XPs2_SendByte(InstancePtr->Ps2Config.BaseAddress,
+		  		InstancePtr->SendBuffer.NextBytePtr[SentCount]);
+
+		SentCount = 1;
+	}
+
+	/*
+	 * Update the buffer to reflect the bytes that were sent from it
+	 */
+	InstancePtr->SendBuffer.NextBytePtr += SentCount;
+	InstancePtr->SendBuffer.RemainingBytes -= SentCount;
+
+	/*
+	 * If interrupts are enabled as indicated by the receive interrupt, then
+	 * enable the transmit interrupt
+	 */
+	if (XPs2_IntrGetEnabled(InstancePtr) & XPS2_IPIXR_RX_FULL) {
+		XPs2_IntrEnable(InstancePtr,
+				(XPS2_IPIXR_TX_ALL | XPS2_IPIXR_WDT_TOUT));
+	}
+
+	return SentCount;
+}
+
+/****************************************************************************/
+/**
+*
+* This function receives a buffer that has been previously specified by setting
+* up the instance variables of the instance. This function is designed to be
+* an internal function for the XPs2 component such that it may be called
+* from a shell function that sets up the buffer or from an interrupt handler.
+*
+* This function will attempt to receive a specified number of bytes of data
+* from PS/2 and store it into the specified buffer. This function is
+* designed for either polled or interrupt driven modes. It is non-blocking
+* such that it will return if there is no data received.
+*
+* In polled mode, this function will only receive 1 byte which is as much
+* data as the receiver can buffer. The application may need to call it
+* repeatedly to receive a buffer. Polled mode is the default mode of operation
+* for the driver.
+*
+* In interrupt mode, this function will start receiving and then the interrupt
+* handler of the driver will continue until the buffer has been received. A
+* callback function, as specified by the application, will be called to indicate
+* the completion of receiving the buffer or when any receive errors or timeouts
+* occur. Interrupt mode must be enabled by enabling the interrupts using the
+* XPs2_IntrEnable() and XPs2_IntrGlobalEnable() API's.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+*
+* @return	The number of bytes received.
+*
+* @note		None.
+*
+*****************************************************************************/
+u32 XPs2_ReceiveBuffer(XPs2 *InstancePtr)
+{
+	u32 ReceivedCount = 0;
+
+	/*
+	 * Loop until there is no more data buffered by the PS/2 receiver or the
+	 * specified number of bytes has been received
+	 */
+	while (ReceivedCount < InstancePtr->ReceiveBuffer.RemainingBytes) {
+		/*
+		 * If there is data ready to be read , then put the next byte
+		 * read into the specified buffer
+		 */
+		if (XPs2_IsRxFull(InstancePtr->Ps2Config.BaseAddress)) {
+		       InstancePtr->ReceiveBuffer.NextBytePtr[ReceivedCount++] =
+			XPs2_RecvByte(InstancePtr->Ps2Config.BaseAddress);
+		}
+
+		/*
+		 * There is no more data buffered, so exit such that this
+		 * function does not block waiting for data
+		 */
+		else {
+			break;
+		}
+	}
+
+	/*
+	 * Update the receive buffer to reflect the number of bytes that were
+	 * received
+	 */
+	InstancePtr->ReceiveBuffer.NextBytePtr += ReceivedCount;
+	InstancePtr->ReceiveBuffer.RemainingBytes -= ReceivedCount;
+
+	return ReceivedCount;
+}
+
+/****************************************************************************/
+/**
+*
+* This function is a stub handler that is the default handler such that if the
+* application has not set the handler when interrupts are enabled, this
+* function will be called. The function interface has to match the interface
+* specified for a handler even though none of the arguments are used.
+*
+* @param	CallBackRef is unused by this function.
+* @param	IntrMask is unused by this function.
+* @param	ByteCount is unused by this function.
+*
+* @return	None.
+*
+* @note		None.
+*
+*****************************************************************************/
+static void XPs2_StubHandler(void *CallBackRef, u32 IntrMask, u32 ByteCount)
+{
+	/*
+	 * Assert always occurs since this is a stub and should never be called
+	 */
+	XASSERT_VOID_ALWAYS();
+}
+
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2.h b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2.h
new file mode 100644
index 0000000..dde996c
--- /dev/null
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2.h
@@ -0,0 +1,385 @@
+/* $Id: xps2.h,v 1.1.2.1 2008/02/20 13:15:53 svemula Exp $ */
+/*****************************************************************************
+*
+*       XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
+*       AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
+*       SOLUTIONS FOR XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE,
+*       OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
+*       APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
+*       THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
+*       AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
+*       FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY
+*       WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
+*       IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
+*       REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
+*       INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*       FOR A PARTICULAR PURPOSE.
+*
+*       (c) Copyright 2008 Xilinx Inc.
+*       All rights reserved.
+*
+*****************************************************************************/
+/*****************************************************************************/
+/**
+*
+* @file xps2.h
+*
+* The Xilinx XPs2 driver supports the Xilinx PS/2 device which has a Processor
+* Local Bus Interface (PLB).
+*
+* <b> Driver Description</b>
+*
+* The device driver enables higher layer software (e.g., an application) to
+* communicate to the PS/2 device. Apart from transmission and reception of data
+* the driver also handles configuration of the device. A single device driver
+* can support multiple PS/2 devices.
+*
+* This driver supports the following features:
+* 	- Polled mode
+* 	- Interrupt mode
+*
+* The driver defaults to polled mode at initialization such that interrupts
+* must be enabled if desired by the user.
+*
+* The XPs2_Send() and XPs2_Recv() APIs, are provided in the driver to
+* allow data to be sent and received respectively. They are designed to be used
+* in polled or interrupt modes.
+*
+* <b>Initialization & Configuration</b>
+*
+* To Initialize the PS/2 device using the driver, the user needs to first call
+* the XPs2_LookupConfig() API, followed by the XPs2_CfgInitialize() API.
+* XPs2_LookupConfig API returns the Configuration structure pointer which
+* is passed as a parameter to the XPs2_CfgInitialize function.
+* XPs2_CfgInitialize does the initialization of the PS/2 device.
+*
+* The PS2 device is reset when the driver is initialized.
+*
+* <b>Interrupts</b>
+*
+* An interrupt is generated for any of the following conditions :
+* 	- Data in the receiver
+* 	- Any receive status error detected
+* 	- Data byte transmitted
+* 	- Any transmit status error detected
+*
+* In order to use interrupts, it is necessary for the user to connect the
+* driver interrupt handler, XPs2_IntrHandler(), to the interrupt system of
+* the application. This function does not save and restore the processor
+* context such that the user must provide it. A handler must be set for the
+* driver such that the handler is called when the interrupts occur. The
+* handler is called from interrupt context and is designed to allow application
+* specific processing to be performed.
+*
+* The interrupts are enabled by calling the XPs2_IntrEnable() API.
+*
+* <b> Threads</b>
+*
+* This driver is not thread safe. Any needs for threads or thread mutual
+* exclusion must be satisfied by the layer above this driver.
+*
+* <b> Asserts</b>
+*
+* Asserts are used within all Xilinx drivers to enforce constraints on argument
+* values. Asserts can be turned off on a system-wide basis by defining, at
+* compile time, the NDEBUG identifier. By default, asserts are turned on and it
+* is recommended that users leave asserts on during development.
+*
+* <b> Building the driver</b>
+*
+* The XPs2 driver is composed of several source files. This allows the user
+* to build and link only those parts of the driver that are necessary.
+* <br><br>
+*
+* @note		None.
+*
+* <pre>
+* MODIFICATION HISTORY:
+*
+* Ver   Who      Date     Changes
+* ----- ------   -------- -----------------------------------------------
+* 1.00a sv/sdm   01/25/08 First release
+*
+* </pre>
+*
+******************************************************************************/
+#ifndef XPS2_H /* prevent circular inclusions */
+#define XPS2_H /* by using protection macros */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************** Include Files ********************************/
+
+#include "xbasic_types.h"
+#include "xstatus.h"
+#include "xps2_l.h"
+
+/************************** Constant Definitions ****************************/
+
+
+/**************************** Type Definitions ******************************/
+
+/**
+ * This typedef contains configuration information for the device
+ */
+typedef struct {
+	u16 DeviceId;		/**< Unique ID of device */
+	u32 BaseAddress;	/**< Base address of device */
+} XPs2_Config;
+
+/**
+ * The following data type is used to manage the buffers that are handled
+ * when sending and receiving data in the interrupt mode
+ */
+typedef struct {
+	u8 *NextBytePtr;	/**< Pointer to the Transmit/Receive Buffer */
+	u32 RequestedBytes; 	/**< Total Number of Bytes to be
+					Transmitted/Received */
+	u32 RemainingBytes; 	/**< Remaining Bytes to be
+					Transmitted/Received */
+} XPs2Buffer;
+
+/*****************************************************************************/
+/**
+ * This data type defines a handler which the application must define
+ * when using interrupt mode. The handler will be called from the driver in an
+ * interrupt context to handle application specific processing.
+ *
+ * @param 	CallBackRef is a callback reference passed in by the upper layer
+ *		when setting the handler, and is passed back to the upper layer
+ * 		when the handler is called.
+ * @param 	IntrMask is a bit mask of the interrupt status indicating why
+ *		the handler is being called.
+ * @param 	NumBytes contains the number of bytes sent or received at the
+ * 		time of the call.
+ *
+ *****************************************************************************/
+typedef void (*XPs2_Handler)(void *CallBackRef, u32 IntrMask, u32 NumBytes);
+
+/**
+ * The PS/2 driver instance data. The user is required to allocate a
+ * variable of this type for every PS/2 device in the system.
+ * If the last byte of a message was received then call the application
+ * handler, this code should not use an else from the previous check of
+ * the number of bytes to receive because the call to receive the buffer
+ * updates the bytes to receive.
+ * A pointer to a variable of this type is then passed to the driver API
+ * functions
+ */
+typedef struct {
+
+	XPs2_Config Ps2Config;   /**< Instance of the config structure */
+	u32 IsReady;		 /**< Device is initialized and ready */
+
+	XPs2Buffer SendBuffer;   /**< Buffer for sending data */
+	XPs2Buffer ReceiveBuffer;/**< Buffer for receiving data */
+
+	XPs2_Handler Handler;	 /**< Interrupt handler callback */
+	void *CallBackRef;	/**< Callback reference for interrupt handler */
+} XPs2;
+
+/***************** Macros (Inline Functions) Definitions ********************/
+
+/****************************************************************************/
+/**
+* Reset the PS/2 port.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+*
+* @return	None.
+*
+* @note		C-Style signature:
+*		void XPs2_Reset(XPs2 *InstancePtr);
+*
+******************************************************************************/
+#define XPs2_Reset(InstancePtr) 					\
+	XPs2_WriteReg((InstancePtr)->Ps2Config.BaseAddress, 		\
+			XPS2_SRST_OFFSET, XPS2_SRST_RESET);
+
+/****************************************************************************/
+/**
+* Read the PS/2 status register.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+*
+* @return	The value read from the register.
+*
+* @note		C-Style signature:
+*		u32 XPs2_GetStatus(XPs2 *InstancePtr);
+*
+******************************************************************************/
+#define XPs2_GetStatus(InstancePtr) \
+	XPs2_ReadReg((InstancePtr)->Ps2Config.BaseAddress, XPS2_STATUS_OFFSET)
+
+/****************************************************************************/
+/**
+*
+* Enable the global Interrupt in the Global Interrupt Enable Register.
+* Interrupts enabled using XPs2_IntrEnable() will not occur until the global
+* interrupt enable bit is set by using this function.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+*
+* @return	None.
+*
+* @note		C-Style signature:
+*		void XPs2_IntrGlobalEnable(XPs2 *InstancePtr);
+*
+******************************************************************************/
+#define XPs2_IntrGlobalEnable(InstancePtr) 				\
+	XPs2_WriteReg((InstancePtr)->Ps2Config.BaseAddress,		\
+				XPS2_GIER_OFFSET, XPS2_GIER_GIE_MASK)
+
+
+/****************************************************************************/
+/**
+*
+* Disable the global Interrupt in the Global Interrupt Enable Register.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+*
+* @return	None.
+*
+* @note		C-Style signature:
+*		void XPs2_IntrGlobalDisable(XPs2 *InstancePtr);
+*
+******************************************************************************/
+#define XPs2_IntrGlobalDisable(InstancePtr) 				\
+	XPs2_WriteReg((InstancePtr)->Ps2Config.BaseAddress, 		\
+				XPS2_GIER_OFFSET, 0x0)
+
+
+/****************************************************************************/
+/**
+*
+* Enable the specified Interrupts in the IP Interrupt Enable Register.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+* @param	EnableMask is the bitmask of the interrupts to be enabled.
+*		Bit positions of 1 will be enabled. Bit positions of 0 will
+*		keep the previous setting. This mask is formed by OR'ing
+*		XPS2_IPIXR_* bits defined in xps2_l.h.
+*
+* @return	None.
+*
+* @note		C-Style signature:
+*		void XPs2_IntrEnable(XPs2 *InstancePtr, u32 EnableMask);
+*
+******************************************************************************/
+#define XPs2_IntrEnable(InstancePtr, EnableMask) 			       \
+	XPs2_WriteReg((InstancePtr)->Ps2Config.BaseAddress, XPS2_IPIER_OFFSET, \
+		XPs2_ReadReg((InstancePtr)->Ps2Config.BaseAddress, 	       \
+			XPS2_IPIER_OFFSET) | (EnableMask & XPS2_IPIXR_ALL ))
+
+/****************************************************************************/
+/**
+*
+* Disable the specified Interrupts in the IP Interrupt Enable Register.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+* @param	DisableMask is the bitmask of the interrupts to be disabled.
+*		Bit positions of 1 will be disabled. Bit positions of 0 will
+*		keep the previous setting. This mask is formed by OR'ing
+*		XPS2_IPIXR_* bits defined in xps2_l.h.
+*
+* @return	None.
+*
+* @note		C-Style signature:
+*		void XPs2_IntrDisable(XPs2 *InstancePtr, u32 DisableMask);
+*
+******************************************************************************/
+#define XPs2_IntrDisable(InstancePtr, DisableMask) 			      \
+	XPs2_WriteReg((InstancePtr)->Ps2Config.BaseAddress, XPS2_IPIER_OFFSET,\
+		XPs2_ReadReg((InstancePtr)->Ps2Config.BaseAddress, 	      \
+		   XPS2_IPIER_OFFSET) & (~ (DisableMask & XPS2_IPIXR_ALL )))
+
+/****************************************************************************/
+/**
+*
+* This function returns the enabled interrupts. Use the XPS2_IPIXR_*_MASK
+* constants defined in xps2_l.h to interpret the returned value.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+*
+* @return 	Enabled interrupts in a 32-bit format.
+*
+* @note		C-Style signature:
+*		u32 XPs2_IntrGetEnabled(InstancePtr);
+*
+******************************************************************************/
+#define XPs2_IntrGetEnabled(InstancePtr) 				\
+	(XPs2_ReadReg((InstancePtr)->Ps2Config.BaseAddress, XPS2_IPIER_OFFSET))
+
+
+/****************************************************************************/
+/**
+*
+* Read the interrupt status register.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+*
+* @return	The value read from the register.
+*
+* @note		C-Style signature:
+*		u32 XPs2_IntrGetStatus(XPs2 *InstancePtr);
+*
+******************************************************************************/
+#define XPs2_IntrGetStatus(InstancePtr) \
+	XPs2_ReadReg((InstancePtr)->Ps2Config.BaseAddress, XPS2_IPISR_OFFSET)
+
+
+/****************************************************************************/
+/**
+*
+* Clear the pending interrupts in the Interrupt Status Register.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+* @param	ClearMask is the Bitmask for interrupts to be cleared.
+*		A "1" clears the interrupt.
+*
+* @return	None.
+*
+* @note		C-Style signature:
+*		void XPs2_IntrClear(XPs2 *InstancePtr, u32 ClearMask);
+*
+******************************************************************************/
+#define XPs2_IntrClear(InstancePtr, ClearMask) \
+	XPs2_WriteReg((InstancePtr)->Ps2Config.BaseAddress, XPS2_IPISR_OFFSET,\
+		XPs2_IntrGetStatus(InstancePtr) | (ClearMask & XPS2_IPIXR_ALL ))
+
+
+/************************** Function Prototypes *****************************/
+
+/*
+ * Initialization functions in xps2_sinit.c
+ */
+XPs2_Config *XPs2_LookupConfig(u16 DeviceId);
+
+/*
+ * Functions is xps2.c
+ */
+int XPs2_CfgInitialize(XPs2 *InstancePtr, XPs2_Config *Config,
+				u32 EffectiveAddr);
+u32 XPs2_Send(XPs2 *InstancePtr, u8 *BufferPtr, u32 NumBytes);
+u32 XPs2_Recv(XPs2 *InstancePtr, u8 *BufferPtr, u32 NumBytes);
+
+/*
+ * Functions in xps2_intr.c
+ */
+void XPs2_SetHandler(XPs2 *InstancePtr, XPs2_Handler FuncPtr,
+				void *CallBackRef);
+void XPs2_IntrHandler(XPs2 *InstancePtr);
+
+/*
+ * Functions in xps2_selftest.c
+ */
+int XPs2_SelfTest(XPs2 *InstancePtr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif			/* end of protection macro */
+
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_g.c b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_g.c
new file mode 100644
index 0000000..f3fabb9
--- /dev/null
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_g.c
@@ -0,0 +1,72 @@
+/* $Id: xps2_g.c,v 1.1.2.1 2008/02/20 13:15:53 svemula Exp $ */
+/*****************************************************************************
+*
+*       XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
+*       AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
+*       SOLUTIONS FOR XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE,
+*       OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
+*       APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
+*       THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
+*       AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
+*       FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY
+*       WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
+*       IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
+*       REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
+*       INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*       FOR A PARTICULAR PURPOSE.
+*
+*       (c) Copyright 2008 Xilinx Inc.
+*       All rights reserved.
+*
+*****************************************************************************/
+/****************************************************************************/
+/**
+*
+* @file xps2_g.c
+*
+* This file contains a configuration table that specifies the configuration of
+* PS/2 devices in the system.
+*
+* <pre>
+* MODIFICATION HISTORY:
+*
+* Ver   Who      Date     Changes
+* ----- ------   -------- -----------------------------------------------
+* 1.00a sv/sdm   01/25/08 First release
+*
+* </pre>
+*
+******************************************************************************/
+/***************************** Include Files ********************************/
+
+//#include "xparameters.h"
+#include "xparameters_mapping.h"
+#include "xps2.h"
+
+/************************** Constant Definitions ****************************/
+
+/**************************** Type Definitions ******************************/
+
+/***************** Macros (Inline Functions) Definitions ********************/
+
+/************************** Variable Definitions ****************************/
+
+/*
+ * The configuration table for PS/2 devices in the table. Each
+ * device should have an entry in this table.
+ */
+XPs2_Config XPs2_ConfigTable[] =
+{
+	{
+		XPAR_PS2_0_DEVICE_ID,
+		XPAR_PS2_0_BASEADDR
+	} ,
+
+	{
+		XPAR_PS2_1_DEVICE_ID,
+		XPAR_PS2_1_BASEADDR
+	}
+};
+
+/************************** Function Prototypes *****************************/
+
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_i.h b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_i.h
new file mode 100644
index 0000000..b28324f
--- /dev/null
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_i.h
@@ -0,0 +1,106 @@
+/*****************************************************************************
+*
+*     Author: Xilinx, 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.
+*
+*
+*     XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
+*     COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
+*     ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
+*     XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
+*     FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING
+*     ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
+*     XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
+*     THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
+*     WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
+*     CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
+*     FITNESS FOR A PARTICULAR PURPOSE.
+*
+*
+*     Xilinx hardware products are not intended for use in life support
+*     appliances, devices, or systems. Use in such applications is
+*     expressly prohibited.
+*
+*
+*     (c) Copyright 2002-2004 Xilinx Inc.
+*     All rights reserved.
+*
+*
+*     You should have received a copy of the GNU General Public License along
+*     with this program; if not, write to the Free Software Foundation, Inc.,
+*     675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*****************************************************************************/
+/****************************************************************************/
+/**
+*
+* @file xps2_i.h
+*
+* This header file contains internal identifiers, which are those shared
+* between the files of the driver. It is intended for internal use only.
+*
+* <pre>
+* MODIFICATION HISTORY:
+*
+* Ver   Who  Date     Changes
+* ----- ---- -------- -----------------------------------------------
+* 1.00a ch   06/18/02 First release
+* </pre>
+*
+******************************************************************************/
+#ifndef XPS2_I_H		/* prevent circular inclusions */
+#define XPS2_I_H		/* by using protection macros */
+
+/***************************** Include Files ********************************/
+
+#include "xps2.h"
+
+/************************** Constant Definitions ****************************/
+
+/**************************** Type Definitions ******************************/
+
+/***************** Macros (Inline Functions) Definitions ********************/
+
+/****************************************************************************
+*
+* This macro clears the statistics of the component instance. The purpose of
+* this macro is to allow common processing between the modules of the
+* component with less overhead than a function in the required module.
+*
+* @param    InstancePtr is a pointer to the XPs2 instance to be worked on.
+*
+* @return
+*
+* None.
+*
+* @note
+*
+* Signature: void XPs2_mClearStats(XPs2 *InstancePtr)
+*
+*****************************************************************************/
+#define XPs2_mClearStats(InstancePtr)                             \
+{                                                                       \
+    InstancePtr->Stats.TransmitInterrupts = 0UL;                        \
+    InstancePtr->Stats.ReceiveInterrupts = 0UL;                         \
+    InstancePtr->Stats.CharactersTransmitted = 0UL;                     \
+    InstancePtr->Stats.CharactersReceived = 0UL;                        \
+    InstancePtr->Stats.ReceiveErrors = 0UL;                             \
+    InstancePtr->Stats.ReceiveOverflowErrors = 0UL;                     \
+    InstancePtr->Stats.TransmitErrors = 0UL;                            \
+}
+
+/************************** Variable Definitions ****************************/
+
+extern XPs2_Config XPs2_ConfigTable[];
+
+/************************** Function Prototypes *****************************/
+
+unsigned int XPs2_SendBuffer(XPs2 * InstancePtr);
+unsigned int XPs2_ReceiveBuffer(XPs2 * InstancePtr);
+
+#endif
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_intr.c b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_intr.c
new file mode 100644
index 0000000..a6249a8
--- /dev/null
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_intr.c
@@ -0,0 +1,204 @@
+/* $Id: xps2_intr.c,v 1.1.2.1 2008/02/20 13:15:53 svemula Exp $ */
+/*****************************************************************************
+*
+*       XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
+*       AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
+*       SOLUTIONS FOR XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE,
+*       OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
+*       APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
+*       THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
+*       AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
+*       FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY
+*       WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
+*       IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
+*       REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
+*       INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*       FOR A PARTICULAR PURPOSE.
+*
+*       (c) Copyright 2008 Xilinx Inc.
+*       All rights reserved.
+*
+*****************************************************************************/
+/****************************************************************************/
+/**
+*
+* @file xps2_intr.c
+*
+* This file contains the functions that are related to interrupt processing
+* for the PS/2 driver.
+*
+* <pre>
+* MODIFICATION HISTORY:
+*
+* Ver   Who      Date     Changes
+* ----- ------   -------- -----------------------------------------------
+* 1.00a sv/sdm   01/25/08 First release
+*
+* </pre>
+*
+*****************************************************************************/
+/***************************** Include Files ********************************/
+
+#include "xps2.h"
+
+/************************** Constant Definitions ****************************/
+
+/**************************** Type Definitions ******************************/
+
+/***************** Macros (Inline Functions) Definitions ********************/
+
+/************************** Variable Definitions ****************************/
+
+/************************** Function Prototypes *****************************/
+
+extern u32 XPs2_SendBuffer(XPs2 *InstancePtr);
+extern u32 XPs2_ReceiveBuffer(XPs2 *InstancePtr);
+
+/****************************************************************************/
+/**
+*
+* This function sets the handler that will be called when an interrupt
+* occurs in the driver. The purpose of the handler is to allow application
+* specific processing to be performed.
+*
+* @param	InstancePtr is a pointer to the XPs2 instance to be worked on.
+* @param	FuncPtr is the pointer to the callback function.
+* @param	CallBackRef is the upper layer callback reference passed back
+*		when the callback function is invoked.
+*
+* @return	None.
+*
+* @note
+*
+* There is no assert on the CallBackRef since the driver doesn't know what it
+* is (nor should it)
+*
+*****************************************************************************/
+void XPs2_SetHandler(XPs2 *InstancePtr, XPs2_Handler FuncPtr,
+					 void *CallBackRef)
+{
+	/*
+	 * Assert validates the input arguments
+	 * CallBackRef not checked, no way to know what is valid
+	 */
+	XASSERT_VOID(InstancePtr != NULL);
+	XASSERT_VOID(FuncPtr != NULL);
+	XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);
+
+	InstancePtr->Handler = FuncPtr;
+	InstancePtr->CallBackRef = CallBackRef;
+}
+
+/****************************************************************************/
+/**
+*
+* This function is the interrupt handler for the PS/2 driver.
+* It must be connected to an interrupt system by the user such that it is
+* called when an interrupt for any PS/2 port occurs. This function does
+* not save or restore the processor context such that the user must
+* ensure this occurs.
+*
+* @param	InstancePtr contains a pointer to the instance of the PS/2 port
+*		that the interrupt is for.
+*
+* @return	None.
+*
+* @note		None.
+*
+******************************************************************************/
+void XPs2_IntrHandler(XPs2 *InstancePtr)
+{
+	u32 IntrStatus;
+
+	XASSERT_VOID(InstancePtr != NULL);
+
+	/*
+	 * Read the interrupt status register to determine which
+	 * interrupt is active.
+	 */
+	IntrStatus = XPs2_IntrGetStatus(InstancePtr);
+
+	if (IntrStatus & (XPS2_IPIXR_RX_ERR | XPS2_IPIXR_RX_OVF)) {
+
+		/*
+		 * Call the application handler with the error code
+		 */
+		InstancePtr->Handler(InstancePtr->CallBackRef,
+			IntrStatus & (XPS2_IPIXR_RX_ERR | XPS2_IPIXR_RX_OVF),
+			InstancePtr->ReceiveBuffer.RequestedBytes -
+			InstancePtr->ReceiveBuffer.RemainingBytes);
+	}
+
+
+	if (IntrStatus & (XPS2_IPIXR_TX_NOACK | XPS2_IPIXR_WDT_TOUT)) {
+
+		/*
+		 * Call the application handler with the error code
+		 */
+		InstancePtr->Handler(InstancePtr->CallBackRef,
+			IntrStatus & (XPS2_IPIXR_TX_NOACK |
+					XPS2_IPIXR_WDT_TOUT),
+			InstancePtr->SendBuffer.RequestedBytes -
+			InstancePtr->SendBuffer.RemainingBytes);
+	}
+
+	if (IntrStatus & XPS2_IPIXR_RX_FULL) {
+
+		/*
+		 * If there are bytes still to be received in the specified
+		 * buffer go ahead and receive them
+		 */
+		if (InstancePtr->ReceiveBuffer.RemainingBytes != 0) {
+				XPs2_ReceiveBuffer(InstancePtr);
+		}
+
+		/*
+		 * If the last byte of a message was received then call the
+		 * application handler, this code should not use an else from
+		 * the previous check of the number of bytes to receive because
+		 * the call to receive the buffer updates the bytes to receive
+		 */
+		if (InstancePtr->ReceiveBuffer.RemainingBytes == 0) {
+				InstancePtr->Handler(InstancePtr->CallBackRef,
+				    XPS2_IPIXR_RX_FULL,
+				    InstancePtr->ReceiveBuffer.RequestedBytes -
+				    InstancePtr->ReceiveBuffer.RemainingBytes);
+		}
+	}
+
+	if (IntrStatus & XPS2_IPIXR_TX_ACK) {
+
+		/*
+		 * If there are no bytes to be sent from the specified buffer
+		 * then disable the transmit interrupt
+		 */
+		if (InstancePtr->SendBuffer.RemainingBytes == 0) {
+			XPs2_IntrDisable(InstancePtr, XPS2_IPIXR_TX_ACK);
+
+		/*
+		 * Call the application handler to indicate the data has been
+		 * sent
+		 */
+		InstancePtr->Handler(InstancePtr->CallBackRef,
+					XPS2_IPIXR_TX_ACK,
+					InstancePtr->SendBuffer.RequestedBytes -
+					InstancePtr->SendBuffer.RemainingBytes);
+		}
+
+		/*
+		 * Otherwise there is still more data to send in the specified
+		 * buffer so go ahead and send it
+		 */
+		else {
+			XPs2_SendBuffer(InstancePtr);
+		}
+
+	}
+
+	/*
+	 * Clear the Interrupt Status Register
+	 */
+	XPs2_IntrClear(InstancePtr, IntrStatus);
+
+}
+
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_l.c b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_l.c
new file mode 100644
index 0000000..f5db6bf
--- /dev/null
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_l.c
@@ -0,0 +1,99 @@
+/* $Id: xps2_l.c,v 1.1.2.1 2008/02/20 13:15:53 svemula Exp $ */
+/******************************************************************************
+*
+*       XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
+*       AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
+*       SOLUTIONS FOR XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE,
+*       OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
+*       APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
+*       THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
+*       AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
+*       FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY
+*       WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
+*       IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
+*       REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
+*       INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*       FOR A PARTICULAR PURPOSE.
+*
+*       (c) Copyright 2008 Xilinx Inc.
+*       All rights reserved.
+*
+******************************************************************************/
+/*****************************************************************************/
+/**
+*
+* @file xps2_l.c
+*
+* This file contains low-level driver functions that can be used to access the
+* device.  The user should refer to the hardware device specification for more
+* details of the device operation.
+*
+* <pre>
+* MODIFICATION HISTORY:
+*
+* Ver   Who      Date     Changes
+* ----- ------   -------- -----------------------------------------------
+* 1.00a sv/sdm   01/25/08 First release
+*
+* </pre>
+*
+******************************************************************************/
+
+/***************************** Include Files *********************************/
+
+#include "xps2_l.h"
+
+/************************** Constant Definitions *****************************/
+
+/**************************** Type Definitions *******************************/
+
+/***************** Macros (Inline Functions) Definitions *********************/
+
+/************************** Function Prototypes ******************************/
+
+/************************** Variable Definitions *****************************/
+
+/****************************************************************************/
+/**
+*
+* This function sends a data byte to PS/2. This function operates in the
+* polling mode and blocks until the data has been put into the Transmit
+* Data register.
+*
+* @param	BaseAddress contains the base address of the PS/2 port.
+* @param	Data contains the data byte to be sent.
+*
+* @return	None.
+*
+* @note		None.
+*
+*****************************************************************************/
+void XPs2_SendByte(u32 BaseAddress, u8 Data) {
+
+	while (!XPs2_IsTxEmpty(BaseAddress)) {
+	}
+
+	XPs2_WriteReg(BaseAddress, XPS2_TX_DATA_OFFSET, Data);
+}
+
+/****************************************************************************/
+/**
+*
+* This function receives a byte from PS/2. It operates in the polling mode
+* and blocks until a byte of data is received.
+*
+* @param	BaseAddress contains the base address of the PS/2 port.
+*
+* @return	The data byte received by PS/2.
+*
+* @note		None.
+*
+*****************************************************************************/
+u32 XPs2_RecvByte(u32 BaseAddress)
+{
+	while (!XPs2_IsRxFull(BaseAddress)) {
+	}
+
+	return XPs2_ReadReg(BaseAddress, XPS2_RX_DATA_OFFSET);
+
+}
diff --git a/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_l.h b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_l.h
new file mode 100644
index 0000000..e7159aa
--- /dev/null
+++ b/software/linux-2.6.x-petalogix/drivers/input/serio/xilinx_ps2/xps2_l.h
@@ -0,0 +1,233 @@
+/* $Id: xps2_l.h,v 1.1.2.1 2008/02/20 13:15:53 svemula Exp $ */
+/******************************************************************************
+*
+*       XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
+*       AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
+*       SOLUTIONS FOR XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE,
+*       OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
+*       APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
+*       THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
+*       AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
+*       FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY
+*       WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
+*       IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
+*       REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
+*       INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*       FOR A PARTICULAR PURPOSE.
+*
+*       (c) Copyright 2008 Xilinx Inc.
+*       All rights reserved.
+*
+******************************************************************************/
+/*****************************************************************************/
+/**
+*
+* @file xps2_l.h
+*
+* This header file contains identifiers and low-level driver functions (or
+* macros) that can be used to access the device. The user should refer to the
+* hardware device specification for more details of the device operation.
+* High-level driver functions are defined in xps2.h.
+*
+* <pre>
+* MODIFICATION HISTORY:
+*
+* Ver   Who      Date     Changes
+* ----- ------   -------- -----------------------------------------------
+* 1.00a sv/sdm   01/25/08 First release
+* </pre>
+*
+******************************************************************************/
+#ifndef XPS2_L_H /* prevent circular inclusions */
+#define XPS2_L_H /* by using protection macros */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************** Include Files ********************************/
+
+#include "xbasic_types.h"
+#include "xio.h"
+
+/************************** Constant Definitions ****************************/
+
+/**
+ * PS/2 register offsets
+ */
+/** @name Register Map
+ *
+ * Register offsets for the XPs2 device.
+ * @{
+ */
+#define XPS2_SRST_OFFSET	0x00000000 /**< Software Reset register */
+#define XPS2_STATUS_OFFSET	0x00000004 /**< Status register */
+#define XPS2_RX_DATA_OFFSET	0x00000008 /**< Receive Data register */
+#define XPS2_TX_DATA_OFFSET	0x0000000C /**< Transmit Data register */
+#define XPS2_GIER_OFFSET	0x0000002C /**< Global Interrupt Enable reg */
+#define XPS2_IPISR_OFFSET	0x00000030 /**< Interrupt Status register */
+#define XPS2_IPIER_OFFSET	0x00000038 /**< Interrupt Enable register */
+
+/* @} */
+
+/** @name Reset Register Bit Definitions
+ *
+ * @{
+ */
+#define XPS2_SRST_RESET		0x0000000A /**< Software Reset  */
+
+/* @} */
+
+
+/** @name Status Register Bit Positions
+ *
+ * @{
+ */
+#define XPS2_STATUS_RX_FULL	0x00000001 /**< Receive Full  */
+#define XPS2_STATUS_TX_FULL	0x00000002 /**< Transmit Full  */
+
+/* @} */
+
+
+/** @name PS/2 Device Interrupt Status/Enable Registers
+ *
+ * <b> Interrupt Status Register (IPISR) </b>
+ *
+ * This register holds the interrupt status flags for the PS/2 device.
+ *
+ * <b> Interrupt Enable Register (IPIER) </b>
+ *
+ * This register is used to enable interrupt sources for the PS/2 device.
+ * Writing a '1' to a bit in this register enables the corresponding Interrupt.
+ * Writing a '0' to a bit in this register disables the corresponding Interrupt.
+ *
+ * ISR/IER registers have the same bit definitions and are only defined once.
+ * @{
+ */
+#define XPS2_IPIXR_WDT_TOUT	0x00000001 /**< Watchdog Timeout Interrupt */
+#define XPS2_IPIXR_TX_NOACK	0x00000002 /**< Transmit No ACK Interrupt */
+#define XPS2_IPIXR_TX_ACK	0x00000004 /**< Transmit ACK (Data) Interrupt */
+#define XPS2_IPIXR_RX_OVF	0x00000008 /**< Receive Overflow Interrupt */
+#define XPS2_IPIXR_RX_ERR	0x00000010 /**< Receive Error Interrupt */
+#define XPS2_IPIXR_RX_FULL	0x00000020 /**< Receive Data Interrupt */
+
+/**
+ * Mask for all the Transmit Interrupts
+ */
+#define XPS2_IPIXR_TX_ALL	(XPS2_IPIXR_TX_NOACK | XPS2_IPIXR_TX_ACK)
+
+/**
+ * Mask for all the Receive Interrupts
+ */
+#define XPS2_IPIXR_RX_ALL	(XPS2_IPIXR_RX_OVF | XPS2_IPIXR_RX_ERR |  \
+					XPS2_IPIXR_RX_FULL)
+
+/**
+ * Mask for all the Interrupts
+ */
+#define XPS2_IPIXR_ALL		(XPS2_IPIXR_TX_ALL | XPS2_IPIXR_RX_ALL |  \
+					XPS2_IPIXR_WDT_TOUT)
+/* @} */
+
+
+/**
+ * @name Global Interrupt Enable Register (GIER) mask(s)
+ * @{
+ */
+#define XPS2_GIER_GIE_MASK	0x80000000 /**< Global interrupt enable */
+/*@}*/
+
+/**************************** Type Definitions ******************************/
+
+/***************** Macros (Inline Functions) Definitions ********************/
+
+#define XPs2_In32  XIo_In32
+#define XPs2_Out32 XIo_Out32
+
+/****************************************************************************/
+/**
+* Read from the specified PS/2 device register.
+*
+* @param	BaseAddress contains the base address of the device.
+* @param	RegOffset contains the offset from the 1st register of the
+*		device to select the specific register.
+*
+* @return	The value read from the register.
+*
+* @note		C-Style signature:
+*		u32 XPs2_ReadReg(u32 BaseAddress, u32 RegOffset);
+*
+******************************************************************************/
+#define XPs2_ReadReg(BaseAddress, RegOffset) \
+	XPs2_In32((BaseAddress) + (RegOffset))
+
+/***************************************************************************/
+/**
+* Write to the specified PS/2 device register.
+*
+* @param	BaseAddress contains the base address of the device.
+* @param	RegOffset contains the offset from the 1st register of the
+*		device to select the specific register.
+* @param	RegisterValue is the value to be written to the register.
+*
+* @return	None.
+*
+* @note		C-Style signature:
+*		void XPs2_WriteReg(u32 BaseAddress, u32 RegOffset,
+*				u32 RegisterValue);
+******************************************************************************/
+#define XPs2_WriteReg(BaseAddress, RegOffset, RegisterValue) \
+	XPs2_Out32((BaseAddress) + (RegOffset), (RegisterValue))
+
+/****************************************************************************/
+/**
+* This macro checks if the receiver is full (There is data in the receive data
+* register).
+*
+* @param	BaseAddress contains the base address of the device.
+*
+* @return
+*		- TRUE if there is receive data.
+*		- FALSE if there is no receive data.
+*
+* @note		C-Style signature:
+*		int XPs2_IsRxFull(u32 BaseAddress);
+*
+******************************************************************************/
+#define XPs2_IsRxFull(BaseAddress) 					\
+	(((XPs2_ReadReg(BaseAddress, XPS2_STATUS_OFFSET) & 		\
+			XPS2_STATUS_RX_FULL)) ? TRUE : FALSE)
+
+/****************************************************************************/
+/**
+* This macro checks if the transmitter is empty.
+*
+* @param	BaseAddress contains the base address of the device.
+*
+* @return
+*		- TRUE if the transmitter is not full and data can be sent.
+*		- FALSE if the transmitter is full.
+*
+* @note		C-Style signature:
+*		int XPs2_IsTxEmpty(u32 BaseAddress);
+*
+******************************************************************************/
+#define XPs2_IsTxEmpty(BaseAddress) 				     \
+	((XPs2_ReadReg(BaseAddress, XPS2_STATUS_OFFSET ) & 		     \
+			XPS2_STATUS_TX_FULL) ? FALSE: TRUE)
+
+/************************** Variable Definitions ****************************/
+
+/************************** Function Prototypes *****************************/
+
+void XPs2_SendByte(u32 BaseAddress, u8 Data);
+u32 XPs2_RecvByte(u32 BaseAddress);
+
+/****************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
-------------------- snip ----------------

Aws Ismail <aws.ismail@xxxxxxxxx> wrote:
> It looks like all errors are stemming out from the lack of "of_device.h" and
> "of_platform.h" header files which are related to the PPC architecture.
> 
> Any ideas how I can fix that?
> 
> Aws\
> 
> On Thu, Jul 2, 2009 at 4:15 PM, Aws Ismail <aws.ismail@xxxxxxxxx> wrote:
> 
> > Hi Michal,
> >
> >
> >> I haven't tested it but I don't expect any big troubles. If you can please
> >> try it and let me know.
> >>
> >> Thanks,
> >> Michal
> >>
> >
> >
> > Just wanted to let you know that I am getting errors while compiling the
> > XPS_PS2 driver.
> >
> > *  CC      drivers/input/serio/xilinx_ps2.o
> >   LD      fs/ramfs/built-in.o
> >   CC      lib/random32.o
> > drivers/input/serio/xilinx_ps2.c:26:29: linux/of_device.h: No such file or
> > directory
> > drivers/input/serio/xilinx_ps2.c:27:31: linux/of_platform.h: No such file
> > or directory
> > drivers/input/serio/xilinx_ps2.c:235: warning: "struct of_device" declared
> > inside parameter list
> > drivers/input/serio/xilinx_ps2.c:235: warning: its scope is only this
> > definition or declaration, which is probably not what you want
> > drivers/input/serio/xilinx_ps2.c: In function `xps2_of_probe':
> > drivers/input/serio/xilinx_ps2.c:241: error: dereferencing pointer to
> > incomplete type
> > drivers/input/serio/xilinx_ps2.c:245: error: dereferencing pointer to
> > incomplete type
> > drivers/input/serio/xilinx_ps2.c:249: warning: implicit declaration of
> > function `of_address_to_resource'
> > drivers/input/serio/xilinx_ps2.c:249: error: dereferencing pointer to
> > incomplete type
> > drivers/input/serio/xilinx_ps2.c:256: warning: implicit declaration of
> > function `of_irq_to_resource'
> > drivers/input/serio/xilinx_ps2.c:256: error: dereferencing pointer to
> > incomplete type
> >   CC      net/core/scm.o
> > drivers/input/serio/xilinx_ps2.c: At top level:
> > drivers/input/serio/xilinx_ps2.c:334: warning: "struct of_device" declared
> > inside parameter list
> > drivers/input/serio/xilinx_ps2.c: In function `xps2_of_remove':
> > drivers/input/serio/xilinx_ps2.c:336: error: dereferencing pointer to
> > incomplete type
> > drivers/input/serio/xilinx_ps2.c:344: error: dereferencing pointer to
> > incomplete type
> > drivers/input/serio/xilinx_ps2.c: At top level:
> > drivers/input/serio/xilinx_ps2.c:363: error: variable `xps2_of_driver' has
> > initializer but incomplete type
> > drivers/input/serio/xilinx_ps2.c:364: error: unknown field `name' specified
> > in initializer
> > drivers/input/serio/xilinx_ps2.c:364: warning: excess elements in struct
> > initializer
> > drivers/input/serio/xilinx_ps2.c:364: warning: (near initialization for
> > `xps2_of_driver')
> > drivers/input/serio/xilinx_ps2.c:365: error: unknown field `match_table'
> > specified in initializer
> > drivers/input/serio/xilinx_ps2.c:365: warning: excess elements in struct
> > initializer
> > drivers/input/serio/xilinx_ps2.c:365: warning: (near initialization for
> > `xps2_of_driver')
> > drivers/input/serio/xilinx_ps2.c:366: error: unknown field `probe'
> > specified in initializer
> > drivers/input/serio/xilinx_ps2.c:366: warning: excess elements in struct
> > initializer
> > drivers/input/serio/xilinx_ps2.c:366: warning: (near initialization for
> > `xps2_of_driver')
> > drivers/input/serio/xilinx_ps2.c:367: error: unknown field `remove'
> > specified in initializer
> > drivers/input/serio/xilinx_ps2.c:367: warning: excess elements in struct
> > initializer
> > drivers/input/serio/xilinx_ps2.c:367: warning: (near initialization for
> > `xps2_of_driver')
> > drivers/input/serio/xilinx_ps2.c: In function `xps2_init':
> > drivers/input/serio/xilinx_ps2.c:372: warning: implicit declaration of
> > function `of_register_platform_driver'
> > drivers/input/serio/xilinx_ps2.c: In function `xps2_cleanup':
> > drivers/input/serio/xilinx_ps2.c:377: warning: implicit declaration of
> > function `of_unregister_platform_driver'
> > drivers/input/serio/xilinx_ps2.c: At top level:
> > drivers/input/serio/xilinx_ps2.c:363: error: storage size of
> > `xps2_of_driver' isn't known
> > make[3]: *** [drivers/input/serio/xilinx_ps2.o] Error 1
> > make[2]: *** [drivers/input/serio] Error 2
> > make[1]: *** [drivers] Error 2
> > *
> >
> > Regards.
> >
> >
> > On Mon, Jun 22, 2009 at 11:15 PM, Michal Simek <michal.simek@xxxxxxxxxxxxx
> > > wrote:
> >
> >>
> >>
> >> Aws Ismail wrote:
> >> > Hi Pablo,
> >> >
> >> > I was sifting through the /drivers/input/ list on the git repository and
> >> > I have found the driver for the xps_ps2 IP core. This can be found here:
> >> >
> >> >
> >> http://git.monstr.eu/git/gitweb.cgi?p=linux-2.6-microblaze.git;a=history;f=drivers/input/serio/xilinx_ps2.c;h=ebb22f88c8426bdd3cebff9e2f822d0b7412ade7;hb=HEAD
> >> >
> >> > Its been added by John Linn from Xilinx on July of 2008. As part of my
> >> > project of migrating Petalinux to the XUPV2P board, I want to eventually
> >> > use a PS/2 keyboard attached to the PS/2 port of the board. My EDK
> >> > project is microblaze-based and uses the XPS_PS2 core. However, looking
> >> > at the Kconfig entry of the XPS_PS2 driver, john linn mentions that its
> >> > for PPC, I am new to all of this so do you know if it will work with a
> >> > microblaze-based design instead?
> >>
> >> I haven't tested it but I don't expect any big troubles. If you can please
> >> try it and let me know.
> >>
> >> Thanks,
> >> Michal
> >>
> >> >
> >> > By the way, I also checked the SVN trunk for Petalinux here (username:
> >> > guest, no password):
> >> >
> >> >
> >> https://developer.petalogix.com/pr/internal/petalinux/trunk/software/linux-2.6.x-petalogix/drivers/input/serio/
> >> >
> >> > and the driver does not exist.
> >> >
> >> > If anyone has tried using this driver, would you please let me know if
> >> > it works with a microblaze-based EDK project.
> >> >
> >> > Best Regards.
> >> >
> >> > Aws\
> >> >
> >> > On Fri, Apr 3, 2009 at 2:41 AM, <pcolodron@xxxxxxxx
> >> > <mailto:pcolodron@xxxxxxxx>> wrote:
> >> >
> >> >     Hi all,
> >> >
> >> >     I am actually working with a ML405 board and microblaze. I have
> >> >     succesfully ported a uClinux system with framebuffer support. My
> >> >     next aim is to work with a PS/2 mouse and a PS/2 keyboard.
> >> >
> >> >     I guessed I had to activate 'Device Drivers'->'Input device
> >> >     support'->'Mouse interface' and 'Provide legacy /dev/psaux'.
> >> >
> >> >     I also activated 'Device Drivers'->'Input device
> >> >     support'->'Mouse'->'PS/2 Mouse' and also 'AT Keyboard'.
> >> >
> >> >     However, if I do this I do not have any /dev/psaux in my system and
> >> >     neither I have /dev/input. Is this normal?
> >> >
> >> >     'i8042 PC keyboard controller' is activated as well but I believe
> >> >     that, in my case, I need a specific Xilinx PS/2 driver, am I right?
> >> >
> >> >     I have been looking at ../drivers/input files and, if I am not
> >> >     mistaken, mousedev.c should register the devices /dev/psaux and
> >> >     dev/mice. When the kernel boots, I receive 'mice: PS/2 mouse device
> >> >     common for all mice'.
> >> >
> >> >     Could anyone help to understand the connection beeween these drivers
> >> >     and devices? Do you know any place where I could find a driver for
> >> >     Xilinx PS/2?
> >> >
> >> >     Thanks a lot for your help.
> >> >
> >> >     Kind regards,
> >> >
> >> >     Pablo Colodron
> >> >
> >> >     ___________________________
> >> >     microblaze-uclinux mailing list
> >> >     microblaze-uclinux@xxxxxxxxxxxxxx
> >> >     <mailto:microblaze-uclinux@xxxxxxxxxxxxxx>
> >> >     Project Home Page :
> >> >     http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux<http://www.itee.uq.edu.au/%7Ejwilliams/mblaze-uclinux>
> >> >     <http://www.itee.uq.edu.au/%7Ejwilliams/mblaze-uclinux>
> >> >     Mailing List Archive :
> >> >     http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/<http://www.itee.uq.edu.au/%7Elistarch/microblaze-uclinux/>
> >> >     <http://www.itee.uq.edu.au/%7Elistarch/microblaze-uclinux/>
> >> >
> >> >
> >> >
> >>
> >> --
> >> Michal Simek, Ing. (M.Eng)
> >> PetaLogix - Linux Solutions for a Reconfigurable World
> >> w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663
> >> ___________________________
> >> microblaze-uclinux mailing list
> >> microblaze-uclinux@xxxxxxxxxxxxxx
> >> Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux<http://www.itee.uq.edu.au/%7Ejwilliams/mblaze-uclinux>
> >> Mailing List Archive :
> >> http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/<http://www.itee.uq.edu.au/%7Elistarch/microblaze-uclinux/>
> >>
> >>
> >
> >
> > --
> > Aws Ismail, BASc. EE
> >
> > MASc. Candidate
> > Mechatronic Systems Engineering
> > Simon Fraser University
> > 250-13450 102 Avenue
> > Surrey BC V3T 0A3
> >
> > Tel (Cell): 778-889-0526
> > ---------
> >
> 
> 
> 
> -- 
> Aws Ismail, BASc. EE
> 
> MASc. Candidate
> Mechatronic Systems Engineering
> Simon Fraser University
> 250-13450 102 Avenue
> Surrey BC V3T 0A3
> 
> Tel (Cell): 778-889-0526
> ---------

-- 
Dr. Johann Pfefferl   ------------   mailto j.pfefferl at eubus dot net
Eubus GmbH          http://www.eubus.net ++++ http://www.ebmhydraxc.com
Gollierstr. 70
D-80339 Muenchen
Phone: +49 (0)89 45 22 578-67     Fax: +49 (0)89 45 22 578-55
Registergericht Muenchen HRB 145 336, Ust-Id Nr. DE 225 783 933
Geschaeftsfuehrer: Volker Ulrich
==
 -o)   A computer program does what you tell it to do,
 /\\        not what you want it to do.               
_\_v-                                                 
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/