1
2
3#ifndef _LINUX_FPGA_BRIDGE_H
4#define _LINUX_FPGA_BRIDGE_H
5
6#include <linux/device.h>
7#include <linux/fpga/fpga-mgr.h>
8
9struct fpga_bridge;
10
11
12
13
14
15
16
17
18struct fpga_bridge_ops {
19 int (*enable_show)(struct fpga_bridge *bridge);
20 int (*enable_set)(struct fpga_bridge *bridge, bool enable);
21 void (*fpga_bridge_remove)(struct fpga_bridge *bridge);
22 const struct attribute_group **groups;
23};
24
25
26
27
28
29
30
31
32
33
34
35struct fpga_bridge {
36 const char *name;
37 struct device dev;
38 struct mutex mutex;
39 const struct fpga_bridge_ops *br_ops;
40 struct fpga_image_info *info;
41 struct list_head node;
42 void *priv;
43};
44
45#define to_fpga_bridge(d) container_of(d, struct fpga_bridge, dev)
46
47struct fpga_bridge *of_fpga_bridge_get(struct device_node *node,
48 struct fpga_image_info *info);
49struct fpga_bridge *fpga_bridge_get(struct device *dev,
50 struct fpga_image_info *info);
51void fpga_bridge_put(struct fpga_bridge *bridge);
52int fpga_bridge_enable(struct fpga_bridge *bridge);
53int fpga_bridge_disable(struct fpga_bridge *bridge);
54
55int fpga_bridges_enable(struct list_head *bridge_list);
56int fpga_bridges_disable(struct list_head *bridge_list);
57void fpga_bridges_put(struct list_head *bridge_list);
58int fpga_bridge_get_to_list(struct device *dev,
59 struct fpga_image_info *info,
60 struct list_head *bridge_list);
61int of_fpga_bridge_get_to_list(struct device_node *np,
62 struct fpga_image_info *info,
63 struct list_head *bridge_list);
64
65struct fpga_bridge *fpga_bridge_create(struct device *dev, const char *name,
66 const struct fpga_bridge_ops *br_ops,
67 void *priv);
68void fpga_bridge_free(struct fpga_bridge *br);
69int fpga_bridge_register(struct fpga_bridge *br);
70void fpga_bridge_unregister(struct fpga_bridge *br);
71
72struct fpga_bridge
73*devm_fpga_bridge_create(struct device *dev, const char *name,
74 const struct fpga_bridge_ops *br_ops, void *priv);
75
76#endif
77