Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 #ifndef _FPGA_REGION_H
0004 #define _FPGA_REGION_H
0005 
0006 #include <linux/device.h>
0007 #include <linux/fpga/fpga-mgr.h>
0008 #include <linux/fpga/fpga-bridge.h>
0009 
0010 struct fpga_region;
0011 
0012 /**
0013  * struct fpga_region_info - collection of parameters an FPGA Region
0014  * @mgr: fpga region manager
0015  * @compat_id: FPGA region id for compatibility check.
0016  * @priv: fpga region private data
0017  * @get_bridges: optional function to get bridges to a list
0018  *
0019  * fpga_region_info contains parameters for the register_full function.
0020  * These are separated into an info structure because they some are optional
0021  * others could be added to in the future. The info structure facilitates
0022  * maintaining a stable API.
0023  */
0024 struct fpga_region_info {
0025     struct fpga_manager *mgr;
0026     struct fpga_compat_id *compat_id;
0027     void *priv;
0028     int (*get_bridges)(struct fpga_region *region);
0029 };
0030 
0031 /**
0032  * struct fpga_region - FPGA Region structure
0033  * @dev: FPGA Region device
0034  * @mutex: enforces exclusive reference to region
0035  * @bridge_list: list of FPGA bridges specified in region
0036  * @mgr: FPGA manager
0037  * @info: FPGA image info
0038  * @compat_id: FPGA region id for compatibility check.
0039  * @priv: private data
0040  * @get_bridges: optional function to get bridges to a list
0041  */
0042 struct fpga_region {
0043     struct device dev;
0044     struct mutex mutex; /* for exclusive reference to region */
0045     struct list_head bridge_list;
0046     struct fpga_manager *mgr;
0047     struct fpga_image_info *info;
0048     struct fpga_compat_id *compat_id;
0049     void *priv;
0050     int (*get_bridges)(struct fpga_region *region);
0051 };
0052 
0053 #define to_fpga_region(d) container_of(d, struct fpga_region, dev)
0054 
0055 struct fpga_region *
0056 fpga_region_class_find(struct device *start, const void *data,
0057                int (*match)(struct device *, const void *));
0058 
0059 int fpga_region_program_fpga(struct fpga_region *region);
0060 
0061 struct fpga_region *
0062 fpga_region_register_full(struct device *parent, const struct fpga_region_info *info);
0063 
0064 struct fpga_region *
0065 fpga_region_register(struct device *parent, struct fpga_manager *mgr,
0066              int (*get_bridges)(struct fpga_region *));
0067 void fpga_region_unregister(struct fpga_region *region);
0068 
0069 #endif /* _FPGA_REGION_H */