Path: blob/master/Documentation/devicetree/bindings/fpga/fpga-region.yaml
26308 views
# SPDX-License-Identifier: GPL-2.01%YAML 1.22---3$id: http://devicetree.org/schemas/fpga/fpga-region.yaml#4$schema: http://devicetree.org/meta-schemas/core.yaml#56title: FPGA Region78maintainers:9- Michal Simek <michal.simek@amd.com>1011description: |12CONTENTS13- Introduction14- Terminology15- Sequence16- FPGA Region17- Supported Use Models18- Constraints192021Introduction22============2324FPGA Regions represent FPGA's and partial reconfiguration regions of FPGA's in25the Device Tree. FPGA Regions provide a way to program FPGAs under device tree26control.2728The documentation hits some of the high points of FPGA usage and29attempts to include terminology used by both major FPGA manufacturers. This30document isn't a replacement for any manufacturers specifications for FPGA31usage.323334Terminology35===========3637Full Reconfiguration38* The entire FPGA is programmed.3940Partial Reconfiguration (PR)41* A section of an FPGA is reprogrammed while the rest of the FPGA is not42affected.43* Not all FPGA's support PR.4445Partial Reconfiguration Region (PRR)46* Also called a "reconfigurable partition"47* A PRR is a specific section of an FPGA reserved for reconfiguration.48* A base (or static) FPGA image may create a set of PRR's that later may49be independently reprogrammed many times.50* The size and specific location of each PRR is fixed.51* The connections at the edge of each PRR are fixed. The image that is loaded52into a PRR must fit and must use a subset of the region's connections.53* The busses within the FPGA are split such that each region gets its own54branch that may be gated independently.5556Persona57* Also called a "partial bit stream"58* An FPGA image that is designed to be loaded into a PRR. There may be59any number of personas designed to fit into a PRR, but only one at a time60may be loaded.61* A persona may create more regions.6263FPGA Bridge64* FPGA Bridges gate bus signals between a host and FPGA.65* FPGA Bridges should be disabled while the FPGA is being programmed to66prevent spurious signals on the cpu bus and to the soft logic.67* FPGA bridges may be actual hardware or soft logic on an FPGA.68* During Full Reconfiguration, hardware bridges between the host and FPGA69will be disabled.70* During Partial Reconfiguration of a specific region, that region's bridge71will be used to gate the busses. Traffic to other regions is not affected.72* In some implementations, the FPGA Manager transparently handles gating the73buses, eliminating the need to show the hardware FPGA bridges in the74device tree.75* An FPGA image may create a set of reprogrammable regions, each having its76own bridge and its own split of the busses in the FPGA.7778FPGA Manager79* An FPGA Manager is a hardware block that programs an FPGA under the control80of a host processor.8182Base Image83* Also called the "static image"84* An FPGA image that is designed to do full reconfiguration of the FPGA.85* A base image may set up a set of partial reconfiguration regions that may86later be reprogrammed.8788---------------- ----------------------------------89| Host CPU | | FPGA |90| | | |91| ----| | ----------- -------- |92| | H | | |==>| Bridge0 |<==>| PRR0 | |93| | W | | | ----------- -------- |94| | | | | |95| | B |<=====>|<==| ----------- -------- |96| | R | | |==>| Bridge1 |<==>| PRR1 | |97| | I | | | ----------- -------- |98| | D | | | |99| | G | | | ----------- -------- |100| | E | | |==>| Bridge2 |<==>| PRR2 | |101| ----| | ----------- -------- |102| | | |103---------------- ----------------------------------104105Figure 1: An FPGA set up with a base image that created three regions. Each106region (PRR0-2) gets its own split of the busses that is independently gated by107a soft logic bridge (Bridge0-2) in the FPGA. The contents of each PRR can be108reprogrammed independently while the rest of the system continues to function.109110111Sequence112========113114When a DT overlay that targets an FPGA Region is applied, the FPGA Region will115do the following:1161171. Disable appropriate FPGA bridges.1182. Program the FPGA using the FPGA manager.1193. Enable the FPGA bridges.1204. The Device Tree overlay is accepted into the live tree.1215. Child devices are populated.122123When the overlay is removed, the child nodes will be removed and the FPGA Region124will disable the bridges.125126127FPGA Region128===========129130FPGA Regions represent FPGA's and FPGA PR regions in the device tree. An FPGA131Region brings together the elements needed to program on a running system and132add the child devices:133134* FPGA Manager135* FPGA Bridges136* image-specific information needed to the programming.137* child nodes138139The intended use is that a Device Tree overlay (DTO) can be used to reprogram an140FPGA while an operating system is running.141142An FPGA Region that exists in the live Device Tree reflects the current state.143If the live tree shows a "firmware-name" property or child nodes under an FPGA144Region, the FPGA already has been programmed. A DTO that targets an FPGA Region145and adds the "firmware-name" property is taken as a request to reprogram the146FPGA. After reprogramming is successful, the overlay is accepted into the live147tree.148149The base FPGA Region in the device tree represents the FPGA and supports full150reconfiguration. It must include a phandle to an FPGA Manager. The base151FPGA region will be the child of one of the hardware bridges (the bridge that152allows register access) between the cpu and the FPGA. If there are more than153one bridge to control during FPGA programming, the region will also contain a154list of phandles to the additional hardware FPGA Bridges.155156For partial reconfiguration (PR), each PR region will have an FPGA Region.157These FPGA regions are children of FPGA bridges which are then children of the158base FPGA region. The "Full Reconfiguration to add PRR's" example below shows159this.160161If an FPGA Region does not specify an FPGA Manager, it will inherit the FPGA162Manager specified by its ancestor FPGA Region. This supports both the case163where the same FPGA Manager is used for all of an FPGA as well the case where164a different FPGA Manager is used for each region.165166FPGA Regions do not inherit their ancestor FPGA regions' bridges. This prevents167shutting down bridges that are upstream from the other active regions while one168region is getting reconfigured (see Figure 1 above). During PR, the FPGA's169hardware bridges remain enabled. The PR regions' bridges will be FPGA bridges170within the static image of the FPGA.171172173Supported Use Models174====================175176In all cases the live DT must have the FPGA Manager, FPGA Bridges (if any), and177a FPGA Region. The target of the Device Tree Overlay is the FPGA Region. Some178uses are specific to an FPGA device.179180* No FPGA Bridges181In this case, the FPGA Manager which programs the FPGA also handles the182bridges behind the scenes. No FPGA Bridge devices are needed for full183reconfiguration.184185* Full reconfiguration with hardware bridges186In this case, there are hardware bridges between the processor and FPGA that187need to be controlled during full reconfiguration. Before the overlay is188applied, the live DT must include the FPGA Manager, FPGA Bridges, and a189FPGA Region. The FPGA Region is the child of the bridge that allows190register access to the FPGA. Additional bridges may be listed in a191fpga-bridges property in the FPGA region or in the device tree overlay.192193* Partial reconfiguration with bridges in the FPGA194In this case, the FPGA will have one or more PRR's that may be programmed195separately while the rest of the FPGA can remain active. To manage this,196bridges need to exist in the FPGA that can gate the buses going to each FPGA197region while the buses are enabled for other sections. Before any partial198reconfiguration can be done, a base FPGA image must be loaded which includes199PRR's with FPGA bridges. The device tree should have an FPGA region for each200PRR.201202Constraints203===========204205It is beyond the scope of this document to fully describe all the FPGA design206constraints required to make partial reconfiguration work[1] [2] [3], but a few207deserve quick mention.208209A persona must have boundary connections that line up with those of the partition210or region it is designed to go into.211212During programming, transactions through those connections must be stopped and213the connections must be held at a fixed logic level. This can be achieved by214FPGA Bridges that exist on the FPGA fabric prior to the partial reconfiguration.215216--217[1] www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/ug/ug_partrecon.pdf218[2] tspace.library.utoronto.ca/bitstream/1807/67932/1/Byma_Stuart_A_201411_MAS_thesis.pdf219[3] https://www.xilinx.com/support/documentation/sw_manuals/xilinx14_1/ug702.pdf220221properties:222$nodename:223pattern: "^fpga-region(@.*|-([0-9]|[1-9][0-9]+))?$"224225compatible:226const: fpga-region227228reg:229maxItems: 1230231ranges: true232"#address-cells": true233"#size-cells": true234235config-complete-timeout-us:236description:237The maximum time in microseconds time for the FPGA to go to operating238mode after the region has been programmed.239240encrypted-fpga-config:241type: boolean242description:243Set if the bitstream is encrypted.244245external-fpga-config:246type: boolean247description:248Set if the FPGA has already been configured prior to OS boot up.249250firmware-name:251maxItems: 1252description:253Should contain the name of an FPGA image file located on the firmware254search path. If this property shows up in a live device tree it indicates255that the FPGA has already been programmed with this image.256If this property is in an overlay targeting an FPGA region, it is257a request to program the FPGA with that image.258259fpga-bridges:260$ref: /schemas/types.yaml#/definitions/phandle-array261description:262Should contain a list of phandles to FPGA Bridges that must be263controlled during FPGA programming along with the parent FPGA bridge.264This property is optional if the FPGA Manager handles the bridges.265If the fpga-region is the child of an fpga-bridge, the list should not266contain the parent bridge.267268fpga-mgr:269$ref: /schemas/types.yaml#/definitions/phandle270description:271Should contain a phandle to an FPGA Manager. Child FPGA Regions272inherit this property from their ancestor regions. An fpga-mgr property273in a region will override any inherited FPGA manager.274275partial-fpga-config:276type: boolean277description:278Set if partial reconfiguration is to be done, otherwise full279reconfiguration is done.280281region-freeze-timeout-us:282description:283The maximum time in microseconds to wait for bridges to successfully284become disabled before the region has been programmed.285286region-unfreeze-timeout-us:287description:288The maximum time in microseconds to wait for bridges to successfully289become enabled after the region has been programmed.290291required:292- compatible293- fpga-mgr294295additionalProperties:296type: object297298examples:299- |300/*301* Full Reconfiguration without Bridges with DT overlay302*/303fpga_region0: fpga-region@0 {304compatible = "fpga-region";305reg = <0 0>;306#address-cells = <1>;307#size-cells = <1>;308fpga-mgr = <&fpga_mgr0>;309ranges = <0x10000000 0x20000000 0x10000000>;310311/* DT Overlay contains: &fpga_region0 */312firmware-name = "zynq-gpio.bin";313gpio@40000000 {314compatible = "xlnx,xps-gpio-1.00.a";315reg = <0x40000000 0x10000>;316gpio-controller;317#gpio-cells = <2>;318clocks = <&clk>;319};320};321322- |323/*324* Partial reconfiguration with bridge325*/326fpga_region1: fpga-region@0 {327compatible = "fpga-region";328reg = <0 0>;329ranges;330#address-cells = <1>;331#size-cells = <1>;332fpga-mgr = <&fpga_mgr1>;333fpga-bridges = <&fpga_bridge1>;334partial-fpga-config;335336/* DT Overlay contains: &fpga_region1 */337firmware-name = "zynq-gpio-partial.bin";338clk: clock {339compatible = "fixed-factor-clock";340clocks = <&parentclk>;341#clock-cells = <0>;342clock-div = <2>;343clock-mult = <1>;344};345axi {346compatible = "simple-bus";347#address-cells = <1>;348#size-cells = <1>;349ranges;350gpio@40000000 {351compatible = "xlnx,xps-gpio-1.00.a";352reg = <0x40000000 0x10000>;353#gpio-cells = <2>;354gpio-controller;355clocks = <&clk>;356};357};358};359360361