@@ -6842,6 +6842,7 @@ S: Maintained
F: Documentation/ABI/testing/sysfs-bus-fpga-dfl
F: Documentation/fpga/dfl.rst
F: drivers/fpga/dfl*
+F: include/linux/fpga/dfl.h
F: include/uapi/linux/fpga-dfl.h
FPGA MANAGER FRAMEWORK
@@ -11,6 +11,7 @@
* Xiao Guangrong <guangrong.xiao@linux.intel.com>
*/
#include <linux/fpga-dfl.h>
+#include <linux/fpga/dfl.h>
#include <linux/module.h>
#include <linux/uaccess.h>
@@ -517,77 +517,4 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev,
struct dfl_feature *feature,
unsigned long arg);
-/**
- * enum fpga_dfl_id_type - define the FPGA DFL FIU types
- */
-enum fpga_dfl_id_type {
- FPGA_DFL_FME_ID = 0,
- FPGA_DFL_PORT_ID = 1,
- FPGA_DFL_ID_MAX,
-};
-
-/**
- * struct fpga_dfl_device - represent an fpga dfl device on fpga dfl bus
- *
- * @dev: generic device interface.
- * @id: id of the fpga dfl device.
- * @type: FPGA DFL FIU type of the device, see enum fpga_dfl_id_type.
- * @feature_id: feature identifier local to its FPGA DFL FIU type.
- * @mmio_res: mmio resource of this fpga dfl device.
- * @irqs: list of Linux IRQ numbers of this fpga dfl device.
- * @num_irqs: number of IRQs supported by this fpga dfl device.
- * @cdev: pointer to DFL FPGA container device this fpga dfl device belongs to.
- * @id_entry: matched id entry in fpga dfl driver's id table.
- */
-struct fpga_dfl_device {
- struct device dev;
- int id;
- u16 type;
- u16 feature_id;
- struct resource mmio_res;
- int *irqs;
- unsigned int num_irqs;
- struct dfl_fpga_cdev *cdev;
- const struct fpga_dfl_device_id *id_entry;
-};
-
-/**
- * struct fpga_dfl_driver - represent a fpga dfl device driver
- *
- * @drv: driver model structure.
- * @id_table: pointer to table of device IDs the driver is interested in.
- * { } member terminated.
- * @probe: mandatory callback for device binding.
- * @remove: callback for device unbinding.
- */
-struct fpga_dfl_driver {
- struct device_driver drv;
- const struct fpga_dfl_device_id *id_table;
-
- int (*probe)(struct fpga_dfl_device *fddev);
- void (*remove)(struct fpga_dfl_device *fddev);
-};
-
-#define to_fpga_dfl_dev(d) container_of(d, struct fpga_dfl_device, dev)
-#define to_fpga_dfl_drv(d) container_of(d, struct fpga_dfl_driver, drv)
-
-/*
- * use a macro to avoid include chaining to get THIS_MODULE.
- */
-#define fpga_dfl_driver_register(drv) \
- __fpga_dfl_driver_register(drv, THIS_MODULE)
-int __fpga_dfl_driver_register(struct fpga_dfl_driver *fddrv,
- struct module *owner);
-void fpga_dfl_driver_unregister(struct fpga_dfl_driver *fddrv);
-
-/*
- * module_fpga_dfl_driver() - Helper macro for drivers that don't do
- * anything special in module init/exit. This eliminates a lot of
- * boilerplate. Each module may only use this macro once, and
- * calling it replaces module_init() and module_exit().
- */
-#define module_fpga_dfl_driver(__fpga_dfl_driver) \
- module_driver(__fpga_dfl_driver, fpga_dfl_driver_register, \
- fpga_dfl_driver_unregister)
-
#endif /* __FPGA_DFL_H */
new file mode 100644
@@ -0,0 +1,87 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Header file for FPGA DFL driver and device API
+ *
+ * Copyright (C) 2020 Intel Corporation, Inc.
+ */
+
+#ifndef __LINUX_FPGA_DFL_H
+#define __LINUX_FPGA_DFL_H
+
+#include <linux/device.h>
+#include <linux/mod_devicetable.h>
+
+/**
+ * enum fpga_dfl_id_type - define the FPGA DFL FIU types
+ */
+enum fpga_dfl_id_type {
+ FPGA_DFL_FME_ID = 0,
+ FPGA_DFL_PORT_ID = 1,
+ FPGA_DFL_ID_MAX,
+};
+
+/**
+ * struct fpga_dfl_device - represent an fpga dfl device on fpga dfl bus
+ *
+ * @dev: generic device interface.
+ * @id: id of the fpga dfl device.
+ * @type: FPGA DFL FIU type of the device, see enum fpga_dfl_id_type.
+ * @feature_id: feature identifier local to its FPGA DFL FIU type.
+ * @mmio_res: mmio resource of this fpga dfl device.
+ * @irqs: list of Linux IRQ numbers of this fpga dfl device.
+ * @num_irqs: number of IRQs supported by this fpga dfl device.
+ * @cdev: pointer to DFL FPGA container device this fpga dfl device belongs to.
+ * @id_entry: matched id entry in fpga dfl driver's id table.
+ */
+struct fpga_dfl_device {
+ struct device dev;
+ int id;
+ u16 type;
+ u16 feature_id;
+ struct resource mmio_res;
+ int *irqs;
+ unsigned int num_irqs;
+ struct dfl_fpga_cdev *cdev;
+ const struct fpga_dfl_device_id *id_entry;
+};
+
+/**
+ * struct fpga_dfl_driver - represent a fpga dfl device driver
+ *
+ * @drv: driver model structure.
+ * @id_table: pointer to table of device IDs the driver is interested in.
+ * { } member terminated.
+ * @probe: mandatory callback for device binding.
+ * @remove: callback for device unbinding.
+ */
+struct fpga_dfl_driver {
+ struct device_driver drv;
+ const struct fpga_dfl_device_id *id_table;
+
+ int (*probe)(struct fpga_dfl_device *fddev);
+ void (*remove)(struct fpga_dfl_device *fddev);
+};
+
+#define to_fpga_dfl_dev(d) container_of(d, struct fpga_dfl_device, dev)
+#define to_fpga_dfl_drv(d) container_of(d, struct fpga_dfl_driver, drv)
+
+/*
+ * use a macro to avoid include chaining to get THIS_MODULE.
+ */
+#define fpga_dfl_driver_register(drv) \
+ __fpga_dfl_driver_register(drv, THIS_MODULE)
+int __fpga_dfl_driver_register(struct fpga_dfl_driver *fddrv,
+ struct module *owner);
+void fpga_dfl_driver_unregister(struct fpga_dfl_driver *fddrv);
+
+/*
+ * module_fpga_dfl_driver() - Helper macro for drivers that don't do
+ * anything special in module init/exit. This eliminates a lot of
+ * boilerplate. Each module may only use this macro once, and
+ * calling it replaces module_init() and module_exit().
+ */
+#define module_fpga_dfl_driver(__fpga_dfl_driver) \
+ module_driver(__fpga_dfl_driver, fpga_dfl_driver_register, \
+ fpga_dfl_driver_unregister)
+
+#endif /* __LINUX_FPGA_DFL_H */