[LINUX] Configure FPGA in FPGA Subsystem (FPGA-region)


I would like to write about the FPGA subsystem for configuring the FPGA, which is also included in the mainline Kernel of Linux. It is mainly used when running an FPGA with an ARM CPU on Linux. You can configure the FPGA by overlaying the FPGA region of this Subsystem using the device tree overlay mechanism. It is a mechanism that even supports Partial Reconfiguration, but for the time being, I will mainly write about the case of configuring the entire FPGA.

For your reference: I checked the device tree, I checked the device tree Overlay

Components and how they work

The FPGA Subsystem consists of the following three frameworks.

Device tree description required for FPGA configuration

Write a device tree description for configuring an FPGA using the FPGA subsystem.

In Base Tree

At least the following nodes must be in the Base Device tree (the device tree that is loaded at startup).


	fpga_mgr: fpga-mgr@ff706000 {
		compatible = "altr,socfpga-fpga-mgr";

	fpga_bridge0: fpga-bridge@ff400000 {
		compatible = "altr,socfpga-lwhps2fpga-bridge";

	base_fpga_region0: base-fpga-region0 {
		compatible = "fpga-region";
		fpga-mgr = <&fpga_mgr>;

In Overlay

The configuration can be executed by writing the following in the device tree overlay file. Describe the following property and node in the node directly under the root.


/ {
    fragment@0 {
        target = <&base_fpga_region0>;
        __overlay__ {
            firmware-name = "soc_system.rbf"; 

Reference material

Kernel Source Tree Documentation / devicetree / bindings / fpga / fpga-region.txt https://www.kernel.org/doc/html/latest/driver-api/fpga/index.html https://elinux.org/images/8/88/Fpga_and_dt.pdf Solution Zynq PL Programming With FPGA Manager FPGA support situation in Linux Kernel 4.10

Recommended Posts

Configure FPGA in FPGA Subsystem (FPGA-region)