xref: /linux/drivers/input/serio/xilinx_ps2.c (revision ce841b945b84bf7360aa32e60ddaa1e9ccae3e96)
11191828fSJohn Linn /*
21191828fSJohn Linn  * Xilinx XPS PS/2 device driver
31191828fSJohn Linn  *
41191828fSJohn Linn  * (c) 2005 MontaVista Software, Inc.
51191828fSJohn Linn  * (c) 2008 Xilinx, Inc.
61191828fSJohn Linn  *
71191828fSJohn Linn  * This program is free software; you can redistribute it and/or modify it
81191828fSJohn Linn  * under the terms of the GNU General Public License as published by the
91191828fSJohn Linn  * Free Software Foundation; either version 2 of the License, or (at your
101191828fSJohn Linn  * option) any later version.
111191828fSJohn Linn  *
121191828fSJohn Linn  * You should have received a copy of the GNU General Public License along
131191828fSJohn Linn  * with this program; if not, write to the Free Software Foundation, Inc.,
141191828fSJohn Linn  * 675 Mass Ave, Cambridge, MA 02139, USA.
151191828fSJohn Linn  */
161191828fSJohn Linn 
171191828fSJohn Linn 
181191828fSJohn Linn #include <linux/module.h>
191191828fSJohn Linn #include <linux/serio.h>
201191828fSJohn Linn #include <linux/interrupt.h>
211191828fSJohn Linn #include <linux/errno.h>
221191828fSJohn Linn #include <linux/init.h>
231191828fSJohn Linn #include <linux/list.h>
241191828fSJohn Linn #include <linux/io.h>
251191828fSJohn Linn 
261191828fSJohn Linn #include <linux/of_device.h>
271191828fSJohn Linn #include <linux/of_platform.h>
281191828fSJohn Linn 
291191828fSJohn Linn #define DRIVER_NAME		"xilinx_ps2"
301191828fSJohn Linn 
311191828fSJohn Linn /* Register offsets for the xps2 device */
321191828fSJohn Linn #define XPS2_SRST_OFFSET	0x00000000 /* Software Reset register */
331191828fSJohn Linn #define XPS2_STATUS_OFFSET	0x00000004 /* Status register */
341191828fSJohn Linn #define XPS2_RX_DATA_OFFSET	0x00000008 /* Receive Data register */
351191828fSJohn Linn #define XPS2_TX_DATA_OFFSET	0x0000000C /* Transmit Data register */
361191828fSJohn Linn #define XPS2_GIER_OFFSET	0x0000002C /* Global Interrupt Enable reg */
371191828fSJohn Linn #define XPS2_IPISR_OFFSET	0x00000030 /* Interrupt Status register */
381191828fSJohn Linn #define XPS2_IPIER_OFFSET	0x00000038 /* Interrupt Enable register */
391191828fSJohn Linn 
401191828fSJohn Linn /* Reset Register Bit Definitions */
411191828fSJohn Linn #define XPS2_SRST_RESET		0x0000000A /* Software Reset  */
421191828fSJohn Linn 
431191828fSJohn Linn /* Status Register Bit Positions */
441191828fSJohn Linn #define XPS2_STATUS_RX_FULL	0x00000001 /* Receive Full  */
451191828fSJohn Linn #define XPS2_STATUS_TX_FULL	0x00000002 /* Transmit Full  */
461191828fSJohn Linn 
471191828fSJohn Linn /* Bit definitions for ISR/IER registers. Both the registers have the same bit
481191828fSJohn Linn  * definitions and are only defined once. */
491191828fSJohn Linn #define XPS2_IPIXR_WDT_TOUT	0x00000001 /* Watchdog Timeout Interrupt */
501191828fSJohn Linn #define XPS2_IPIXR_TX_NOACK	0x00000002 /* Transmit No ACK Interrupt */
511191828fSJohn Linn #define XPS2_IPIXR_TX_ACK	0x00000004 /* Transmit ACK (Data) Interrupt */
521191828fSJohn Linn #define XPS2_IPIXR_RX_OVF	0x00000008 /* Receive Overflow Interrupt */
531191828fSJohn Linn #define XPS2_IPIXR_RX_ERR	0x00000010 /* Receive Error Interrupt */
541191828fSJohn Linn #define XPS2_IPIXR_RX_FULL	0x00000020 /* Receive Data Interrupt */
551191828fSJohn Linn 
561191828fSJohn Linn /* Mask for all the Transmit Interrupts */
571191828fSJohn Linn #define XPS2_IPIXR_TX_ALL	(XPS2_IPIXR_TX_NOACK | XPS2_IPIXR_TX_ACK)
581191828fSJohn Linn 
591191828fSJohn Linn /* Mask for all the Receive Interrupts */
601191828fSJohn Linn #define XPS2_IPIXR_RX_ALL	(XPS2_IPIXR_RX_OVF | XPS2_IPIXR_RX_ERR |  \
611191828fSJohn Linn 				 XPS2_IPIXR_RX_FULL)
621191828fSJohn Linn 
631191828fSJohn Linn /* Mask for all the Interrupts */
641191828fSJohn Linn #define XPS2_IPIXR_ALL		(XPS2_IPIXR_TX_ALL | XPS2_IPIXR_RX_ALL |  \
651191828fSJohn Linn 				 XPS2_IPIXR_WDT_TOUT)
661191828fSJohn Linn 
671191828fSJohn Linn /* Global Interrupt Enable mask */
681191828fSJohn Linn #define XPS2_GIER_GIE_MASK	0x80000000
691191828fSJohn Linn 
701191828fSJohn Linn struct xps2data {
711191828fSJohn Linn 	int irq;
721191828fSJohn Linn 	spinlock_t lock;
731191828fSJohn Linn 	void __iomem *base_address;	/* virt. address of control registers */
74b4a3ac9aSJohn Linn 	unsigned int flags;
751191828fSJohn Linn 	struct serio serio;		/* serio */
761191828fSJohn Linn };
771191828fSJohn Linn 
781191828fSJohn Linn /************************************/
791191828fSJohn Linn /* XPS PS/2 data transmission calls */
801191828fSJohn Linn /************************************/
811191828fSJohn Linn 
82b4a3ac9aSJohn Linn /**
83b4a3ac9aSJohn Linn  * xps2_recv() - attempts to receive a byte from the PS/2 port.
84b4a3ac9aSJohn Linn  * @drvdata:	pointer to ps2 device private data structure
85b4a3ac9aSJohn Linn  * @byte:	address where the read data will be copied
86b4a3ac9aSJohn Linn  *
87b4a3ac9aSJohn Linn  * If there is any data available in the PS/2 receiver, this functions reads
88b4a3ac9aSJohn Linn  * the data, otherwise it returns error.
891191828fSJohn Linn  */
901191828fSJohn Linn static int xps2_recv(struct xps2data *drvdata, u8 *byte)
911191828fSJohn Linn {
921191828fSJohn Linn 	u32 sr;
931191828fSJohn Linn 	int status = -1;
941191828fSJohn Linn 
951191828fSJohn Linn 	/* If there is data available in the PS/2 receiver, read it */
961191828fSJohn Linn 	sr = in_be32(drvdata->base_address + XPS2_STATUS_OFFSET);
971191828fSJohn Linn 	if (sr & XPS2_STATUS_RX_FULL) {
981191828fSJohn Linn 		*byte = in_be32(drvdata->base_address + XPS2_RX_DATA_OFFSET);
991191828fSJohn Linn 		status = 0;
1001191828fSJohn Linn 	}
1011191828fSJohn Linn 
1021191828fSJohn Linn 	return status;
1031191828fSJohn Linn }
1041191828fSJohn Linn 
1051191828fSJohn Linn /*********************/
1061191828fSJohn Linn /* Interrupt handler */
1071191828fSJohn Linn /*********************/
1081191828fSJohn Linn static irqreturn_t xps2_interrupt(int irq, void *dev_id)
1091191828fSJohn Linn {
1101191828fSJohn Linn 	struct xps2data *drvdata = dev_id;
1111191828fSJohn Linn 	u32 intr_sr;
1121191828fSJohn Linn 	u8 c;
1131191828fSJohn Linn 	int status;
1141191828fSJohn Linn 
1151191828fSJohn Linn 	/* Get the PS/2 interrupts and clear them */
1161191828fSJohn Linn 	intr_sr = in_be32(drvdata->base_address + XPS2_IPISR_OFFSET);
1171191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPISR_OFFSET, intr_sr);
1181191828fSJohn Linn 
1191191828fSJohn Linn 	/* Check which interrupt is active */
1201191828fSJohn Linn 	if (intr_sr & XPS2_IPIXR_RX_OVF)
121b4a3ac9aSJohn Linn 		dev_warn(drvdata->serio.dev.parent, "receive overrun error\n");
1221191828fSJohn Linn 
1231191828fSJohn Linn 	if (intr_sr & XPS2_IPIXR_RX_ERR)
124b4a3ac9aSJohn Linn 		drvdata->flags |= SERIO_PARITY;
1251191828fSJohn Linn 
1261191828fSJohn Linn 	if (intr_sr & (XPS2_IPIXR_TX_NOACK | XPS2_IPIXR_WDT_TOUT))
127b4a3ac9aSJohn Linn 		drvdata->flags |= SERIO_TIMEOUT;
1281191828fSJohn Linn 
1291191828fSJohn Linn 	if (intr_sr & XPS2_IPIXR_RX_FULL) {
130b4a3ac9aSJohn Linn 		status = xps2_recv(drvdata, &c);
1311191828fSJohn Linn 
1321191828fSJohn Linn 		/* Error, if a byte is not received */
1331191828fSJohn Linn 		if (status) {
134b4a3ac9aSJohn Linn 			dev_err(drvdata->serio.dev.parent,
135b4a3ac9aSJohn Linn 				"wrong rcvd byte count (%d)\n", status);
1361191828fSJohn Linn 		} else {
137b4a3ac9aSJohn Linn 			serio_interrupt(&drvdata->serio, c, drvdata->flags);
138b4a3ac9aSJohn Linn 			drvdata->flags = 0;
1391191828fSJohn Linn 		}
1401191828fSJohn Linn 	}
1411191828fSJohn Linn 
1421191828fSJohn Linn 	return IRQ_HANDLED;
1431191828fSJohn Linn }
1441191828fSJohn Linn 
1451191828fSJohn Linn /*******************/
1461191828fSJohn Linn /* serio callbacks */
1471191828fSJohn Linn /*******************/
1481191828fSJohn Linn 
149b4a3ac9aSJohn Linn /**
150b4a3ac9aSJohn Linn  * sxps2_write() - sends a byte out through the PS/2 port.
151b4a3ac9aSJohn Linn  * @pserio:	pointer to the serio structure of the PS/2 port
152b4a3ac9aSJohn Linn  * @c:		data that needs to be written to the PS/2 port
153b4a3ac9aSJohn Linn  *
154b4a3ac9aSJohn Linn  * This function checks if the PS/2 transmitter is empty and sends a byte.
155b4a3ac9aSJohn Linn  * Otherwise it returns error. Transmission fails only when nothing is connected
156b4a3ac9aSJohn Linn  * to the PS/2 port. Thats why, we do not try to resend the data in case of a
157b4a3ac9aSJohn Linn  * failure.
1581191828fSJohn Linn  */
1591191828fSJohn Linn static int sxps2_write(struct serio *pserio, unsigned char c)
1601191828fSJohn Linn {
1611191828fSJohn Linn 	struct xps2data *drvdata = pserio->port_data;
1621191828fSJohn Linn 	unsigned long flags;
1631191828fSJohn Linn 	u32 sr;
1641191828fSJohn Linn 	int status = -1;
1651191828fSJohn Linn 
1661191828fSJohn Linn 	spin_lock_irqsave(&drvdata->lock, flags);
1671191828fSJohn Linn 
1681191828fSJohn Linn 	/* If the PS/2 transmitter is empty send a byte of data */
1691191828fSJohn Linn 	sr = in_be32(drvdata->base_address + XPS2_STATUS_OFFSET);
1701191828fSJohn Linn 	if (!(sr & XPS2_STATUS_TX_FULL)) {
1711191828fSJohn Linn 		out_be32(drvdata->base_address + XPS2_TX_DATA_OFFSET, c);
1721191828fSJohn Linn 		status = 0;
1731191828fSJohn Linn 	}
1741191828fSJohn Linn 
1751191828fSJohn Linn 	spin_unlock_irqrestore(&drvdata->lock, flags);
1761191828fSJohn Linn 
1771191828fSJohn Linn 	return status;
1781191828fSJohn Linn }
1791191828fSJohn Linn 
180b4a3ac9aSJohn Linn /**
181b4a3ac9aSJohn Linn  * sxps2_open() - called when a port is opened by the higher layer.
182b4a3ac9aSJohn Linn  * @pserio:	pointer to the serio structure of the PS/2 device
183b4a3ac9aSJohn Linn  *
184b4a3ac9aSJohn Linn  * This function requests irq and enables interrupts for the PS/2 device.
1851191828fSJohn Linn  */
1861191828fSJohn Linn static int sxps2_open(struct serio *pserio)
1871191828fSJohn Linn {
1881191828fSJohn Linn 	struct xps2data *drvdata = pserio->port_data;
189b4a3ac9aSJohn Linn 	int error;
190b4a3ac9aSJohn Linn 	u8 c;
1911191828fSJohn Linn 
192b4a3ac9aSJohn Linn 	error = request_irq(drvdata->irq, &xps2_interrupt, 0,
1931191828fSJohn Linn 				DRIVER_NAME, drvdata);
194b4a3ac9aSJohn Linn 	if (error) {
195b4a3ac9aSJohn Linn 		dev_err(drvdata->serio.dev.parent,
196b4a3ac9aSJohn Linn 			"Couldn't allocate interrupt %d\n", drvdata->irq);
197b4a3ac9aSJohn Linn 		return error;
1981191828fSJohn Linn 	}
1991191828fSJohn Linn 
2001191828fSJohn Linn 	/* start reception by enabling the interrupts */
2011191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_GIER_OFFSET, XPS2_GIER_GIE_MASK);
2021191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, XPS2_IPIXR_RX_ALL);
203b4a3ac9aSJohn Linn 	(void)xps2_recv(drvdata, &c);
2041191828fSJohn Linn 
2051191828fSJohn Linn 	return 0;		/* success */
2061191828fSJohn Linn }
2071191828fSJohn Linn 
208b4a3ac9aSJohn Linn /**
209b4a3ac9aSJohn Linn  * sxps2_close() - frees the interrupt.
210b4a3ac9aSJohn Linn  * @pserio:	pointer to the serio structure of the PS/2 device
211b4a3ac9aSJohn Linn  *
212b4a3ac9aSJohn Linn  * This function frees the irq and disables interrupts for the PS/2 device.
2131191828fSJohn Linn  */
2141191828fSJohn Linn static void sxps2_close(struct serio *pserio)
2151191828fSJohn Linn {
2161191828fSJohn Linn 	struct xps2data *drvdata = pserio->port_data;
2171191828fSJohn Linn 
2181191828fSJohn Linn 	/* Disable the PS2 interrupts */
2191191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_GIER_OFFSET, 0x00);
2201191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, 0x00);
2211191828fSJohn Linn 	free_irq(drvdata->irq, drvdata);
2221191828fSJohn Linn }
2231191828fSJohn Linn 
224b4a3ac9aSJohn Linn /**
225b4a3ac9aSJohn Linn  * xps2_of_probe - probe method for the PS/2 device.
226b4a3ac9aSJohn Linn  * @of_dev:	pointer to OF device structure
227b4a3ac9aSJohn Linn  * @match:	pointer to the stucture used for matching a device
228b4a3ac9aSJohn Linn  *
229b4a3ac9aSJohn Linn  * This function probes the PS/2 device in the device tree.
230b4a3ac9aSJohn Linn  * It initializes the driver data structure and the hardware.
231b4a3ac9aSJohn Linn  * It returns 0, if the driver is bound to the PS/2 device, or a negative
232b4a3ac9aSJohn Linn  * value if there is an error.
233b4a3ac9aSJohn Linn  */
234b4a3ac9aSJohn Linn static int __devinit xps2_of_probe(struct of_device *ofdev,
235b4a3ac9aSJohn Linn 				   const struct of_device_id *match)
2361191828fSJohn Linn {
237b4a3ac9aSJohn Linn 	struct resource r_irq; /* Interrupt resources */
238b4a3ac9aSJohn Linn 	struct resource r_mem; /* IO mem resources */
2391191828fSJohn Linn 	struct xps2data *drvdata;
2401191828fSJohn Linn 	struct serio *serio;
241b4a3ac9aSJohn Linn 	struct device *dev = &ofdev->dev;
242b4a3ac9aSJohn Linn 	resource_size_t remap_size, phys_addr;
243b4a3ac9aSJohn Linn 	int error;
2441191828fSJohn Linn 
245b4a3ac9aSJohn Linn 	dev_info(dev, "Device Tree Probing \'%s\'\n",
246b4a3ac9aSJohn Linn 			ofdev->node->name);
2471191828fSJohn Linn 
248b4a3ac9aSJohn Linn 	/* Get iospace for the device */
249b4a3ac9aSJohn Linn 	error = of_address_to_resource(ofdev->node, 0, &r_mem);
250b4a3ac9aSJohn Linn 	if (error) {
251b4a3ac9aSJohn Linn 		dev_err(dev, "invalid address\n");
252b4a3ac9aSJohn Linn 		return error;
253b4a3ac9aSJohn Linn 	}
254b4a3ac9aSJohn Linn 
255b4a3ac9aSJohn Linn 	/* Get IRQ for the device */
256b4a3ac9aSJohn Linn 	if (of_irq_to_resource(ofdev->node, 0, &r_irq) == NO_IRQ) {
257b4a3ac9aSJohn Linn 		dev_err(dev, "no IRQ found\n");
258b4a3ac9aSJohn Linn 		return -ENODEV;
2591191828fSJohn Linn 	}
2601191828fSJohn Linn 
2611191828fSJohn Linn 	drvdata = kzalloc(sizeof(struct xps2data), GFP_KERNEL);
2621191828fSJohn Linn 	if (!drvdata) {
2631191828fSJohn Linn 		dev_err(dev, "Couldn't allocate device private record\n");
2641191828fSJohn Linn 		return -ENOMEM;
2651191828fSJohn Linn 	}
2661191828fSJohn Linn 
2671191828fSJohn Linn 	dev_set_drvdata(dev, drvdata);
2681191828fSJohn Linn 
2691191828fSJohn Linn 	spin_lock_init(&drvdata->lock);
270b4a3ac9aSJohn Linn 	drvdata->irq = r_irq.start;
2711191828fSJohn Linn 
272b4a3ac9aSJohn Linn 	phys_addr = r_mem.start;
273*ce841b94STobias Klauser 	remap_size = resource_size(&r_mem);
274b4a3ac9aSJohn Linn 	if (!request_mem_region(phys_addr, remap_size, DRIVER_NAME)) {
275b4a3ac9aSJohn Linn 		dev_err(dev, "Couldn't lock memory region at 0x%08llX\n",
276b4a3ac9aSJohn Linn 			(unsigned long long)phys_addr);
277b4a3ac9aSJohn Linn 		error = -EBUSY;
2781191828fSJohn Linn 		goto failed1;
2791191828fSJohn Linn 	}
2801191828fSJohn Linn 
2811191828fSJohn Linn 	/* Fill in configuration data and add them to the list */
282b4a3ac9aSJohn Linn 	drvdata->base_address = ioremap(phys_addr, remap_size);
2831191828fSJohn Linn 	if (drvdata->base_address == NULL) {
284b4a3ac9aSJohn Linn 		dev_err(dev, "Couldn't ioremap memory at 0x%08llX\n",
285b4a3ac9aSJohn Linn 			(unsigned long long)phys_addr);
286b4a3ac9aSJohn Linn 		error = -EFAULT;
2871191828fSJohn Linn 		goto failed2;
2881191828fSJohn Linn 	}
2891191828fSJohn Linn 
2901191828fSJohn Linn 	/* Disable all the interrupts, just in case */
2911191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, 0);
2921191828fSJohn Linn 
2931191828fSJohn Linn 	/* Reset the PS2 device and abort any current transaction, to make sure
2941191828fSJohn Linn 	 * we have the PS2 in a good state */
2951191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_SRST_OFFSET, XPS2_SRST_RESET);
2961191828fSJohn Linn 
297b4a3ac9aSJohn Linn 	dev_info(dev, "Xilinx PS2 at 0x%08llX mapped to 0x%p, irq=%d\n",
298b4a3ac9aSJohn Linn 		 (unsigned long long)phys_addr, drvdata->base_address,
299b4a3ac9aSJohn Linn 		 drvdata->irq);
3001191828fSJohn Linn 
3011191828fSJohn Linn 	serio = &drvdata->serio;
3021191828fSJohn Linn 	serio->id.type = SERIO_8042;
3031191828fSJohn Linn 	serio->write = sxps2_write;
3041191828fSJohn Linn 	serio->open = sxps2_open;
3051191828fSJohn Linn 	serio->close = sxps2_close;
3061191828fSJohn Linn 	serio->port_data = drvdata;
3071191828fSJohn Linn 	serio->dev.parent = dev;
3081191828fSJohn Linn 	snprintf(serio->name, sizeof(serio->name),
309b4a3ac9aSJohn Linn 		 "Xilinx XPS PS/2 at %08llX", (unsigned long long)phys_addr);
3101191828fSJohn Linn 	snprintf(serio->phys, sizeof(serio->phys),
311b4a3ac9aSJohn Linn 		 "xilinxps2/serio at %08llX", (unsigned long long)phys_addr);
312b4a3ac9aSJohn Linn 
3131191828fSJohn Linn 	serio_register_port(serio);
3141191828fSJohn Linn 
3151191828fSJohn Linn 	return 0;		/* success */
3161191828fSJohn Linn 
3171191828fSJohn Linn failed2:
318b4a3ac9aSJohn Linn 	release_mem_region(phys_addr, remap_size);
3191191828fSJohn Linn failed1:
3201191828fSJohn Linn 	kfree(drvdata);
3211191828fSJohn Linn 	dev_set_drvdata(dev, NULL);
3221191828fSJohn Linn 
323b4a3ac9aSJohn Linn 	return error;
3241191828fSJohn Linn }
3251191828fSJohn Linn 
326b4a3ac9aSJohn Linn /**
327b4a3ac9aSJohn Linn  * xps2_of_remove - unbinds the driver from the PS/2 device.
328b4a3ac9aSJohn Linn  * @of_dev:	pointer to OF device structure
329b4a3ac9aSJohn Linn  *
330b4a3ac9aSJohn Linn  * This function is called if a device is physically removed from the system or
331b4a3ac9aSJohn Linn  * if the driver module is being unloaded. It frees any resources allocated to
332b4a3ac9aSJohn Linn  * the device.
333b4a3ac9aSJohn Linn  */
3341191828fSJohn Linn static int __devexit xps2_of_remove(struct of_device *of_dev)
3351191828fSJohn Linn {
3361191828fSJohn Linn 	struct device *dev = &of_dev->dev;
337b4a3ac9aSJohn Linn 	struct xps2data *drvdata = dev_get_drvdata(dev);
338b4a3ac9aSJohn Linn 	struct resource r_mem; /* IO mem resources */
3391191828fSJohn Linn 
3401191828fSJohn Linn 	serio_unregister_port(&drvdata->serio);
3411191828fSJohn Linn 	iounmap(drvdata->base_address);
342b4a3ac9aSJohn Linn 
343b4a3ac9aSJohn Linn 	/* Get iospace of the device */
344b4a3ac9aSJohn Linn 	if (of_address_to_resource(of_dev->node, 0, &r_mem))
345b4a3ac9aSJohn Linn 		dev_err(dev, "invalid address\n");
346b4a3ac9aSJohn Linn 	else
347*ce841b94STobias Klauser 		release_mem_region(r_mem.start, resource_size(&r_mem));
348b4a3ac9aSJohn Linn 
3491191828fSJohn Linn 	kfree(drvdata);
3501191828fSJohn Linn 
3511191828fSJohn Linn 	dev_set_drvdata(dev, NULL);
3521191828fSJohn Linn 
353b4a3ac9aSJohn Linn 	return 0;
3541191828fSJohn Linn }
3551191828fSJohn Linn 
3561191828fSJohn Linn /* Match table for of_platform binding */
357ef9a16f1SMárton Németh static const struct of_device_id xps2_of_match[] __devinitconst = {
3581191828fSJohn Linn 	{ .compatible = "xlnx,xps-ps2-1.00.a", },
3591191828fSJohn Linn 	{ /* end of list */ },
3601191828fSJohn Linn };
3611191828fSJohn Linn MODULE_DEVICE_TABLE(of, xps2_of_match);
3621191828fSJohn Linn 
3631191828fSJohn Linn static struct of_platform_driver xps2_of_driver = {
3641191828fSJohn Linn 	.name		= DRIVER_NAME,
3651191828fSJohn Linn 	.match_table	= xps2_of_match,
3661191828fSJohn Linn 	.probe		= xps2_of_probe,
3671191828fSJohn Linn 	.remove		= __devexit_p(xps2_of_remove),
3681191828fSJohn Linn };
3691191828fSJohn Linn 
3701191828fSJohn Linn static int __init xps2_init(void)
3711191828fSJohn Linn {
3721191828fSJohn Linn 	return of_register_platform_driver(&xps2_of_driver);
3731191828fSJohn Linn }
3741191828fSJohn Linn 
3751191828fSJohn Linn static void __exit xps2_cleanup(void)
3761191828fSJohn Linn {
3771191828fSJohn Linn 	of_unregister_platform_driver(&xps2_of_driver);
3781191828fSJohn Linn }
3791191828fSJohn Linn 
3801191828fSJohn Linn module_init(xps2_init);
3811191828fSJohn Linn module_exit(xps2_cleanup);
3821191828fSJohn Linn 
3831191828fSJohn Linn MODULE_AUTHOR("Xilinx, Inc.");
3841191828fSJohn Linn MODULE_DESCRIPTION("Xilinx XPS PS/2 driver");
3851191828fSJohn Linn MODULE_LICENSE("GPL");
3861191828fSJohn Linn 
387