aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/driver-api/fpga/fpga-region.rst
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-05 19:20:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-05 19:20:22 -0400
commitabf7dba7c4f77d781f6df50fefb19a64c5dc331f (patch)
tree38648731b502d5aec508f3b33f6616190e598eb6 /Documentation/driver-api/fpga/fpga-region.rst
parent07c4dd3435aa387d3b58f4e941dc516513f14507 (diff)
parentb23220fe054e92f616b82450fae8cd3ab176cc60 (diff)
Merge tag 'char-misc-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH: "Here is the "big" char and misc driver patches for 4.18-rc1. It's not a lot of stuff here, but there are some highlights: - coreboot driver updates - soundwire driver updates - android binder updates - fpga big sync, mostly documentation - lots of minor driver updates All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (81 commits) vmw_balloon: fixing double free when batching mode is off MAINTAINERS: Add driver-api/fpga path fpga: clarify that unregister functions also free documentation: fpga: move fpga-region.txt to driver-api documentation: fpga: add bridge document to driver-api documentation: fpga: move fpga-mgr.txt to driver-api Documentation: fpga: move fpga overview to driver-api fpga: region: kernel-doc fixes fpga: bridge: kernel-doc fixes fpga: mgr: kernel-doc fixes fpga: use SPDX fpga: region: change api, add fpga_region_create/free fpga: bridge: change api, don't use drvdata fpga: manager: change api, don't use drvdata fpga: region: don't use drvdata in common fpga code Drivers: hv: vmbus: Removed an unnecessary cast from void * ver_linux: Drop redundant calls to system() to test if file is readable ver_linux: Move stderr redirection from function parameter to function body misc: IBM Virtual Management Channel Driver (VMC) rpmsg: Correct support for MODULE_DEVICE_TABLE() ...
Diffstat (limited to 'Documentation/driver-api/fpga/fpga-region.rst')
-rw-r--r--Documentation/driver-api/fpga/fpga-region.rst102
1 files changed, 102 insertions, 0 deletions
diff --git a/Documentation/driver-api/fpga/fpga-region.rst b/Documentation/driver-api/fpga/fpga-region.rst
new file mode 100644
index 000000000000..f89e4a311722
--- /dev/null
+++ b/Documentation/driver-api/fpga/fpga-region.rst
@@ -0,0 +1,102 @@
1FPGA Region
2===========
3
4Overview
5--------
6
7This document is meant to be an brief overview of the FPGA region API usage. A
8more conceptual look at regions can be found in the Device Tree binding
9document [#f1]_.
10
11For the purposes of this API document, let's just say that a region associates
12an FPGA Manager and a bridge (or bridges) with a reprogrammable region of an
13FPGA or the whole FPGA. The API provides a way to register a region and to
14program a region.
15
16Currently the only layer above fpga-region.c in the kernel is the Device Tree
17support (of-fpga-region.c) described in [#f1]_. The DT support layer uses regions
18to program the FPGA and then DT to handle enumeration. The common region code
19is intended to be used by other schemes that have other ways of accomplishing
20enumeration after programming.
21
22An fpga-region can be set up to know the following things:
23
24 * which FPGA manager to use to do the programming
25
26 * which bridges to disable before programming and enable afterwards.
27
28Additional info needed to program the FPGA image is passed in the struct
29fpga_image_info including:
30
31 * pointers to the image as either a scatter-gather buffer, a contiguous
32 buffer, or the name of firmware file
33
34 * flags indicating specifics such as whether the image if for partial
35 reconfiguration.
36
37How to program a FPGA using a region
38------------------------------------
39
40First, allocate the info struct::
41
42 info = fpga_image_info_alloc(dev);
43 if (!info)
44 return -ENOMEM;
45
46Set flags as needed, i.e.::
47
48 info->flags |= FPGA_MGR_PARTIAL_RECONFIG;
49
50Point to your FPGA image, such as::
51
52 info->sgt = &sgt;
53
54Add info to region and do the programming::
55
56 region->info = info;
57 ret = fpga_region_program_fpga(region);
58
59:c:func:`fpga_region_program_fpga()` operates on info passed in the
60fpga_image_info (region->info). This function will attempt to:
61
62 * lock the region's mutex
63 * lock the region's FPGA manager
64 * build a list of FPGA bridges if a method has been specified to do so
65 * disable the bridges
66 * program the FPGA
67 * re-enable the bridges
68 * release the locks
69
70Then you will want to enumerate whatever hardware has appeared in the FPGA.
71
72How to add a new FPGA region
73----------------------------
74
75An example of usage can be seen in the probe function of [#f2]_.
76
77.. [#f1] ../devicetree/bindings/fpga/fpga-region.txt
78.. [#f2] ../../drivers/fpga/of-fpga-region.c
79
80API to program a FGPA
81---------------------
82
83.. kernel-doc:: drivers/fpga/fpga-region.c
84 :functions: fpga_region_program_fpga
85
86API to add a new FPGA region
87----------------------------
88
89.. kernel-doc:: include/linux/fpga/fpga-region.h
90 :functions: fpga_region
91
92.. kernel-doc:: drivers/fpga/fpga-region.c
93 :functions: fpga_region_create
94
95.. kernel-doc:: drivers/fpga/fpga-region.c
96 :functions: fpga_region_free
97
98.. kernel-doc:: drivers/fpga/fpga-region.c
99 :functions: fpga_region_register
100
101.. kernel-doc:: drivers/fpga/fpga-region.c
102 :functions: fpga_region_unregister