Introduction
This article describes how to perform FPGA circuit configuration from Linux on a SoC FPGA target.
In recent Linux kernel versions (v4.x~), the FPGA-related driver mechanism has been changed, and the methods that were available in older kernel versions (v3.x) are no longer supported.
Therefore, this section introduces configuration methods that can be used with recent kernel versions.
For reference:
If you are using an older kernel version, please refer to the following article:
FPGA Configuration from Linux | Rocketboards.org
1. Preparing the device tree file
When configuring FPGAs with recent kernel versions, a mechanism called device tree overlay is used. To use the device tree overlay, the following two device trees must be described.
- Base device tree (applied at Linux boot time)
- Device tree for Overlay (applied when Overlay is executed)
2. Device tree overlay execution (configuration execution)
Execute the device tree overlay from a Linux terminal booted using the base device tree including "fpga-region" by following the steps below.
- Preparation: Store the device tree for overlay (.dtb) and configuration data (.rbf) in the designated location.
- Execute overlay: Specify the -a option and the device tree for Overlay to the dtbt command.
- Delete overlay: Specify the -r option to the dtbt command (* only if you want to delete it).
For details, refer to the terminal image and balloon comment at the time of execution.
3. Supplementary information (control of HPS-FPGA bridge during configuration execution)
When executing the FPGA-side configuration, control is required to disable the HPS-FPGA bridge in advance and re-enable it after the configuration is completed, so that the HPS-FPGA bridge is disabled during the configuration execution.
However, when using the device tree overlay mechanism, the bridge is automatically controlled, so there is no need to perform the disable/enable operation separately.
Conclusion
In this article, we have introduced the FPGA configuration method using the device tree overlay.
For more detailed information, please also refer to the kernel source tree documentation.
Documentation/devicetree/overlay-notes.txt
Documentation/devicetree/bindings/fpga/fpga-region.txt
Reference:
Links to other related information are also provided.
HOWTO Create a Device Tree | Rocketboards.org
The Devicetree Specification | devicetree.org
Upstream v5.0 Kernel Device Tree Changes | Rocketboards.org