fpga-region.rst 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. FPGA Region
  2. ===========
  3. Overview
  4. --------
  5. This document is meant to be a brief overview of the FPGA region API usage. A
  6. more conceptual look at regions can be found in the Device Tree binding
  7. document [#f1]_.
  8. For the purposes of this API document, let's just say that a region associates
  9. an FPGA Manager and a bridge (or bridges) with a reprogrammable region of an
  10. FPGA or the whole FPGA. The API provides a way to register a region and to
  11. program a region.
  12. Currently the only layer above fpga-region.c in the kernel is the Device Tree
  13. support (of-fpga-region.c) described in [#f1]_. The DT support layer uses regions
  14. to program the FPGA and then DT to handle enumeration. The common region code
  15. is intended to be used by other schemes that have other ways of accomplishing
  16. enumeration after programming.
  17. An fpga-region can be set up to know the following things:
  18. * which FPGA manager to use to do the programming
  19. * which bridges to disable before programming and enable afterwards.
  20. Additional info needed to program the FPGA image is passed in the struct
  21. fpga_image_info including:
  22. * pointers to the image as either a scatter-gather buffer, a contiguous
  23. buffer, or the name of firmware file
  24. * flags indicating specifics such as whether the image is for partial
  25. reconfiguration.
  26. How to add a new FPGA region
  27. ----------------------------
  28. An example of usage can be seen in the probe function of [#f2]_.
  29. .. [#f1] ../devicetree/bindings/fpga/fpga-region.txt
  30. .. [#f2] ../../drivers/fpga/of-fpga-region.c
  31. API to add a new FPGA region
  32. ----------------------------
  33. * struct fpga_region - The FPGA region struct
  34. * struct fpga_region_info - Parameter structure for fpga_region_register_full()
  35. * fpga_region_register_full() - Create and register an FPGA region using the
  36. fpga_region_info structure to provide the full flexibility of options
  37. * fpga_region_register() - Create and register an FPGA region using standard
  38. arguments
  39. * fpga_region_unregister() - Unregister an FPGA region
  40. The FPGA region's probe function will need to get a reference to the FPGA
  41. Manager it will be using to do the programming. This usually would happen
  42. during the region's probe function.
  43. * fpga_mgr_get() - Get a reference to an FPGA manager, raise ref count
  44. * of_fpga_mgr_get() - Get a reference to an FPGA manager, raise ref count,
  45. given a device node.
  46. * fpga_mgr_put() - Put an FPGA manager
  47. The FPGA region will need to specify which bridges to control while programming
  48. the FPGA. The region driver can build a list of bridges during probe time
  49. (:c:expr:`fpga_region->bridge_list`) or it can have a function that creates
  50. the list of bridges to program just before programming
  51. (:c:expr:`fpga_region->get_bridges`). The FPGA bridge framework supplies the
  52. following APIs to handle building or tearing down that list.
  53. * fpga_bridge_get_to_list() - Get a ref of an FPGA bridge, add it to a
  54. list
  55. * of_fpga_bridge_get_to_list() - Get a ref of an FPGA bridge, add it to a
  56. list, given a device node
  57. * fpga_bridges_put() - Given a list of bridges, put them
  58. .. kernel-doc:: include/linux/fpga/fpga-region.h
  59. :functions: fpga_region
  60. .. kernel-doc:: include/linux/fpga/fpga-region.h
  61. :functions: fpga_region_info
  62. .. kernel-doc:: drivers/fpga/fpga-region.c
  63. :functions: fpga_region_register_full
  64. .. kernel-doc:: drivers/fpga/fpga-region.c
  65. :functions: fpga_region_register
  66. .. kernel-doc:: drivers/fpga/fpga-region.c
  67. :functions: fpga_region_unregister
  68. .. kernel-doc:: drivers/fpga/fpga-mgr.c
  69. :functions: fpga_mgr_get
  70. .. kernel-doc:: drivers/fpga/fpga-mgr.c
  71. :functions: of_fpga_mgr_get
  72. .. kernel-doc:: drivers/fpga/fpga-mgr.c
  73. :functions: fpga_mgr_put
  74. .. kernel-doc:: drivers/fpga/fpga-bridge.c
  75. :functions: fpga_bridge_get_to_list
  76. .. kernel-doc:: drivers/fpga/fpga-bridge.c
  77. :functions: of_fpga_bridge_get_to_list
  78. .. kernel-doc:: drivers/fpga/fpga-bridge.c
  79. :functions: fpga_bridges_put