aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fpga/dfl.h
diff options
context:
space:
mode:
authorWu Hao <hao.wu@intel.com>2018-06-29 20:53:14 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-15 07:55:45 -0400
commitb16c5147dc3b1a03405f58f6864b56f29ab7aaf9 (patch)
tree44bd3431d59ec4e9d4f25c83cf1905a342074303 /drivers/fpga/dfl.h
parent543be3d8c999b30e1e1c05d30c1ea3f2d922340b (diff)
fpga: dfl: add chardev support for feature devices
For feature devices drivers, both the FPGA Management Engine (FME) and Accelerated Function Unit (AFU) driver need to expose user interfaces via the device file, for example, mmap and ioctls. This patch adds chardev support in the dfl driver for feature devices, FME and AFU. It reserves the chardev regions for FME and AFU and provide interfaces for FME and AFU driver to register their device file operations. Signed-off-by: Tim Whisonant <tim.whisonant@intel.com> Signed-off-by: Enno Luebbers <enno.luebbers@intel.com> Signed-off-by: Shiva Rao <shiva.rao@intel.com> Signed-off-by: Christopher Rauer <christopher.rauer@intel.com> Signed-off-by: Zhang Yi <yi.z.zhang@intel.com> Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com> Signed-off-by: Wu Hao <hao.wu@intel.com> Acked-by: Alan Tull <atull@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/fpga/dfl.h')
-rw-r--r--drivers/fpga/dfl.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h
index 47ecb3bb6f61..66c2ade5a06b 100644
--- a/drivers/fpga/dfl.h
+++ b/drivers/fpga/dfl.h
@@ -15,6 +15,7 @@
15#define __FPGA_DFL_H 15#define __FPGA_DFL_H
16 16
17#include <linux/bitfield.h> 17#include <linux/bitfield.h>
18#include <linux/cdev.h>
18#include <linux/delay.h> 19#include <linux/delay.h>
19#include <linux/fs.h> 20#include <linux/fs.h>
20#include <linux/iopoll.h> 21#include <linux/iopoll.h>
@@ -150,6 +151,7 @@ struct dfl_feature {
150 * 151 *
151 * @node: node to link feature devs to container device's port_dev_list. 152 * @node: node to link feature devs to container device's port_dev_list.
152 * @lock: mutex to protect platform data. 153 * @lock: mutex to protect platform data.
154 * @cdev: cdev of feature dev.
153 * @dev: ptr to platform device linked with this platform data. 155 * @dev: ptr to platform device linked with this platform data.
154 * @dfl_cdev: ptr to container device. 156 * @dfl_cdev: ptr to container device.
155 * @disable_count: count for port disable. 157 * @disable_count: count for port disable.
@@ -159,6 +161,7 @@ struct dfl_feature {
159struct dfl_feature_platform_data { 161struct dfl_feature_platform_data {
160 struct list_head node; 162 struct list_head node;
161 struct mutex lock; 163 struct mutex lock;
164 struct cdev cdev;
162 struct platform_device *dev; 165 struct platform_device *dev;
163 struct dfl_fpga_cdev *dfl_cdev; 166 struct dfl_fpga_cdev *dfl_cdev;
164 unsigned int disable_count; 167 unsigned int disable_count;
@@ -176,6 +179,11 @@ static inline int dfl_feature_platform_data_size(const int num)
176 num * sizeof(struct dfl_feature); 179 num * sizeof(struct dfl_feature);
177} 180}
178 181
182int dfl_fpga_dev_ops_register(struct platform_device *pdev,
183 const struct file_operations *fops,
184 struct module *owner);
185void dfl_fpga_dev_ops_unregister(struct platform_device *pdev);
186
179#define dfl_fpga_dev_for_each_feature(pdata, feature) \ 187#define dfl_fpga_dev_for_each_feature(pdata, feature) \
180 for ((feature) = (pdata)->features; \ 188 for ((feature) = (pdata)->features; \
181 (feature) < (pdata)->features + (pdata)->num; (feature)++) 189 (feature) < (pdata)->features + (pdata)->num; (feature)++)