fpga-region.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _FPGA_REGION_H
  3. #define _FPGA_REGION_H
  4. #include <linux/device.h>
  5. #include <linux/fpga/fpga-mgr.h>
  6. #include <linux/fpga/fpga-bridge.h>
  7. /**
  8. * struct fpga_region - FPGA Region structure
  9. * @dev: FPGA Region device
  10. * @mutex: enforces exclusive reference to region
  11. * @bridge_list: list of FPGA bridges specified in region
  12. * @mgr: FPGA manager
  13. * @info: FPGA image info
  14. * @compat_id: FPGA region id for compatibility check.
  15. * @priv: private data
  16. * @get_bridges: optional function to get bridges to a list
  17. */
  18. struct fpga_region {
  19. struct device dev;
  20. struct mutex mutex; /* for exclusive reference to region */
  21. struct list_head bridge_list;
  22. struct fpga_manager *mgr;
  23. struct fpga_image_info *info;
  24. struct fpga_compat_id *compat_id;
  25. void *priv;
  26. int (*get_bridges)(struct fpga_region *region);
  27. };
  28. #define to_fpga_region(d) container_of(d, struct fpga_region, dev)
  29. struct fpga_region *fpga_region_class_find(
  30. struct device *start, const void *data,
  31. int (*match)(struct device *, const void *));
  32. int fpga_region_program_fpga(struct fpga_region *region);
  33. struct fpga_region
  34. *fpga_region_create(struct device *dev, struct fpga_manager *mgr,
  35. int (*get_bridges)(struct fpga_region *));
  36. void fpga_region_free(struct fpga_region *region);
  37. int fpga_region_register(struct fpga_region *region);
  38. void fpga_region_unregister(struct fpga_region *region);
  39. struct fpga_region
  40. *devm_fpga_region_create(struct device *dev, struct fpga_manager *mgr,
  41. int (*get_bridges)(struct fpga_region *));
  42. #endif /* _FPGA_REGION_H */