[PATCH v3 00/16] Enable upper layers using FPGA region w/o device tree

From: Alan Tull
Date: Thu Jul 06 2017 - 14:47:30 EST


* Change the fpga-mgr API to have one fpga_mgr_load function
instead of three.

* Expose API functions for FPGA region

* Separate common FPGA region code from Device Tree support

* Add API functions for bridges where DT is not used.

This is needed because the current FPGA layer has a couple of problems:

* We now have 3 functions for programming a FPGA, depending on whether
the image is in a sg list, a buffer, or firmware. So upper layers
have to be written assuming where the image will be or will have to
write extra code to maintain flexibility.

* users who aren't using device tree are left to write their
own code that is essentially a rewrite of FPGA region.

Currently on the linux-fpga git repo as branch
next-20170615-fpga-region-api-v3

Patch 1 updates documentation and adds a FPGA region API doc.

Patch 2 adds non-dt support for fpga-bridges

Patch 3 changes the FPGA manager API, replacing the 3 FPGA load
functions with a single function that can handle whether the image
is a sg list, a contiguous buffer, or a firmware file.

Patch 4 separates getting a ref to a manager from locking it so
code can hang onto a ref without preventing other users from
using the manager to program a FPGA.

Patches 5 to 16 separate FPGA region common code from DT overlay
support and adds API functions. Functional code changes are separated
into a bunch of little patches. The last patch actually moves code to
of-fpga-region.c with only minor init/probe changes as this becomes
two modules.

I've tested this functionally for all patches separately.

Code changes from v3 are pretty small.

Changes in v3:
* rewrite fpga-region.txt
* fix bisect, test on each patch
* change fpga_region_program_fpga take only the region as a parameter
* update docs for fpga_region_program_fpga change

Changes in v2:
* split the final (large) patch into smaller patches for easier reviewability.
* documentation has been expanded
* reorder things, clean up
* dev_err instead of pr_err
* move functions that alloc/free image info from fpga-region.c to fpga-mgr.c
* move fpga-region.h to include/linux/fpga/
* add fpga_region_class_find to fpga-region.c
* move of_fpga_region_find to of-fpga-region.c

Alan Tull (16):
doc: fpga: update documents for the FPGA API
fpga: bridge: support getting bridge from device
fpga: mgr: API change to replace fpga load functions with single
function
fpga: mgr: separate getting/locking FPGA manager
fpga: region: use dev_err instead of pr_err
fpga: region: remove unneeded of_node_get and put
fpga: region: get mgr early on
fpga: region: check for child regions before allocing image info
fpga: region: fix slow warning with more than one overlay
fpga: region: use image info as parameter for programming region
fpga: region: separate out code that parses the overlay
fpga: region: add fpga-region.h header
fpga: region: rename some functions prior to moving
fpga: region: add register/unregister functions
fpga: region: add fpga_region_class_find
fpga: region: move device tree support to of-fpga-region.c

Documentation/fpga/fpga-mgr.txt | 133 +++++-----
Documentation/fpga/fpga-region.txt | 95 +++++++
Documentation/fpga/overview.txt | 23 ++
drivers/fpga/Kconfig | 13 +-
drivers/fpga/Makefile | 1 +
drivers/fpga/fpga-bridge.c | 110 +++++++--
drivers/fpga/fpga-mgr.c | 111 +++++++--
drivers/fpga/fpga-region.c | 463 ++++------------------------------
drivers/fpga/of-fpga-region.c | 495 +++++++++++++++++++++++++++++++++++++
include/linux/fpga/fpga-bridge.h | 7 +-
include/linux/fpga/fpga-mgr.h | 29 ++-
include/linux/fpga/fpga-region.h | 38 +++
12 files changed, 975 insertions(+), 543 deletions(-)
create mode 100644 Documentation/fpga/fpga-region.txt
create mode 100644 Documentation/fpga/overview.txt
create mode 100644 drivers/fpga/of-fpga-region.c
create mode 100644 include/linux/fpga/fpga-region.h

--
2.7.4