xref: /linux/drivers/input/serio/xilinx_ps2.c (revision da1a42cd457fb06c2fd141c670b2ca3397234322)
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/list.h>
241191828fSJohn Linn #include <linux/io.h>
255f9288afSMichal Simek #include <linux/of_address.h>
261191828fSJohn Linn #include <linux/of_device.h>
275af50730SRob Herring #include <linux/of_irq.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 
48*da1a42cdSMichal Simek /*
49*da1a42cdSMichal Simek  * Bit definitions for ISR/IER registers. Both the registers have the same bit
50*da1a42cdSMichal Simek  * definitions and are only defined once.
51*da1a42cdSMichal Simek  */
521191828fSJohn Linn #define XPS2_IPIXR_WDT_TOUT	0x00000001 /* Watchdog Timeout Interrupt */
531191828fSJohn Linn #define XPS2_IPIXR_TX_NOACK	0x00000002 /* Transmit No ACK Interrupt */
541191828fSJohn Linn #define XPS2_IPIXR_TX_ACK	0x00000004 /* Transmit ACK (Data) Interrupt */
551191828fSJohn Linn #define XPS2_IPIXR_RX_OVF	0x00000008 /* Receive Overflow Interrupt */
561191828fSJohn Linn #define XPS2_IPIXR_RX_ERR	0x00000010 /* Receive Error Interrupt */
571191828fSJohn Linn #define XPS2_IPIXR_RX_FULL	0x00000020 /* Receive Data Interrupt */
581191828fSJohn Linn 
591191828fSJohn Linn /* Mask for all the Transmit Interrupts */
601191828fSJohn Linn #define XPS2_IPIXR_TX_ALL	(XPS2_IPIXR_TX_NOACK | XPS2_IPIXR_TX_ACK)
611191828fSJohn Linn 
621191828fSJohn Linn /* Mask for all the Receive Interrupts */
631191828fSJohn Linn #define XPS2_IPIXR_RX_ALL	(XPS2_IPIXR_RX_OVF | XPS2_IPIXR_RX_ERR |  \
641191828fSJohn Linn 				 XPS2_IPIXR_RX_FULL)
651191828fSJohn Linn 
661191828fSJohn Linn /* Mask for all the Interrupts */
671191828fSJohn Linn #define XPS2_IPIXR_ALL		(XPS2_IPIXR_TX_ALL | XPS2_IPIXR_RX_ALL |  \
681191828fSJohn Linn 				 XPS2_IPIXR_WDT_TOUT)
691191828fSJohn Linn 
701191828fSJohn Linn /* Global Interrupt Enable mask */
711191828fSJohn Linn #define XPS2_GIER_GIE_MASK	0x80000000
721191828fSJohn Linn 
731191828fSJohn Linn struct xps2data {
741191828fSJohn Linn 	int irq;
751191828fSJohn Linn 	spinlock_t lock;
761191828fSJohn Linn 	void __iomem *base_address;	/* virt. address of control registers */
77b4a3ac9aSJohn Linn 	unsigned int flags;
78271002caSDmitry Torokhov 	struct serio *serio;		/* serio */
79271002caSDmitry Torokhov 	struct device *dev;
801191828fSJohn Linn };
811191828fSJohn Linn 
821191828fSJohn Linn /************************************/
831191828fSJohn Linn /* XPS PS/2 data transmission calls */
841191828fSJohn Linn /************************************/
851191828fSJohn Linn 
86b4a3ac9aSJohn Linn /**
87b4a3ac9aSJohn Linn  * xps2_recv() - attempts to receive a byte from the PS/2 port.
88b4a3ac9aSJohn Linn  * @drvdata:	pointer to ps2 device private data structure
89b4a3ac9aSJohn Linn  * @byte:	address where the read data will be copied
90b4a3ac9aSJohn Linn  *
91b4a3ac9aSJohn Linn  * If there is any data available in the PS/2 receiver, this functions reads
92b4a3ac9aSJohn Linn  * the data, otherwise it returns error.
931191828fSJohn Linn  */
941191828fSJohn Linn static int xps2_recv(struct xps2data *drvdata, u8 *byte)
951191828fSJohn Linn {
961191828fSJohn Linn 	u32 sr;
971191828fSJohn Linn 	int status = -1;
981191828fSJohn Linn 
991191828fSJohn Linn 	/* If there is data available in the PS/2 receiver, read it */
1001191828fSJohn Linn 	sr = in_be32(drvdata->base_address + XPS2_STATUS_OFFSET);
1011191828fSJohn Linn 	if (sr & XPS2_STATUS_RX_FULL) {
1021191828fSJohn Linn 		*byte = in_be32(drvdata->base_address + XPS2_RX_DATA_OFFSET);
1031191828fSJohn Linn 		status = 0;
1041191828fSJohn Linn 	}
1051191828fSJohn Linn 
1061191828fSJohn Linn 	return status;
1071191828fSJohn Linn }
1081191828fSJohn Linn 
1091191828fSJohn Linn /*********************/
1101191828fSJohn Linn /* Interrupt handler */
1111191828fSJohn Linn /*********************/
1121191828fSJohn Linn static irqreturn_t xps2_interrupt(int irq, void *dev_id)
1131191828fSJohn Linn {
1141191828fSJohn Linn 	struct xps2data *drvdata = dev_id;
1151191828fSJohn Linn 	u32 intr_sr;
1161191828fSJohn Linn 	u8 c;
1171191828fSJohn Linn 	int status;
1181191828fSJohn Linn 
1191191828fSJohn Linn 	/* Get the PS/2 interrupts and clear them */
1201191828fSJohn Linn 	intr_sr = in_be32(drvdata->base_address + XPS2_IPISR_OFFSET);
1211191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPISR_OFFSET, intr_sr);
1221191828fSJohn Linn 
1231191828fSJohn Linn 	/* Check which interrupt is active */
1241191828fSJohn Linn 	if (intr_sr & XPS2_IPIXR_RX_OVF)
125271002caSDmitry Torokhov 		dev_warn(drvdata->dev, "receive overrun error\n");
1261191828fSJohn Linn 
1271191828fSJohn Linn 	if (intr_sr & XPS2_IPIXR_RX_ERR)
128b4a3ac9aSJohn Linn 		drvdata->flags |= SERIO_PARITY;
1291191828fSJohn Linn 
1301191828fSJohn Linn 	if (intr_sr & (XPS2_IPIXR_TX_NOACK | XPS2_IPIXR_WDT_TOUT))
131b4a3ac9aSJohn Linn 		drvdata->flags |= SERIO_TIMEOUT;
1321191828fSJohn Linn 
1331191828fSJohn Linn 	if (intr_sr & XPS2_IPIXR_RX_FULL) {
134b4a3ac9aSJohn Linn 		status = xps2_recv(drvdata, &c);
1351191828fSJohn Linn 
1361191828fSJohn Linn 		/* Error, if a byte is not received */
1371191828fSJohn Linn 		if (status) {
138271002caSDmitry Torokhov 			dev_err(drvdata->dev,
139b4a3ac9aSJohn Linn 				"wrong rcvd byte count (%d)\n", status);
1401191828fSJohn Linn 		} else {
141271002caSDmitry Torokhov 			serio_interrupt(drvdata->serio, c, drvdata->flags);
142b4a3ac9aSJohn Linn 			drvdata->flags = 0;
1431191828fSJohn Linn 		}
1441191828fSJohn Linn 	}
1451191828fSJohn Linn 
1461191828fSJohn Linn 	return IRQ_HANDLED;
1471191828fSJohn Linn }
1481191828fSJohn Linn 
1491191828fSJohn Linn /*******************/
1501191828fSJohn Linn /* serio callbacks */
1511191828fSJohn Linn /*******************/
1521191828fSJohn Linn 
153b4a3ac9aSJohn Linn /**
154b4a3ac9aSJohn Linn  * sxps2_write() - sends a byte out through the PS/2 port.
155b4a3ac9aSJohn Linn  * @pserio:	pointer to the serio structure of the PS/2 port
156b4a3ac9aSJohn Linn  * @c:		data that needs to be written to the PS/2 port
157b4a3ac9aSJohn Linn  *
158b4a3ac9aSJohn Linn  * This function checks if the PS/2 transmitter is empty and sends a byte.
159b4a3ac9aSJohn Linn  * Otherwise it returns error. Transmission fails only when nothing is connected
160b4a3ac9aSJohn Linn  * to the PS/2 port. Thats why, we do not try to resend the data in case of a
161b4a3ac9aSJohn Linn  * failure.
1621191828fSJohn Linn  */
1631191828fSJohn Linn static int sxps2_write(struct serio *pserio, unsigned char c)
1641191828fSJohn Linn {
1651191828fSJohn Linn 	struct xps2data *drvdata = pserio->port_data;
1661191828fSJohn Linn 	unsigned long flags;
1671191828fSJohn Linn 	u32 sr;
1681191828fSJohn Linn 	int status = -1;
1691191828fSJohn Linn 
1701191828fSJohn Linn 	spin_lock_irqsave(&drvdata->lock, flags);
1711191828fSJohn Linn 
1721191828fSJohn Linn 	/* If the PS/2 transmitter is empty send a byte of data */
1731191828fSJohn Linn 	sr = in_be32(drvdata->base_address + XPS2_STATUS_OFFSET);
1741191828fSJohn Linn 	if (!(sr & XPS2_STATUS_TX_FULL)) {
1751191828fSJohn Linn 		out_be32(drvdata->base_address + XPS2_TX_DATA_OFFSET, c);
1761191828fSJohn Linn 		status = 0;
1771191828fSJohn Linn 	}
1781191828fSJohn Linn 
1791191828fSJohn Linn 	spin_unlock_irqrestore(&drvdata->lock, flags);
1801191828fSJohn Linn 
1811191828fSJohn Linn 	return status;
1821191828fSJohn Linn }
1831191828fSJohn Linn 
184b4a3ac9aSJohn Linn /**
185b4a3ac9aSJohn Linn  * sxps2_open() - called when a port is opened by the higher layer.
186b4a3ac9aSJohn Linn  * @pserio:	pointer to the serio structure of the PS/2 device
187b4a3ac9aSJohn Linn  *
188b4a3ac9aSJohn Linn  * This function requests irq and enables interrupts for the PS/2 device.
1891191828fSJohn Linn  */
1901191828fSJohn Linn static int sxps2_open(struct serio *pserio)
1911191828fSJohn Linn {
1921191828fSJohn Linn 	struct xps2data *drvdata = pserio->port_data;
193b4a3ac9aSJohn Linn 	int error;
194b4a3ac9aSJohn Linn 	u8 c;
1951191828fSJohn Linn 
196b4a3ac9aSJohn Linn 	error = request_irq(drvdata->irq, &xps2_interrupt, 0,
1971191828fSJohn Linn 				DRIVER_NAME, drvdata);
198b4a3ac9aSJohn Linn 	if (error) {
199271002caSDmitry Torokhov 		dev_err(drvdata->dev,
200b4a3ac9aSJohn Linn 			"Couldn't allocate interrupt %d\n", drvdata->irq);
201b4a3ac9aSJohn Linn 		return error;
2021191828fSJohn Linn 	}
2031191828fSJohn Linn 
2041191828fSJohn Linn 	/* start reception by enabling the interrupts */
2051191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_GIER_OFFSET, XPS2_GIER_GIE_MASK);
2061191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, XPS2_IPIXR_RX_ALL);
207b4a3ac9aSJohn Linn 	(void)xps2_recv(drvdata, &c);
2081191828fSJohn Linn 
2091191828fSJohn Linn 	return 0;		/* success */
2101191828fSJohn Linn }
2111191828fSJohn Linn 
212b4a3ac9aSJohn Linn /**
213b4a3ac9aSJohn Linn  * sxps2_close() - frees the interrupt.
214b4a3ac9aSJohn Linn  * @pserio:	pointer to the serio structure of the PS/2 device
215b4a3ac9aSJohn Linn  *
216b4a3ac9aSJohn Linn  * This function frees the irq and disables interrupts for the PS/2 device.
2171191828fSJohn Linn  */
2181191828fSJohn Linn static void sxps2_close(struct serio *pserio)
2191191828fSJohn Linn {
2201191828fSJohn Linn 	struct xps2data *drvdata = pserio->port_data;
2211191828fSJohn Linn 
2221191828fSJohn Linn 	/* Disable the PS2 interrupts */
2231191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_GIER_OFFSET, 0x00);
2241191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, 0x00);
2251191828fSJohn Linn 	free_irq(drvdata->irq, drvdata);
2261191828fSJohn Linn }
2271191828fSJohn Linn 
228b4a3ac9aSJohn Linn /**
229b4a3ac9aSJohn Linn  * xps2_of_probe - probe method for the PS/2 device.
230b4a3ac9aSJohn Linn  * @of_dev:	pointer to OF device structure
23125985edcSLucas De Marchi  * @match:	pointer to the structure used for matching a device
232b4a3ac9aSJohn Linn  *
233b4a3ac9aSJohn Linn  * This function probes the PS/2 device in the device tree.
234b4a3ac9aSJohn Linn  * It initializes the driver data structure and the hardware.
235b4a3ac9aSJohn Linn  * It returns 0, if the driver is bound to the PS/2 device, or a negative
236b4a3ac9aSJohn Linn  * value if there is an error.
237b4a3ac9aSJohn Linn  */
2385298cc4cSBill Pemberton static int xps2_of_probe(struct platform_device *ofdev)
2391191828fSJohn Linn {
240b4a3ac9aSJohn Linn 	struct resource r_mem; /* IO mem resources */
2411191828fSJohn Linn 	struct xps2data *drvdata;
2421191828fSJohn Linn 	struct serio *serio;
243b4a3ac9aSJohn Linn 	struct device *dev = &ofdev->dev;
244b4a3ac9aSJohn Linn 	resource_size_t remap_size, phys_addr;
245f7578496SThierry Reding 	unsigned int irq;
246b4a3ac9aSJohn Linn 	int error;
2471191828fSJohn Linn 
24832237677SGuenter Roeck 	dev_info(dev, "Device Tree Probing \'%s\'\n", dev->of_node->name);
2491191828fSJohn Linn 
250b4a3ac9aSJohn Linn 	/* Get iospace for the device */
25132237677SGuenter Roeck 	error = of_address_to_resource(dev->of_node, 0, &r_mem);
252b4a3ac9aSJohn Linn 	if (error) {
253b4a3ac9aSJohn Linn 		dev_err(dev, "invalid address\n");
254b4a3ac9aSJohn Linn 		return error;
255b4a3ac9aSJohn Linn 	}
256b4a3ac9aSJohn Linn 
257b4a3ac9aSJohn Linn 	/* Get IRQ for the device */
25832237677SGuenter Roeck 	irq = irq_of_parse_and_map(dev->of_node, 0);
259f7578496SThierry Reding 	if (!irq) {
260b4a3ac9aSJohn Linn 		dev_err(dev, "no IRQ found\n");
261b4a3ac9aSJohn Linn 		return -ENODEV;
2621191828fSJohn Linn 	}
2631191828fSJohn Linn 
2641191828fSJohn Linn 	drvdata = kzalloc(sizeof(struct xps2data), GFP_KERNEL);
265271002caSDmitry Torokhov 	serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
266271002caSDmitry Torokhov 	if (!drvdata || !serio) {
267271002caSDmitry Torokhov 		error = -ENOMEM;
268271002caSDmitry Torokhov 		goto failed1;
2691191828fSJohn Linn 	}
2701191828fSJohn Linn 
2711191828fSJohn Linn 	spin_lock_init(&drvdata->lock);
272f7578496SThierry Reding 	drvdata->irq = irq;
273271002caSDmitry Torokhov 	drvdata->serio = serio;
274271002caSDmitry Torokhov 	drvdata->dev = dev;
2751191828fSJohn Linn 
276b4a3ac9aSJohn Linn 	phys_addr = r_mem.start;
277ce841b94STobias Klauser 	remap_size = resource_size(&r_mem);
278b4a3ac9aSJohn Linn 	if (!request_mem_region(phys_addr, remap_size, DRIVER_NAME)) {
279b4a3ac9aSJohn Linn 		dev_err(dev, "Couldn't lock memory region at 0x%08llX\n",
280b4a3ac9aSJohn Linn 			(unsigned long long)phys_addr);
281b4a3ac9aSJohn Linn 		error = -EBUSY;
2821191828fSJohn Linn 		goto failed1;
2831191828fSJohn Linn 	}
2841191828fSJohn Linn 
2851191828fSJohn Linn 	/* Fill in configuration data and add them to the list */
286b4a3ac9aSJohn Linn 	drvdata->base_address = ioremap(phys_addr, remap_size);
2871191828fSJohn Linn 	if (drvdata->base_address == NULL) {
288b4a3ac9aSJohn Linn 		dev_err(dev, "Couldn't ioremap memory at 0x%08llX\n",
289b4a3ac9aSJohn Linn 			(unsigned long long)phys_addr);
290b4a3ac9aSJohn Linn 		error = -EFAULT;
2911191828fSJohn Linn 		goto failed2;
2921191828fSJohn Linn 	}
2931191828fSJohn Linn 
2941191828fSJohn Linn 	/* Disable all the interrupts, just in case */
2951191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, 0);
2961191828fSJohn Linn 
297*da1a42cdSMichal Simek 	/*
298*da1a42cdSMichal Simek 	 * Reset the PS2 device and abort any current transaction,
299*da1a42cdSMichal Simek 	 * to make sure we have the PS2 in a good state.
300*da1a42cdSMichal Simek 	 */
3011191828fSJohn Linn 	out_be32(drvdata->base_address + XPS2_SRST_OFFSET, XPS2_SRST_RESET);
3021191828fSJohn Linn 
303b4a3ac9aSJohn Linn 	dev_info(dev, "Xilinx PS2 at 0x%08llX mapped to 0x%p, irq=%d\n",
304b4a3ac9aSJohn Linn 		 (unsigned long long)phys_addr, drvdata->base_address,
305b4a3ac9aSJohn Linn 		 drvdata->irq);
3061191828fSJohn Linn 
3071191828fSJohn Linn 	serio->id.type = SERIO_8042;
3081191828fSJohn Linn 	serio->write = sxps2_write;
3091191828fSJohn Linn 	serio->open = sxps2_open;
3101191828fSJohn Linn 	serio->close = sxps2_close;
3111191828fSJohn Linn 	serio->port_data = drvdata;
3121191828fSJohn Linn 	serio->dev.parent = dev;
3131191828fSJohn Linn 	snprintf(serio->name, sizeof(serio->name),
314b4a3ac9aSJohn Linn 		 "Xilinx XPS PS/2 at %08llX", (unsigned long long)phys_addr);
3151191828fSJohn Linn 	snprintf(serio->phys, sizeof(serio->phys),
316b4a3ac9aSJohn Linn 		 "xilinxps2/serio at %08llX", (unsigned long long)phys_addr);
317b4a3ac9aSJohn Linn 
3181191828fSJohn Linn 	serio_register_port(serio);
3191191828fSJohn Linn 
320271002caSDmitry Torokhov 	platform_set_drvdata(ofdev, drvdata);
3211191828fSJohn Linn 	return 0;		/* success */
3221191828fSJohn Linn 
3231191828fSJohn Linn failed2:
324b4a3ac9aSJohn Linn 	release_mem_region(phys_addr, remap_size);
3251191828fSJohn Linn failed1:
326271002caSDmitry Torokhov 	kfree(serio);
3271191828fSJohn Linn 	kfree(drvdata);
3281191828fSJohn Linn 
329b4a3ac9aSJohn Linn 	return error;
3301191828fSJohn Linn }
3311191828fSJohn Linn 
332b4a3ac9aSJohn Linn /**
333b4a3ac9aSJohn Linn  * xps2_of_remove - unbinds the driver from the PS/2 device.
334b4a3ac9aSJohn Linn  * @of_dev:	pointer to OF device structure
335b4a3ac9aSJohn Linn  *
336b4a3ac9aSJohn Linn  * This function is called if a device is physically removed from the system or
337b4a3ac9aSJohn Linn  * if the driver module is being unloaded. It frees any resources allocated to
338b4a3ac9aSJohn Linn  * the device.
339b4a3ac9aSJohn Linn  */
340e2619cf7SBill Pemberton static int xps2_of_remove(struct platform_device *of_dev)
3411191828fSJohn Linn {
342271002caSDmitry Torokhov 	struct xps2data *drvdata = platform_get_drvdata(of_dev);
343b4a3ac9aSJohn Linn 	struct resource r_mem; /* IO mem resources */
3441191828fSJohn Linn 
345271002caSDmitry Torokhov 	serio_unregister_port(drvdata->serio);
3461191828fSJohn Linn 	iounmap(drvdata->base_address);
347b4a3ac9aSJohn Linn 
348b4a3ac9aSJohn Linn 	/* Get iospace of the device */
34961c7a080SGrant Likely 	if (of_address_to_resource(of_dev->dev.of_node, 0, &r_mem))
350271002caSDmitry Torokhov 		dev_err(drvdata->dev, "invalid address\n");
351b4a3ac9aSJohn Linn 	else
352ce841b94STobias Klauser 		release_mem_region(r_mem.start, resource_size(&r_mem));
353b4a3ac9aSJohn Linn 
3541191828fSJohn Linn 	kfree(drvdata);
3551191828fSJohn Linn 
356b4a3ac9aSJohn Linn 	return 0;
3571191828fSJohn Linn }
3581191828fSJohn Linn 
3591191828fSJohn Linn /* Match table for of_platform binding */
36078f50c24SBill Pemberton static const struct of_device_id xps2_of_match[] = {
3611191828fSJohn Linn 	{ .compatible = "xlnx,xps-ps2-1.00.a", },
3621191828fSJohn Linn 	{ /* end of list */ },
3631191828fSJohn Linn };
3641191828fSJohn Linn MODULE_DEVICE_TABLE(of, xps2_of_match);
3651191828fSJohn Linn 
3661c48a5c9SGrant Likely static struct platform_driver xps2_of_driver = {
3674018294bSGrant Likely 	.driver = {
3681191828fSJohn Linn 		.name = DRIVER_NAME,
3694018294bSGrant Likely 		.of_match_table = xps2_of_match,
3704018294bSGrant Likely 	},
3711191828fSJohn Linn 	.probe		= xps2_of_probe,
3721cb0aa88SBill Pemberton 	.remove		= xps2_of_remove,
3731191828fSJohn Linn };
37424d2469aSJJ Ding module_platform_driver(xps2_of_driver);
3751191828fSJohn Linn 
3761191828fSJohn Linn MODULE_AUTHOR("Xilinx, Inc.");
3771191828fSJohn Linn MODULE_DESCRIPTION("Xilinx XPS PS/2 driver");
3781191828fSJohn Linn MODULE_LICENSE("GPL");
3791191828fSJohn Linn 
380