1 /* SPDX-License-Identifier: GPL-2.0 */
6 #include <linux/device.h>
7 #include <linux/fpga/fpga-mgr.h>
8 #include <linux/fpga/fpga-bridge.h>
13 * struct fpga_region_info - collection of parameters an FPGA Region
14 * @mgr: fpga region manager
15 * @compat_id: FPGA region id for compatibility check.
16 * @priv: fpga region private data
17 * @get_bridges: optional function to get bridges to a list
19 * fpga_region_info contains parameters for the register_full function.
20 * These are separated into an info structure because they some are optional
21 * others could be added to in the future. The info structure facilitates
22 * maintaining a stable API.
24 struct fpga_region_info {
25 struct fpga_manager *mgr;
26 struct fpga_compat_id *compat_id;
28 int (*get_bridges)(struct fpga_region *region);
32 * struct fpga_region - FPGA Region structure
33 * @dev: FPGA Region device
34 * @mutex: enforces exclusive reference to region
35 * @bridge_list: list of FPGA bridges specified in region
37 * @info: FPGA image info
38 * @compat_id: FPGA region id for compatibility check.
40 * @get_bridges: optional function to get bridges to a list
44 struct mutex mutex; /* for exclusive reference to region */
45 struct list_head bridge_list;
46 struct fpga_manager *mgr;
47 struct fpga_image_info *info;
48 struct fpga_compat_id *compat_id;
50 int (*get_bridges)(struct fpga_region *region);
53 #define to_fpga_region(d) container_of(d, struct fpga_region, dev)
55 struct fpga_region *fpga_region_class_find(
56 struct device *start, const void *data,
57 int (*match)(struct device *, const void *));
59 int fpga_region_program_fpga(struct fpga_region *region);
62 fpga_region_register_full(struct device *parent, const struct fpga_region_info *info);
65 fpga_region_register(struct device *parent, struct fpga_manager *mgr,
66 int (*get_bridges)(struct fpga_region *));
67 void fpga_region_unregister(struct fpga_region *region);
69 #endif /* _FPGA_REGION_H */