diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-05 19:20:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-05 19:20:22 -0400 |
commit | abf7dba7c4f77d781f6df50fefb19a64c5dc331f (patch) | |
tree | 38648731b502d5aec508f3b33f6616190e598eb6 /Documentation/driver-api/fpga/fpga-region.rst | |
parent | 07c4dd3435aa387d3b58f4e941dc516513f14507 (diff) | |
parent | b23220fe054e92f616b82450fae8cd3ab176cc60 (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.rst | 102 |
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 @@ | |||
1 | FPGA Region | ||
2 | =========== | ||
3 | |||
4 | Overview | ||
5 | -------- | ||
6 | |||
7 | This document is meant to be an brief overview of the FPGA region API usage. A | ||
8 | more conceptual look at regions can be found in the Device Tree binding | ||
9 | document [#f1]_. | ||
10 | |||
11 | For the purposes of this API document, let's just say that a region associates | ||
12 | an FPGA Manager and a bridge (or bridges) with a reprogrammable region of an | ||
13 | FPGA or the whole FPGA. The API provides a way to register a region and to | ||
14 | program a region. | ||
15 | |||
16 | Currently the only layer above fpga-region.c in the kernel is the Device Tree | ||
17 | support (of-fpga-region.c) described in [#f1]_. The DT support layer uses regions | ||
18 | to program the FPGA and then DT to handle enumeration. The common region code | ||
19 | is intended to be used by other schemes that have other ways of accomplishing | ||
20 | enumeration after programming. | ||
21 | |||
22 | An 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 | |||
28 | Additional info needed to program the FPGA image is passed in the struct | ||
29 | fpga_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 | |||
37 | How to program a FPGA using a region | ||
38 | ------------------------------------ | ||
39 | |||
40 | First, allocate the info struct:: | ||
41 | |||
42 | info = fpga_image_info_alloc(dev); | ||
43 | if (!info) | ||
44 | return -ENOMEM; | ||
45 | |||
46 | Set flags as needed, i.e.:: | ||
47 | |||
48 | info->flags |= FPGA_MGR_PARTIAL_RECONFIG; | ||
49 | |||
50 | Point to your FPGA image, such as:: | ||
51 | |||
52 | info->sgt = &sgt; | ||
53 | |||
54 | Add 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 | ||
60 | fpga_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 | |||
70 | Then you will want to enumerate whatever hardware has appeared in the FPGA. | ||
71 | |||
72 | How to add a new FPGA region | ||
73 | ---------------------------- | ||
74 | |||
75 | An 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 | |||
80 | API to program a FGPA | ||
81 | --------------------- | ||
82 | |||
83 | .. kernel-doc:: drivers/fpga/fpga-region.c | ||
84 | :functions: fpga_region_program_fpga | ||
85 | |||
86 | API 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 | ||