blob: b6520318ab9c602aace6eafb325d056f7f90c49f [file] [log] [blame]
Alan Tull59460a92017-11-15 14:20:21 -06001#ifndef _FPGA_REGION_H
2#define _FPGA_REGION_H
3
4#include <linux/device.h>
5#include <linux/fpga/fpga-mgr.h>
6#include <linux/fpga/fpga-bridge.h>
7
8/**
9 * struct fpga_region - FPGA Region structure
10 * @dev: FPGA Region device
11 * @mutex: enforces exclusive reference to region
12 * @bridge_list: list of FPGA bridges specified in region
13 * @mgr: FPGA manager
14 * @info: FPGA image info
Alan Tull52a3a7c2017-11-15 14:20:23 -060015 * @priv: private data
16 * @get_bridges: optional function to get bridges to a list
Alan Tull845089b2017-11-15 14:20:28 -060017 * @groups: optional attribute groups.
Alan Tull59460a92017-11-15 14:20:21 -060018 */
19struct fpga_region {
20 struct device dev;
21 struct mutex mutex; /* for exclusive reference to region */
22 struct list_head bridge_list;
23 struct fpga_manager *mgr;
24 struct fpga_image_info *info;
Alan Tull52a3a7c2017-11-15 14:20:23 -060025 void *priv;
26 int (*get_bridges)(struct fpga_region *region);
Alan Tull845089b2017-11-15 14:20:28 -060027 const struct attribute_group **groups;
Alan Tull59460a92017-11-15 14:20:21 -060028};
29
30#define to_fpga_region(d) container_of(d, struct fpga_region, dev)
31
Alan Tull503d4b72017-11-15 14:20:24 -060032struct fpga_region *fpga_region_class_find(
33 struct device *start, const void *data,
34 int (*match)(struct device *, const void *));
Alan Tull59460a92017-11-15 14:20:21 -060035
Alan Tull503d4b72017-11-15 14:20:24 -060036int fpga_region_program_fpga(struct fpga_region *region);
Alan Tull52a3a7c2017-11-15 14:20:23 -060037int fpga_region_register(struct device *dev, struct fpga_region *region);
38int fpga_region_unregister(struct fpga_region *region);
39
Alan Tull59460a92017-11-15 14:20:21 -060040#endif /* _FPGA_REGION_H */