Path: blob/master/Documentation/devicetree/bindings/fpga/fpga-region.yaml
52370 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- Constraints1920Introduction21============2223FPGA Regions represent FPGA's and partial reconfiguration regions of FPGA's in24the Device Tree. FPGA Regions provide a way to program FPGAs under device tree25control.2627The documentation hits some of the high points of FPGA usage and28attempts to include terminology used by both major FPGA manufacturers. This29document isn't a replacement for any manufacturers specifications for FPGA30usage.3132Terminology33===========3435Full Reconfiguration36* The entire FPGA is programmed.3738Partial Reconfiguration (PR)39* A section of an FPGA is reprogrammed while the rest of the FPGA is not40affected.41* Not all FPGA's support PR.4243Partial Reconfiguration Region (PRR)44* Also called a "reconfigurable partition"45* A PRR is a specific section of an FPGA reserved for reconfiguration.46* A base (or static) FPGA image may create a set of PRR's that later may47be independently reprogrammed many times.48* The size and specific location of each PRR is fixed.49* The connections at the edge of each PRR are fixed. The image that is loaded50into a PRR must fit and must use a subset of the region's connections.51* The busses within the FPGA are split such that each region gets its own52branch that may be gated independently.5354Persona55* Also called a "partial bit stream"56* An FPGA image that is designed to be loaded into a PRR. There may be57any number of personas designed to fit into a PRR, but only one at a time58may be loaded.59* A persona may create more regions.6061FPGA Bridge62* FPGA Bridges gate bus signals between a host and FPGA.63* FPGA Bridges should be disabled while the FPGA is being programmed to64prevent spurious signals on the cpu bus and to the soft logic.65* FPGA bridges may be actual hardware or soft logic on an FPGA.66* During Full Reconfiguration, hardware bridges between the host and FPGA67will be disabled.68* During Partial Reconfiguration of a specific region, that region's bridge69will be used to gate the busses. Traffic to other regions is not affected.70* In some implementations, the FPGA Manager transparently handles gating the71buses, eliminating the need to show the hardware FPGA bridges in the72device tree.73* An FPGA image may create a set of reprogrammable regions, each having its74own bridge and its own split of the busses in the FPGA.7576FPGA Manager77* An FPGA Manager is a hardware block that programs an FPGA under the control78of a host processor.7980Base Image81* Also called the "static image"82* An FPGA image that is designed to do full reconfiguration of the FPGA.83* A base image may set up a set of partial reconfiguration regions that may84later be reprogrammed.8586---------------- ----------------------------------87| Host CPU | | FPGA |88| | | |89| ----| | ----------- -------- |90| | H | | |==>| Bridge0 |<==>| PRR0 | |91| | W | | | ----------- -------- |92| | | | | |93| | B |<=====>|<==| ----------- -------- |94| | R | | |==>| Bridge1 |<==>| PRR1 | |95| | I | | | ----------- -------- |96| | D | | | |97| | G | | | ----------- -------- |98| | E | | |==>| Bridge2 |<==>| PRR2 | |99| ----| | ----------- -------- |100| | | |101---------------- ----------------------------------102103Figure 1: An FPGA set up with a base image that created three regions. Each104region (PRR0-2) gets its own split of the busses that is independently gated by105a soft logic bridge (Bridge0-2) in the FPGA. The contents of each PRR can be106reprogrammed independently while the rest of the system continues to function.107108Sequence109========110111When a DT overlay that targets an FPGA Region is applied, the FPGA Region will112do the following:1131141. Disable appropriate FPGA bridges.1152. Program the FPGA using the FPGA manager.1163. Enable the FPGA bridges.1174. The Device Tree overlay is accepted into the live tree.1185. Child devices are populated.119120When the overlay is removed, the child nodes will be removed and the FPGA Region121will disable the bridges.122123FPGA Region124===========125126FPGA Regions represent FPGA's and FPGA PR regions in the device tree. An FPGA127Region brings together the elements needed to program on a running system and128add the child devices:129130* FPGA Manager131* FPGA Bridges132* image-specific information needed to the programming.133* child nodes134135The intended use is that a Device Tree overlay (DTO) can be used to reprogram an136FPGA while an operating system is running.137138An FPGA Region that exists in the live Device Tree reflects the current state.139If the live tree shows a "firmware-name" property or child nodes under an FPGA140Region, the FPGA already has been programmed. A DTO that targets an FPGA Region141and adds the "firmware-name" property is taken as a request to reprogram the142FPGA. After reprogramming is successful, the overlay is accepted into the live143tree.144145The base FPGA Region in the device tree represents the FPGA and supports full146reconfiguration. It must include a phandle to an FPGA Manager. The base147FPGA region will be the child of one of the hardware bridges (the bridge that148allows register access) between the cpu and the FPGA. If there are more than149one bridge to control during FPGA programming, the region will also contain a150list of phandles to the additional hardware FPGA Bridges.151152For partial reconfiguration (PR), each PR region will have an FPGA Region.153These FPGA regions are children of FPGA bridges which are then children of the154base FPGA region. The "Full Reconfiguration to add PRR's" example below shows155this.156157If an FPGA Region does not specify an FPGA Manager, it will inherit the FPGA158Manager specified by its ancestor FPGA Region. This supports both the case159where the same FPGA Manager is used for all of an FPGA as well the case where160a different FPGA Manager is used for each region.161162FPGA Regions do not inherit their ancestor FPGA regions' bridges. This prevents163shutting down bridges that are upstream from the other active regions while one164region is getting reconfigured (see Figure 1 above). During PR, the FPGA's165hardware bridges remain enabled. The PR regions' bridges will be FPGA bridges166within the static image of the FPGA.167168Supported Use Models169====================170171In all cases the live DT must have the FPGA Manager, FPGA Bridges (if any), and172a FPGA Region. The target of the Device Tree Overlay is the FPGA Region. Some173uses are specific to an FPGA device.174175* No FPGA Bridges176In this case, the FPGA Manager which programs the FPGA also handles the177bridges behind the scenes. No FPGA Bridge devices are needed for full178reconfiguration.179180* Full reconfiguration with hardware bridges181In this case, there are hardware bridges between the processor and FPGA that182need to be controlled during full reconfiguration. Before the overlay is183applied, the live DT must include the FPGA Manager, FPGA Bridges, and a184FPGA Region. The FPGA Region is the child of the bridge that allows185register access to the FPGA. Additional bridges may be listed in a186fpga-bridges property in the FPGA region or in the device tree overlay.187188* Partial reconfiguration with bridges in the FPGA189In this case, the FPGA will have one or more PRR's that may be programmed190separately while the rest of the FPGA can remain active. To manage this,191bridges need to exist in the FPGA that can gate the buses going to each FPGA192region while the buses are enabled for other sections. Before any partial193reconfiguration can be done, a base FPGA image must be loaded which includes194PRR's with FPGA bridges. The device tree should have an FPGA region for each195PRR.196197Constraints198===========199200It is beyond the scope of this document to fully describe all the FPGA design201constraints required to make partial reconfiguration work[1] [2] [3], but a few202deserve quick mention.203204A persona must have boundary connections that line up with those of the partition205or region it is designed to go into.206207During programming, transactions through those connections must be stopped and208the connections must be held at a fixed logic level. This can be achieved by209FPGA Bridges that exist on the FPGA fabric prior to the partial reconfiguration.210211--212[1] https://www.intel.com/programmable/technical-pdfs/683404.pdf213[2] tspace.library.utoronto.ca/bitstream/1807/67932/1/Byma_Stuart_A_201411_MAS_thesis.pdf214[3] https://docs.amd.com/v/u/en-US/ug702215216properties:217$nodename:218pattern: "^fpga-region(@.*|-([0-9]|[1-9][0-9]+))?$"219220compatible:221const: fpga-region222223reg:224maxItems: 1225226ranges: true227"#address-cells": true228"#size-cells": true229230config-complete-timeout-us:231description:232The maximum time in microseconds time for the FPGA to go to operating233mode after the region has been programmed.234235encrypted-fpga-config:236type: boolean237description:238Set if the bitstream is encrypted.239240external-fpga-config:241type: boolean242description:243Set if the FPGA has already been configured prior to OS boot up.244245firmware-name:246maxItems: 1247description:248Should contain the name of an FPGA image file located on the firmware249search path. If this property shows up in a live device tree it indicates250that the FPGA has already been programmed with this image.251If this property is in an overlay targeting an FPGA region, it is252a request to program the FPGA with that image.253254fpga-bridges:255$ref: /schemas/types.yaml#/definitions/phandle-array256description:257Should contain a list of phandles to FPGA Bridges that must be258controlled during FPGA programming along with the parent FPGA bridge.259This property is optional if the FPGA Manager handles the bridges.260If the fpga-region is the child of an fpga-bridge, the list should not261contain the parent bridge.262263fpga-mgr:264$ref: /schemas/types.yaml#/definitions/phandle265description:266Should contain a phandle to an FPGA Manager. Child FPGA Regions267inherit this property from their ancestor regions. An fpga-mgr property268in a region will override any inherited FPGA manager.269270partial-fpga-config:271type: boolean272description:273Set if partial reconfiguration is to be done, otherwise full274reconfiguration is done.275276region-freeze-timeout-us:277description:278The maximum time in microseconds to wait for bridges to successfully279become disabled before the region has been programmed.280281region-unfreeze-timeout-us:282description:283The maximum time in microseconds to wait for bridges to successfully284become enabled after the region has been programmed.285286required:287- compatible288- fpga-mgr289290additionalProperties:291type: object292293examples:294- |295/*296* Full Reconfiguration without Bridges with DT overlay297*/298fpga_region0: fpga-region@0 {299compatible = "fpga-region";300reg = <0 0>;301#address-cells = <1>;302#size-cells = <1>;303fpga-mgr = <&fpga_mgr0>;304ranges = <0x10000000 0x20000000 0x10000000>;305306/* DT Overlay contains: &fpga_region0 */307firmware-name = "zynq-gpio.bin";308gpio@40000000 {309compatible = "xlnx,xps-gpio-1.00.a";310reg = <0x40000000 0x10000>;311gpio-controller;312#gpio-cells = <2>;313clocks = <&clk>;314};315};316317- |318/*319* Partial reconfiguration with bridge320*/321fpga_region1: fpga-region@0 {322compatible = "fpga-region";323reg = <0 0>;324ranges;325#address-cells = <1>;326#size-cells = <1>;327fpga-mgr = <&fpga_mgr1>;328fpga-bridges = <&fpga_bridge1>;329partial-fpga-config;330331/* DT Overlay contains: &fpga_region1 */332firmware-name = "zynq-gpio-partial.bin";333clk: clock {334compatible = "fixed-factor-clock";335clocks = <&parentclk>;336#clock-cells = <0>;337clock-div = <2>;338clock-mult = <1>;339};340axi {341compatible = "simple-bus";342#address-cells = <1>;343#size-cells = <1>;344ranges;345gpio@40000000 {346compatible = "xlnx,xps-gpio-1.00.a";347reg = <0x40000000 0x10000>;348#gpio-cells = <2>;349gpio-controller;350clocks = <&clk>;351};352};353};354355356