xref: /linux/drivers/input/serio/xilinx_ps2.c (revision 271002ca7956e5ef140c02af1bd8e93063924ec6)
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>
225a0e3ad6STejun Heo #include <linux/slab.h>
231191828fSJohn Linn #include <linux/init.h>
241191828fSJohn Linn #include <linux/list.h>
251191828fSJohn Linn #include <linux/io.h>
265f9288afSMichal Simek #include <linux/of_address.h>
271191828fSJohn Linn #include <linux/of_device.h>
281191828fSJohn Linn #include <linux/of_platform.h>
291191828fSJohn Linn 
301191828fSJohn Linn #define DRIVER_NAME		"xilinx_ps2"
311191828fSJohn Linn 
321191828fSJohn Linn /* Register offsets for the xps2 device */
331191828fSJohn Linn #define XPS2_SRST_OFFSET	0x00000000 /* Software Reset register */
341191828fSJohn Linn #define XPS2_STATUS_OFFSET	0x00000004 /* Status register */
351191828fSJohn Linn #define XPS2_RX_DATA_OFFSET	0x00000008 /* Receive Data register */
361191828fSJohn Linn #define XPS2_TX_DATA_OFFSET	0x0000000C /* Transmit Data register */
371191828fSJohn Linn #define XPS2_GIER_OFFSET	0x0000002C /* Global Interrupt Enable reg */
381191828fSJohn Linn #define XPS2_IPISR_OFFSET	0x00000030 /* Interrupt Status register */
391191828fSJohn Linn #define XPS2_IPIER_OFFSET	0x00000038 /* Interrupt Enable register */
401191828fSJohn Linn 
411191828fSJohn Linn /* Reset Register Bit Definitions */
421191828fSJohn Linn #define XPS2_SRST_RESET		0x0000000A /* Software Reset  */
431191828fSJohn Linn 
441191828fSJohn Linn /* Status Register Bit Positions */
451191828fSJohn Linn #define XPS2_STATUS_RX_FULL	0x00000001 /* Receive Full  */
461191828fSJohn Linn #define XPS2_STATUS_TX_FULL	0x00000002 /* Transmit Full  */
471191828fSJohn Linn 
481191828fSJohn Linn /* Bit definitions for ISR/IER registers. Both the registers have the same bit
491191828fSJohn Linn  * definitions and are only defined once. */
501191828fSJohn Linn #define XPS2_IPIXR_WDT_TOUT	0x00000001 /* Watchdog Timeout Interrupt */
511191828fSJohn Linn #define XPS2_IPIXR_TX_NOACK	0x00000002 /* Transmit No ACK Interrupt */
521191828fSJohn Linn #define XPS2_IPIXR_TX_ACK	0x00000004 /* Transmit ACK (Data) Interrupt */
531191828fSJohn Linn #define XPS2_IPIXR_RX_OVF	0x00000008 /* Receive Overflow Interrupt */
541191828fSJohn Linn #define XPS2_IPIXR_RX_ERR	0x00000010 /* Receive Error Interrupt */
551191828fSJohn Linn #define XPS2_IPIXR_RX_FULL	0x00000020 /* Receive Data Interrupt */
561191828fSJohn Linn 
571191828fSJohn Linn /* Mask for all the Transmit Interrupts */
581191828fSJohn Linn #define XPS2_IPIXR_TX_ALL	(XPS2_IPIXR_TX_NOACK | XPS2_IPIXR_TX_ACK)
591191828fSJohn Linn 
601191828fSJohn Linn /* Mask for all the Receive Interrupts */
611191828fSJohn Linn #define XPS2_IPIXR_RX_ALL	(XPS2_IPIXR_RX_OVF | XPS2_IPIXR_RX_ERR |  \
621191828fSJohn Linn 				 XPS2_IPIXR_RX_FULL)
631191828fSJohn Linn 
641191828fSJohn Linn /* Mask for all the Interrupts */
651191828fSJohn Linn #define XPS2_IPIXR_ALL		(XPS2_IPIXR_TX_ALL | XPS2_IPIXR_RX_ALL |  \
661191828fSJohn Linn 				 XPS2_IPIXR_WDT_TOUT)
671191828fSJohn Linn 
681191828fSJohn Linn /* Global Interrupt Enable mask */
691191828fSJohn Linn #define XPS2_GIER_GIE_MASK	0x80000000
701191828fSJohn Linn 
711191828fSJohn Linn struct xps2data {
721191828fSJohn Linn 	int irq;
731191828fSJohn Linn 	spinlock_t lock;
741191828fSJohn Linn 	void __iomem *base_address;	/* virt. address of control registers */
75b4a3ac9aSJohn Linn 	unsigned int flags;
76*271002caSDmitry Torokhov 	struct serio *serio;		/* serio */
77*271002caSDmitry Torokhov 	struct device *dev;
781191828fSJohn Linn };
791191828fSJohn Linn 
801191828fSJohn Linn /************************************/
811191828fSJohn Linn /* XPS PS/2 data transmission calls */
821191828fSJohn Linn /************************************/
831191828fSJohn Linn 
84b4a3ac9aSJohn Linn /**
85b4a3ac9aSJohn Linn  * xps2_recv() - attempts to receive a byte from the PS/2 port.
86b4a3ac9aSJohn Linn  * @drvdata:	pointer to ps2 device private data structure
87b4a3ac9aSJohn Linn  * @byte:	address where the read data will be copied
88b4a3ac9aSJohn Linn  *
89b4a3ac9aSJohn Linn  * If there is any data available in the PS/2 receiver, this functions reads
90b4a3ac9aSJohn Linn  * the data, otherwise it returns error.
911191828fSJohn Linn  */
921191828fSJohn Linn static int xps2_recv(struct xps2data *drvdata, u8 *byte)
931191828fSJohn Linn {
941191828fSJohn Linn 	u32 sr;
951191828fSJohn Linn 	int status = -1;
961191828fSJohn Linn 
971191828fSJohn Linn 	/* If there is data available in the PS/2 receiver, read it */
981191828fSJohn Linn 	sr = in_be32(drvdata->base_address + XPS2_STATUS_OFFSET);
991191828fSJohn Linn 	if (sr & XPS2_STATUS_RX_FULL) {
1001191828fSJohn Linn 		*byte = in_be32(drvdata->base_address + XPS2_RX_DATA_OFFSET);
1011191828fSJohn Linn 		status = 0;
1021191828fSJohn Linn 	}
1031191828fSJohn Linn 
1041191828fSJohn Linn 	return status;
1051191828fSJohn Linn }
1061191828fSJohn Linn 
1071191828fSJohn Linn /*********************/
1081191828fSJohn Linn /* Interrupt handler */
1091191828fSJohn Linn /*********************/
1101191828fSJohn Linn static irqreturn_t xps2_interrupt(int irq, void *dev_id)
1111191828fSJohn Linn {
1121191828fSJohn Linn 	struct xps2data *drvdata = dev_id;
1131191828fSJohn Linn 	u32 intr_sr;
1141191828fSJohn Linn 	u8 c;
1151191828fSJohn Linn 	int status;
1161191828fSJohn Linn 
1171191828fSJohn Linn 	/* Get the PS/2 interrupts and clear them */
1181191828fSJohn Linn 	intr_sr = in_be32(drvdata->base_address + XPS2_IPISR_OFFSET);
1191191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPISR_OFFSET, intr_sr);
1201191828fSJohn Linn 
1211191828fSJohn Linn 	/* Check which interrupt is active */
1221191828fSJohn Linn 	if (intr_sr & XPS2_IPIXR_RX_OVF)
123*271002caSDmitry Torokhov 		dev_warn(drvdata->dev, "receive overrun error\n");
1241191828fSJohn Linn 
1251191828fSJohn Linn 	if (intr_sr & XPS2_IPIXR_RX_ERR)
126b4a3ac9aSJohn Linn 		drvdata->flags |= SERIO_PARITY;
1271191828fSJohn Linn 
1281191828fSJohn Linn 	if (intr_sr & (XPS2_IPIXR_TX_NOACK | XPS2_IPIXR_WDT_TOUT))
129b4a3ac9aSJohn Linn 		drvdata->flags |= SERIO_TIMEOUT;
1301191828fSJohn Linn 
1311191828fSJohn Linn 	if (intr_sr & XPS2_IPIXR_RX_FULL) {
132b4a3ac9aSJohn Linn 		status = xps2_recv(drvdata, &c);
1331191828fSJohn Linn 
1341191828fSJohn Linn 		/* Error, if a byte is not received */
1351191828fSJohn Linn 		if (status) {
136*271002caSDmitry Torokhov 			dev_err(drvdata->dev,
137b4a3ac9aSJohn Linn 				"wrong rcvd byte count (%d)\n", status);
1381191828fSJohn Linn 		} else {
139*271002caSDmitry Torokhov 			serio_interrupt(drvdata->serio, c, drvdata->flags);
140b4a3ac9aSJohn Linn 			drvdata->flags = 0;
1411191828fSJohn Linn 		}
1421191828fSJohn Linn 	}
1431191828fSJohn Linn 
1441191828fSJohn Linn 	return IRQ_HANDLED;
1451191828fSJohn Linn }
1461191828fSJohn Linn 
1471191828fSJohn Linn /*******************/
1481191828fSJohn Linn /* serio callbacks */
1491191828fSJohn Linn /*******************/
1501191828fSJohn Linn 
151b4a3ac9aSJohn Linn /**
152b4a3ac9aSJohn Linn  * sxps2_write() - sends a byte out through the PS/2 port.
153b4a3ac9aSJohn Linn  * @pserio:	pointer to the serio structure of the PS/2 port
154b4a3ac9aSJohn Linn  * @c:		data that needs to be written to the PS/2 port
155b4a3ac9aSJohn Linn  *
156b4a3ac9aSJohn Linn  * This function checks if the PS/2 transmitter is empty and sends a byte.
157b4a3ac9aSJohn Linn  * Otherwise it returns error. Transmission fails only when nothing is connected
158b4a3ac9aSJohn Linn  * to the PS/2 port. Thats why, we do not try to resend the data in case of a
159b4a3ac9aSJohn Linn  * failure.
1601191828fSJohn Linn  */
1611191828fSJohn Linn static int sxps2_write(struct serio *pserio, unsigned char c)
1621191828fSJohn Linn {
1631191828fSJohn Linn 	struct xps2data *drvdata = pserio->port_data;
1641191828fSJohn Linn 	unsigned long flags;
1651191828fSJohn Linn 	u32 sr;
1661191828fSJohn Linn 	int status = -1;
1671191828fSJohn Linn 
1681191828fSJohn Linn 	spin_lock_irqsave(&drvdata->lock, flags);
1691191828fSJohn Linn 
1701191828fSJohn Linn 	/* If the PS/2 transmitter is empty send a byte of data */
1711191828fSJohn Linn 	sr = in_be32(drvdata->base_address + XPS2_STATUS_OFFSET);
1721191828fSJohn Linn 	if (!(sr & XPS2_STATUS_TX_FULL)) {
1731191828fSJohn Linn 		out_be32(drvdata->base_address + XPS2_TX_DATA_OFFSET, c);
1741191828fSJohn Linn 		status = 0;
1751191828fSJohn Linn 	}
1761191828fSJohn Linn 
1771191828fSJohn Linn 	spin_unlock_irqrestore(&drvdata->lock, flags);
1781191828fSJohn Linn 
1791191828fSJohn Linn 	return status;
1801191828fSJohn Linn }
1811191828fSJohn Linn 
182b4a3ac9aSJohn Linn /**
183b4a3ac9aSJohn Linn  * sxps2_open() - called when a port is opened by the higher layer.
184b4a3ac9aSJohn Linn  * @pserio:	pointer to the serio structure of the PS/2 device
185b4a3ac9aSJohn Linn  *
186b4a3ac9aSJohn Linn  * This function requests irq and enables interrupts for the PS/2 device.
1871191828fSJohn Linn  */
1881191828fSJohn Linn static int sxps2_open(struct serio *pserio)
1891191828fSJohn Linn {
1901191828fSJohn Linn 	struct xps2data *drvdata = pserio->port_data;
191b4a3ac9aSJohn Linn 	int error;
192b4a3ac9aSJohn Linn 	u8 c;
1931191828fSJohn Linn 
194b4a3ac9aSJohn Linn 	error = request_irq(drvdata->irq, &xps2_interrupt, 0,
1951191828fSJohn Linn 				DRIVER_NAME, drvdata);
196b4a3ac9aSJohn Linn 	if (error) {
197*271002caSDmitry Torokhov 		dev_err(drvdata->dev,
198b4a3ac9aSJohn Linn 			"Couldn't allocate interrupt %d\n", drvdata->irq);
199b4a3ac9aSJohn Linn 		return error;
2001191828fSJohn Linn 	}
2011191828fSJohn Linn 
2021191828fSJohn Linn 	/* start reception by enabling the interrupts */
2031191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_GIER_OFFSET, XPS2_GIER_GIE_MASK);
2041191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, XPS2_IPIXR_RX_ALL);
205b4a3ac9aSJohn Linn 	(void)xps2_recv(drvdata, &c);
2061191828fSJohn Linn 
2071191828fSJohn Linn 	return 0;		/* success */
2081191828fSJohn Linn }
2091191828fSJohn Linn 
210b4a3ac9aSJohn Linn /**
211b4a3ac9aSJohn Linn  * sxps2_close() - frees the interrupt.
212b4a3ac9aSJohn Linn  * @pserio:	pointer to the serio structure of the PS/2 device
213b4a3ac9aSJohn Linn  *
214b4a3ac9aSJohn Linn  * This function frees the irq and disables interrupts for the PS/2 device.
2151191828fSJohn Linn  */
2161191828fSJohn Linn static void sxps2_close(struct serio *pserio)
2171191828fSJohn Linn {
2181191828fSJohn Linn 	struct xps2data *drvdata = pserio->port_data;
2191191828fSJohn Linn 
2201191828fSJohn Linn 	/* Disable the PS2 interrupts */
2211191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_GIER_OFFSET, 0x00);
2221191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, 0x00);
2231191828fSJohn Linn 	free_irq(drvdata->irq, drvdata);
2241191828fSJohn Linn }
2251191828fSJohn Linn 
226b4a3ac9aSJohn Linn /**
227b4a3ac9aSJohn Linn  * xps2_of_probe - probe method for the PS/2 device.
228b4a3ac9aSJohn Linn  * @of_dev:	pointer to OF device structure
22925985edcSLucas De Marchi  * @match:	pointer to the structure used for matching a device
230b4a3ac9aSJohn Linn  *
231b4a3ac9aSJohn Linn  * This function probes the PS/2 device in the device tree.
232b4a3ac9aSJohn Linn  * It initializes the driver data structure and the hardware.
233b4a3ac9aSJohn Linn  * It returns 0, if the driver is bound to the PS/2 device, or a negative
234b4a3ac9aSJohn Linn  * value if there is an error.
235b4a3ac9aSJohn Linn  */
2361c48a5c9SGrant Likely static int __devinit xps2_of_probe(struct platform_device *ofdev)
2371191828fSJohn Linn {
238b4a3ac9aSJohn Linn 	struct resource r_irq; /* Interrupt resources */
239b4a3ac9aSJohn Linn 	struct resource r_mem; /* IO mem resources */
2401191828fSJohn Linn 	struct xps2data *drvdata;
2411191828fSJohn Linn 	struct serio *serio;
242b4a3ac9aSJohn Linn 	struct device *dev = &ofdev->dev;
243b4a3ac9aSJohn Linn 	resource_size_t remap_size, phys_addr;
244b4a3ac9aSJohn Linn 	int error;
2451191828fSJohn Linn 
246b4a3ac9aSJohn Linn 	dev_info(dev, "Device Tree Probing \'%s\'\n",
24761c7a080SGrant Likely 			ofdev->dev.of_node->name);
2481191828fSJohn Linn 
249b4a3ac9aSJohn Linn 	/* Get iospace for the device */
25061c7a080SGrant Likely 	error = of_address_to_resource(ofdev->dev.of_node, 0, &r_mem);
251b4a3ac9aSJohn Linn 	if (error) {
252b4a3ac9aSJohn Linn 		dev_err(dev, "invalid address\n");
253b4a3ac9aSJohn Linn 		return error;
254b4a3ac9aSJohn Linn 	}
255b4a3ac9aSJohn Linn 
256b4a3ac9aSJohn Linn 	/* Get IRQ for the device */
257be3bad6fSMichal Simek 	if (!of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq)) {
258b4a3ac9aSJohn Linn 		dev_err(dev, "no IRQ found\n");
259b4a3ac9aSJohn Linn 		return -ENODEV;
2601191828fSJohn Linn 	}
2611191828fSJohn Linn 
2621191828fSJohn Linn 	drvdata = kzalloc(sizeof(struct xps2data), GFP_KERNEL);
263*271002caSDmitry Torokhov 	serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
264*271002caSDmitry Torokhov 	if (!drvdata || !serio) {
265*271002caSDmitry Torokhov 		error = -ENOMEM;
266*271002caSDmitry Torokhov 		goto failed1;
2671191828fSJohn Linn 	}
2681191828fSJohn Linn 
2691191828fSJohn Linn 	spin_lock_init(&drvdata->lock);
270b4a3ac9aSJohn Linn 	drvdata->irq = r_irq.start;
271*271002caSDmitry Torokhov 	drvdata->serio = serio;
272*271002caSDmitry Torokhov 	drvdata->dev = dev;
2731191828fSJohn Linn 
274b4a3ac9aSJohn Linn 	phys_addr = r_mem.start;
275ce841b94STobias Klauser 	remap_size = resource_size(&r_mem);
276b4a3ac9aSJohn Linn 	if (!request_mem_region(phys_addr, remap_size, DRIVER_NAME)) {
277b4a3ac9aSJohn Linn 		dev_err(dev, "Couldn't lock memory region at 0x%08llX\n",
278b4a3ac9aSJohn Linn 			(unsigned long long)phys_addr);
279b4a3ac9aSJohn Linn 		error = -EBUSY;
2801191828fSJohn Linn 		goto failed1;
2811191828fSJohn Linn 	}
2821191828fSJohn Linn 
2831191828fSJohn Linn 	/* Fill in configuration data and add them to the list */
284b4a3ac9aSJohn Linn 	drvdata->base_address = ioremap(phys_addr, remap_size);
2851191828fSJohn Linn 	if (drvdata->base_address == NULL) {
286b4a3ac9aSJohn Linn 		dev_err(dev, "Couldn't ioremap memory at 0x%08llX\n",
287b4a3ac9aSJohn Linn 			(unsigned long long)phys_addr);
288b4a3ac9aSJohn Linn 		error = -EFAULT;
2891191828fSJohn Linn 		goto failed2;
2901191828fSJohn Linn 	}
2911191828fSJohn Linn 
2921191828fSJohn Linn 	/* Disable all the interrupts, just in case */
2931191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, 0);
2941191828fSJohn Linn 
2951191828fSJohn Linn 	/* Reset the PS2 device and abort any current transaction, to make sure
2961191828fSJohn Linn 	 * we have the PS2 in a good state */
2971191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_SRST_OFFSET, XPS2_SRST_RESET);
2981191828fSJohn Linn 
299b4a3ac9aSJohn Linn 	dev_info(dev, "Xilinx PS2 at 0x%08llX mapped to 0x%p, irq=%d\n",
300b4a3ac9aSJohn Linn 		 (unsigned long long)phys_addr, drvdata->base_address,
301b4a3ac9aSJohn Linn 		 drvdata->irq);
3021191828fSJohn Linn 
3031191828fSJohn Linn 	serio->id.type = SERIO_8042;
3041191828fSJohn Linn 	serio->write = sxps2_write;
3051191828fSJohn Linn 	serio->open = sxps2_open;
3061191828fSJohn Linn 	serio->close = sxps2_close;
3071191828fSJohn Linn 	serio->port_data = drvdata;
3081191828fSJohn Linn 	serio->dev.parent = dev;
3091191828fSJohn Linn 	snprintf(serio->name, sizeof(serio->name),
310b4a3ac9aSJohn Linn 		 "Xilinx XPS PS/2 at %08llX", (unsigned long long)phys_addr);
3111191828fSJohn Linn 	snprintf(serio->phys, sizeof(serio->phys),
312b4a3ac9aSJohn Linn 		 "xilinxps2/serio at %08llX", (unsigned long long)phys_addr);
313b4a3ac9aSJohn Linn 
3141191828fSJohn Linn 	serio_register_port(serio);
3151191828fSJohn Linn 
316*271002caSDmitry Torokhov 	platform_set_drvdata(ofdev, drvdata);
3171191828fSJohn Linn 	return 0;		/* success */
3181191828fSJohn Linn 
3191191828fSJohn Linn failed2:
320b4a3ac9aSJohn Linn 	release_mem_region(phys_addr, remap_size);
3211191828fSJohn Linn failed1:
322*271002caSDmitry Torokhov 	kfree(serio);
3231191828fSJohn Linn 	kfree(drvdata);
3241191828fSJohn Linn 
325b4a3ac9aSJohn Linn 	return error;
3261191828fSJohn Linn }
3271191828fSJohn Linn 
328b4a3ac9aSJohn Linn /**
329b4a3ac9aSJohn Linn  * xps2_of_remove - unbinds the driver from the PS/2 device.
330b4a3ac9aSJohn Linn  * @of_dev:	pointer to OF device structure
331b4a3ac9aSJohn Linn  *
332b4a3ac9aSJohn Linn  * This function is called if a device is physically removed from the system or
333b4a3ac9aSJohn Linn  * if the driver module is being unloaded. It frees any resources allocated to
334b4a3ac9aSJohn Linn  * the device.
335b4a3ac9aSJohn Linn  */
3362dc11581SGrant Likely static int __devexit xps2_of_remove(struct platform_device *of_dev)
3371191828fSJohn Linn {
338*271002caSDmitry Torokhov 	struct xps2data *drvdata = platform_get_drvdata(of_dev);
339b4a3ac9aSJohn Linn 	struct resource r_mem; /* IO mem resources */
3401191828fSJohn Linn 
341*271002caSDmitry Torokhov 	serio_unregister_port(drvdata->serio);
3421191828fSJohn Linn 	iounmap(drvdata->base_address);
343b4a3ac9aSJohn Linn 
344b4a3ac9aSJohn Linn 	/* Get iospace of the device */
34561c7a080SGrant Likely 	if (of_address_to_resource(of_dev->dev.of_node, 0, &r_mem))
346*271002caSDmitry Torokhov 		dev_err(drvdata->dev, "invalid address\n");
347b4a3ac9aSJohn Linn 	else
348ce841b94STobias Klauser 		release_mem_region(r_mem.start, resource_size(&r_mem));
349b4a3ac9aSJohn Linn 
3501191828fSJohn Linn 	kfree(drvdata);
3511191828fSJohn Linn 
352*271002caSDmitry Torokhov 	platform_set_drvdata(of_dev, NULL);
3531191828fSJohn Linn 
354b4a3ac9aSJohn Linn 	return 0;
3551191828fSJohn Linn }
3561191828fSJohn Linn 
3571191828fSJohn Linn /* Match table for of_platform binding */
358ef9a16f1SMárton Németh static const struct of_device_id xps2_of_match[] __devinitconst = {
3591191828fSJohn Linn 	{ .compatible = "xlnx,xps-ps2-1.00.a", },
3601191828fSJohn Linn 	{ /* end of list */ },
3611191828fSJohn Linn };
3621191828fSJohn Linn MODULE_DEVICE_TABLE(of, xps2_of_match);
3631191828fSJohn Linn 
3641c48a5c9SGrant Likely static struct platform_driver xps2_of_driver = {
3654018294bSGrant Likely 	.driver = {
3661191828fSJohn Linn 		.name = DRIVER_NAME,
3674018294bSGrant Likely 		.owner = THIS_MODULE,
3684018294bSGrant Likely 		.of_match_table = xps2_of_match,
3694018294bSGrant Likely 	},
3701191828fSJohn Linn 	.probe		= xps2_of_probe,
3711191828fSJohn Linn 	.remove		= __devexit_p(xps2_of_remove),
3721191828fSJohn Linn };
37324d2469aSJJ Ding module_platform_driver(xps2_of_driver);
3741191828fSJohn Linn 
3751191828fSJohn Linn MODULE_AUTHOR("Xilinx, Inc.");
3761191828fSJohn Linn MODULE_DESCRIPTION("Xilinx XPS PS/2 driver");
3771191828fSJohn Linn MODULE_LICENSE("GPL");
3781191828fSJohn Linn 
379