1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/drivers/misc/xillybus_of.c
5 * Copyright 2011 Xillybus Ltd, http://xillybus.com
7 * Driver for the Xillybus FPGA/host framework using Open Firmware.
10 #include <linux/module.h>
11 #include <linux/device.h>
12 #include <linux/slab.h>
13 #include <linux/platform_device.h>
15 #include <linux/err.h>
18 MODULE_DESCRIPTION("Xillybus driver for Open Firmware");
19 MODULE_AUTHOR("Eli Billauer, Xillybus Ltd.");
20 MODULE_ALIAS("xillybus_of");
21 MODULE_LICENSE("GPL v2");
23 static const char xillyname
[] = "xillybus_of";
25 /* Match table for of_platform binding */
26 static const struct of_device_id xillybus_of_match
[] = {
27 { .compatible
= "xillybus,xillybus-1.00.a", },
28 { .compatible
= "xlnx,xillybus-1.00.a", }, /* Deprecated */
32 MODULE_DEVICE_TABLE(of
, xillybus_of_match
);
34 static int xilly_drv_probe(struct platform_device
*op
)
36 struct device
*dev
= &op
->dev
;
37 struct xilly_endpoint
*endpoint
;
41 endpoint
= xillybus_init_endpoint(dev
);
46 dev_set_drvdata(dev
, endpoint
);
48 endpoint
->owner
= THIS_MODULE
;
50 endpoint
->registers
= devm_platform_ioremap_resource(op
, 0);
51 if (IS_ERR(endpoint
->registers
))
52 return PTR_ERR(endpoint
->registers
);
54 irq
= platform_get_irq(op
, 0);
56 rc
= devm_request_irq(dev
, irq
, xillybus_isr
, 0, xillyname
, endpoint
);
59 dev_err(endpoint
->dev
,
60 "Failed to register IRQ handler. Aborting.\n");
64 return xillybus_endpoint_discovery(endpoint
);
67 static void xilly_drv_remove(struct platform_device
*op
)
69 struct device
*dev
= &op
->dev
;
70 struct xilly_endpoint
*endpoint
= dev_get_drvdata(dev
);
72 xillybus_endpoint_remove(endpoint
);
75 static struct platform_driver xillybus_platform_driver
= {
76 .probe
= xilly_drv_probe
,
77 .remove
= xilly_drv_remove
,
80 .of_match_table
= xillybus_of_match
,
84 module_platform_driver(xillybus_platform_driver
);