0001
0002
0003 #ifndef _LINUX_FPGA_BRIDGE_H
0004 #define _LINUX_FPGA_BRIDGE_H
0005
0006 #include <linux/device.h>
0007 #include <linux/fpga/fpga-mgr.h>
0008
0009 struct fpga_bridge;
0010
0011
0012
0013
0014
0015
0016
0017
0018 struct fpga_bridge_ops {
0019 int (*enable_show)(struct fpga_bridge *bridge);
0020 int (*enable_set)(struct fpga_bridge *bridge, bool enable);
0021 void (*fpga_bridge_remove)(struct fpga_bridge *bridge);
0022 const struct attribute_group **groups;
0023 };
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 struct fpga_bridge_info {
0037 const char *name;
0038 const struct fpga_bridge_ops *br_ops;
0039 void *priv;
0040 };
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 struct fpga_bridge {
0053 const char *name;
0054 struct device dev;
0055 struct mutex mutex;
0056 const struct fpga_bridge_ops *br_ops;
0057 struct fpga_image_info *info;
0058 struct list_head node;
0059 void *priv;
0060 };
0061
0062 #define to_fpga_bridge(d) container_of(d, struct fpga_bridge, dev)
0063
0064 struct fpga_bridge *of_fpga_bridge_get(struct device_node *node,
0065 struct fpga_image_info *info);
0066 struct fpga_bridge *fpga_bridge_get(struct device *dev,
0067 struct fpga_image_info *info);
0068 void fpga_bridge_put(struct fpga_bridge *bridge);
0069 int fpga_bridge_enable(struct fpga_bridge *bridge);
0070 int fpga_bridge_disable(struct fpga_bridge *bridge);
0071
0072 int fpga_bridges_enable(struct list_head *bridge_list);
0073 int fpga_bridges_disable(struct list_head *bridge_list);
0074 void fpga_bridges_put(struct list_head *bridge_list);
0075 int fpga_bridge_get_to_list(struct device *dev,
0076 struct fpga_image_info *info,
0077 struct list_head *bridge_list);
0078 int of_fpga_bridge_get_to_list(struct device_node *np,
0079 struct fpga_image_info *info,
0080 struct list_head *bridge_list);
0081
0082 struct fpga_bridge *
0083 fpga_bridge_register(struct device *parent, const char *name,
0084 const struct fpga_bridge_ops *br_ops,
0085 void *priv);
0086 void fpga_bridge_unregister(struct fpga_bridge *br);
0087
0088 #endif