fpga-bridge.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include <linux/device.h>
  2. #include <linux/fpga/fpga-mgr.h>
  3. #ifndef _LINUX_FPGA_BRIDGE_H
  4. #define _LINUX_FPGA_BRIDGE_H
  5. struct fpga_bridge;
  6. /**
  7. * struct fpga_bridge_ops - ops for low level FPGA bridge drivers
  8. * @enable_show: returns the FPGA bridge's status
  9. * @enable_set: set a FPGA bridge as enabled or disabled
  10. * @fpga_bridge_remove: set FPGA into a specific state during driver remove
  11. */
  12. struct fpga_bridge_ops {
  13. int (*enable_show)(struct fpga_bridge *bridge);
  14. int (*enable_set)(struct fpga_bridge *bridge, bool enable);
  15. void (*fpga_bridge_remove)(struct fpga_bridge *bridge);
  16. };
  17. /**
  18. * struct fpga_bridge - FPGA bridge structure
  19. * @name: name of low level FPGA bridge
  20. * @dev: FPGA bridge device
  21. * @mutex: enforces exclusive reference to bridge
  22. * @br_ops: pointer to struct of FPGA bridge ops
  23. * @info: fpga image specific information
  24. * @node: FPGA bridge list node
  25. * @priv: low level driver private date
  26. */
  27. struct fpga_bridge {
  28. const char *name;
  29. struct device dev;
  30. struct mutex mutex; /* for exclusive reference to bridge */
  31. const struct fpga_bridge_ops *br_ops;
  32. struct fpga_image_info *info;
  33. struct list_head node;
  34. void *priv;
  35. };
  36. #define to_fpga_bridge(d) container_of(d, struct fpga_bridge, dev)
  37. struct fpga_bridge *of_fpga_bridge_get(struct device_node *node,
  38. struct fpga_image_info *info);
  39. void fpga_bridge_put(struct fpga_bridge *bridge);
  40. int fpga_bridge_enable(struct fpga_bridge *bridge);
  41. int fpga_bridge_disable(struct fpga_bridge *bridge);
  42. int fpga_bridges_enable(struct list_head *bridge_list);
  43. int fpga_bridges_disable(struct list_head *bridge_list);
  44. void fpga_bridges_put(struct list_head *bridge_list);
  45. int fpga_bridge_get_to_list(struct device_node *np,
  46. struct fpga_image_info *info,
  47. struct list_head *bridge_list);
  48. int fpga_bridge_register(struct device *dev, const char *name,
  49. const struct fpga_bridge_ops *br_ops, void *priv);
  50. void fpga_bridge_unregister(struct device *dev);
  51. #endif /* _LINUX_FPGA_BRIDGE_H */