1a33ddf80SAlan TullFPGA Region Device Tree Binding 2a33ddf80SAlan Tull 3a33ddf80SAlan TullAlan Tull 2016 4a33ddf80SAlan Tull 5a33ddf80SAlan Tull CONTENTS 6a33ddf80SAlan Tull - Introduction 7a33ddf80SAlan Tull - Terminology 8a33ddf80SAlan Tull - Sequence 9a33ddf80SAlan Tull - FPGA Region 10a33ddf80SAlan Tull - Supported Use Models 11a33ddf80SAlan Tull - Device Tree Examples 12a33ddf80SAlan Tull - Constraints 13a33ddf80SAlan Tull 14a33ddf80SAlan Tull 15a33ddf80SAlan TullIntroduction 16a33ddf80SAlan Tull============ 17a33ddf80SAlan Tull 18a33ddf80SAlan TullFPGA Regions represent FPGA's and partial reconfiguration regions of FPGA's in 19a33ddf80SAlan Tullthe Device Tree. FPGA Regions provide a way to program FPGAs under device tree 20a33ddf80SAlan Tullcontrol. 21a33ddf80SAlan Tull 22a33ddf80SAlan TullThis device tree binding document hits some of the high points of FPGA usage and 23a33ddf80SAlan Tullattempts to include terminology used by both major FPGA manufacturers. This 24a33ddf80SAlan Tulldocument isn't a replacement for any manufacturers specifications for FPGA 25a33ddf80SAlan Tullusage. 26a33ddf80SAlan Tull 27a33ddf80SAlan Tull 28a33ddf80SAlan TullTerminology 29a33ddf80SAlan Tull=========== 30a33ddf80SAlan Tull 31a33ddf80SAlan TullFull Reconfiguration 32a33ddf80SAlan Tull * The entire FPGA is programmed. 33a33ddf80SAlan Tull 34a33ddf80SAlan TullPartial Reconfiguration (PR) 35a33ddf80SAlan Tull * A section of an FPGA is reprogrammed while the rest of the FPGA is not 36a33ddf80SAlan Tull affected. 37a33ddf80SAlan Tull * Not all FPGA's support PR. 38a33ddf80SAlan Tull 39a33ddf80SAlan TullPartial Reconfiguration Region (PRR) 40a33ddf80SAlan Tull * Also called a "reconfigurable partition" 410508c477STom Rix * A PRR is a specific section of an FPGA reserved for reconfiguration. 42a33ddf80SAlan Tull * A base (or static) FPGA image may create a set of PRR's that later may 43a33ddf80SAlan Tull be independently reprogrammed many times. 44a33ddf80SAlan Tull * The size and specific location of each PRR is fixed. 45a33ddf80SAlan Tull * The connections at the edge of each PRR are fixed. The image that is loaded 46a33ddf80SAlan Tull into a PRR must fit and must use a subset of the region's connections. 47a33ddf80SAlan Tull * The busses within the FPGA are split such that each region gets its own 48a33ddf80SAlan Tull branch that may be gated independently. 49a33ddf80SAlan Tull 50a33ddf80SAlan TullPersona 51a33ddf80SAlan Tull * Also called a "partial bit stream" 52a33ddf80SAlan Tull * An FPGA image that is designed to be loaded into a PRR. There may be 53a33ddf80SAlan Tull any number of personas designed to fit into a PRR, but only one at at time 54a33ddf80SAlan Tull may be loaded. 55a33ddf80SAlan Tull * A persona may create more regions. 56a33ddf80SAlan Tull 57a33ddf80SAlan TullFPGA Bridge 58a33ddf80SAlan Tull * FPGA Bridges gate bus signals between a host and FPGA. 59a33ddf80SAlan Tull * FPGA Bridges should be disabled while the FPGA is being programmed to 60a33ddf80SAlan Tull prevent spurious signals on the cpu bus and to the soft logic. 61a33ddf80SAlan Tull * FPGA bridges may be actual hardware or soft logic on an FPGA. 62a33ddf80SAlan Tull * During Full Reconfiguration, hardware bridges between the host and FPGA 63a33ddf80SAlan Tull will be disabled. 64a33ddf80SAlan Tull * During Partial Reconfiguration of a specific region, that region's bridge 65a33ddf80SAlan Tull will be used to gate the busses. Traffic to other regions is not affected. 66*47aab533SBjorn Helgaas * In some implementations, the FPGA Manager transparently handles gating the 67a33ddf80SAlan Tull buses, eliminating the need to show the hardware FPGA bridges in the 68a33ddf80SAlan Tull device tree. 69a33ddf80SAlan Tull * An FPGA image may create a set of reprogrammable regions, each having its 70a33ddf80SAlan Tull own bridge and its own split of the busses in the FPGA. 71a33ddf80SAlan Tull 72a33ddf80SAlan TullFPGA Manager 73a33ddf80SAlan Tull * An FPGA Manager is a hardware block that programs an FPGA under the control 74a33ddf80SAlan Tull of a host processor. 75a33ddf80SAlan Tull 76a33ddf80SAlan TullBase Image 77a33ddf80SAlan Tull * Also called the "static image" 78a33ddf80SAlan Tull * An FPGA image that is designed to do full reconfiguration of the FPGA. 79a33ddf80SAlan Tull * A base image may set up a set of partial reconfiguration regions that may 80a33ddf80SAlan Tull later be reprogrammed. 81a33ddf80SAlan Tull 82a33ddf80SAlan Tull ---------------- ---------------------------------- 83a33ddf80SAlan Tull | Host CPU | | FPGA | 84a33ddf80SAlan Tull | | | | 85a33ddf80SAlan Tull | ----| | ----------- -------- | 86a33ddf80SAlan Tull | | H | | |==>| Bridge0 |<==>| PRR0 | | 87a33ddf80SAlan Tull | | W | | | ----------- -------- | 88a33ddf80SAlan Tull | | | | | | 89a33ddf80SAlan Tull | | B |<=====>|<==| ----------- -------- | 90a33ddf80SAlan Tull | | R | | |==>| Bridge1 |<==>| PRR1 | | 91a33ddf80SAlan Tull | | I | | | ----------- -------- | 92a33ddf80SAlan Tull | | D | | | | 93a33ddf80SAlan Tull | | G | | | ----------- -------- | 94a33ddf80SAlan Tull | | E | | |==>| Bridge2 |<==>| PRR2 | | 95a33ddf80SAlan Tull | ----| | ----------- -------- | 96a33ddf80SAlan Tull | | | | 97a33ddf80SAlan Tull ---------------- ---------------------------------- 98a33ddf80SAlan Tull 99a33ddf80SAlan TullFigure 1: An FPGA set up with a base image that created three regions. Each 100a33ddf80SAlan Tullregion (PRR0-2) gets its own split of the busses that is independently gated by 101a33ddf80SAlan Tulla soft logic bridge (Bridge0-2) in the FPGA. The contents of each PRR can be 102a33ddf80SAlan Tullreprogrammed independently while the rest of the system continues to function. 103a33ddf80SAlan Tull 104a33ddf80SAlan Tull 105a33ddf80SAlan TullSequence 106a33ddf80SAlan Tull======== 107a33ddf80SAlan Tull 1080508c477STom RixWhen a DT overlay that targets an FPGA Region is applied, the FPGA Region will 109a33ddf80SAlan Tulldo the following: 110a33ddf80SAlan Tull 111a33ddf80SAlan Tull 1. Disable appropriate FPGA bridges. 112a33ddf80SAlan Tull 2. Program the FPGA using the FPGA manager. 113a33ddf80SAlan Tull 3. Enable the FPGA bridges. 114a33ddf80SAlan Tull 4. The Device Tree overlay is accepted into the live tree. 115a33ddf80SAlan Tull 5. Child devices are populated. 116a33ddf80SAlan Tull 117a33ddf80SAlan TullWhen the overlay is removed, the child nodes will be removed and the FPGA Region 118a33ddf80SAlan Tullwill disable the bridges. 119a33ddf80SAlan Tull 120a33ddf80SAlan Tull 121a33ddf80SAlan TullFPGA Region 122a33ddf80SAlan Tull=========== 123a33ddf80SAlan Tull 124a33ddf80SAlan TullFPGA Regions represent FPGA's and FPGA PR regions in the device tree. An FPGA 125a33ddf80SAlan TullRegion brings together the elements needed to program on a running system and 126a33ddf80SAlan Tulladd the child devices: 127a33ddf80SAlan Tull 128a33ddf80SAlan Tull * FPGA Manager 129a33ddf80SAlan Tull * FPGA Bridges 130a33ddf80SAlan Tull * image-specific information needed to to the programming. 131a33ddf80SAlan Tull * child nodes 132a33ddf80SAlan Tull 133a33ddf80SAlan TullThe intended use is that a Device Tree overlay (DTO) can be used to reprogram an 134a33ddf80SAlan TullFPGA while an operating system is running. 135a33ddf80SAlan Tull 136a33ddf80SAlan TullAn FPGA Region that exists in the live Device Tree reflects the current state. 1370508c477STom RixIf the live tree shows a "firmware-name" property or child nodes under an FPGA 1380508c477STom RixRegion, the FPGA already has been programmed. A DTO that targets an FPGA Region 139a33ddf80SAlan Tulland adds the "firmware-name" property is taken as a request to reprogram the 140a33ddf80SAlan TullFPGA. After reprogramming is successful, the overlay is accepted into the live 141a33ddf80SAlan Tulltree. 142a33ddf80SAlan Tull 143a33ddf80SAlan TullThe base FPGA Region in the device tree represents the FPGA and supports full 144a33ddf80SAlan Tullreconfiguration. It must include a phandle to an FPGA Manager. The base 145a33ddf80SAlan TullFPGA region will be the child of one of the hardware bridges (the bridge that 146a33ddf80SAlan Tullallows register access) between the cpu and the FPGA. If there are more than 147a33ddf80SAlan Tullone bridge to control during FPGA programming, the region will also contain a 148a33ddf80SAlan Tulllist of phandles to the additional hardware FPGA Bridges. 149a33ddf80SAlan Tull 150a33ddf80SAlan TullFor partial reconfiguration (PR), each PR region will have an FPGA Region. 151a33ddf80SAlan TullThese FPGA regions are children of FPGA bridges which are then children of the 152a33ddf80SAlan Tullbase FPGA region. The "Full Reconfiguration to add PRR's" example below shows 153a33ddf80SAlan Tullthis. 154a33ddf80SAlan Tull 1550508c477STom RixIf an FPGA Region does not specify an FPGA Manager, it will inherit the FPGA 156a33ddf80SAlan TullManager specified by its ancestor FPGA Region. This supports both the case 1570508c477STom Rixwhere the same FPGA Manager is used for all of an FPGA as well the case where 158a33ddf80SAlan Tulla different FPGA Manager is used for each region. 159a33ddf80SAlan Tull 160a33ddf80SAlan TullFPGA Regions do not inherit their ancestor FPGA regions' bridges. This prevents 161a33ddf80SAlan Tullshutting down bridges that are upstream from the other active regions while one 162a33ddf80SAlan Tullregion is getting reconfigured (see Figure 1 above). During PR, the FPGA's 163a33ddf80SAlan Tullhardware bridges remain enabled. The PR regions' bridges will be FPGA bridges 164a33ddf80SAlan Tullwithin the static image of the FPGA. 165a33ddf80SAlan Tull 166a33ddf80SAlan TullRequired properties: 167a33ddf80SAlan Tull- compatible : should contain "fpga-region" 168a33ddf80SAlan Tull- fpga-mgr : should contain a phandle to an FPGA Manager. Child FPGA Regions 1690508c477STom Rix inherit this property from their ancestor regions. An fpga-mgr property 170a33ddf80SAlan Tull in a region will override any inherited FPGA manager. 171a33ddf80SAlan Tull- #address-cells, #size-cells, ranges : must be present to handle address space 172a33ddf80SAlan Tull mapping for child nodes. 173a33ddf80SAlan Tull 174a33ddf80SAlan TullOptional properties: 175a33ddf80SAlan Tull- firmware-name : should contain the name of an FPGA image file located on the 176a33ddf80SAlan Tull firmware search path. If this property shows up in a live device tree 177a33ddf80SAlan Tull it indicates that the FPGA has already been programmed with this image. 1780508c477STom Rix If this property is in an overlay targeting an FPGA region, it is a 179a33ddf80SAlan Tull request to program the FPGA with that image. 180a33ddf80SAlan Tull- fpga-bridges : should contain a list of phandles to FPGA Bridges that must be 181a33ddf80SAlan Tull controlled during FPGA programming along with the parent FPGA bridge. 182a33ddf80SAlan Tull This property is optional if the FPGA Manager handles the bridges. 1830508c477STom Rix If the fpga-region is the child of an fpga-bridge, the list should not 184a33ddf80SAlan Tull contain the parent bridge. 185a33ddf80SAlan Tull- partial-fpga-config : boolean, set if partial reconfiguration is to be done, 186a33ddf80SAlan Tull otherwise full reconfiguration is done. 187a33ddf80SAlan Tull- external-fpga-config : boolean, set if the FPGA has already been configured 188a33ddf80SAlan Tull prior to OS boot up. 189161db575SMoritz Fischer- encrypted-fpga-config : boolean, set if the bitstream is encrypted 190a33ddf80SAlan Tull- region-unfreeze-timeout-us : The maximum time in microseconds to wait for 191a33ddf80SAlan Tull bridges to successfully become enabled after the region has been 192a33ddf80SAlan Tull programmed. 193a33ddf80SAlan Tull- region-freeze-timeout-us : The maximum time in microseconds to wait for 194a33ddf80SAlan Tull bridges to successfully become disabled before the region has been 195a33ddf80SAlan Tull programmed. 19609eb03f0STobias Klauser- config-complete-timeout-us : The maximum time in microseconds time for the 19709eb03f0STobias Klauser FPGA to go to operating mode after the region has been programmed. 198a33ddf80SAlan Tull- child nodes : devices in the FPGA after programming. 199a33ddf80SAlan Tull 200a33ddf80SAlan TullIn the example below, when an overlay is applied targeting fpga-region0, 201a33ddf80SAlan Tullfpga_mgr is used to program the FPGA. Two bridges are controlled during 202a33ddf80SAlan Tullprogramming: the parent fpga_bridge0 and fpga_bridge1. Because the region is 203a33ddf80SAlan Tullthe child of fpga_bridge0, only fpga_bridge1 needs to be specified in the 204a33ddf80SAlan Tullfpga-bridges property. During programming, these bridges are disabled, the 205a33ddf80SAlan Tullfirmware specified in the overlay is loaded to the FPGA using the FPGA manager 206a33ddf80SAlan Tullspecified in the region. If FPGA programming succeeds, the bridges are 207a33ddf80SAlan Tullreenabled and the overlay makes it into the live device tree. The child devices 208a33ddf80SAlan Tullare then populated. If FPGA programming fails, the bridges are left disabled 209a33ddf80SAlan Tulland the overlay is rejected. The overlay's ranges property maps the lwhps 210a33ddf80SAlan Tullbridge's region (0xff200000) and the hps bridge's region (0xc0000000) for use by 211a33ddf80SAlan Tullthe two child devices. 212a33ddf80SAlan Tull 213a33ddf80SAlan TullExample: 214a33ddf80SAlan TullBase tree contains: 215a33ddf80SAlan Tull 216a33ddf80SAlan Tull fpga_mgr: fpga-mgr@ff706000 { 217a33ddf80SAlan Tull compatible = "altr,socfpga-fpga-mgr"; 218a33ddf80SAlan Tull reg = <0xff706000 0x1000 219a33ddf80SAlan Tull 0xffb90000 0x20>; 220a33ddf80SAlan Tull interrupts = <0 175 4>; 221a33ddf80SAlan Tull }; 222a33ddf80SAlan Tull 223a33ddf80SAlan Tull fpga_bridge0: fpga-bridge@ff400000 { 224a33ddf80SAlan Tull compatible = "altr,socfpga-lwhps2fpga-bridge"; 225a33ddf80SAlan Tull reg = <0xff400000 0x100000>; 226a33ddf80SAlan Tull resets = <&rst LWHPS2FPGA_RESET>; 227a33ddf80SAlan Tull clocks = <&l4_main_clk>; 228a33ddf80SAlan Tull 229a33ddf80SAlan Tull #address-cells = <1>; 230a33ddf80SAlan Tull #size-cells = <1>; 231a33ddf80SAlan Tull ranges; 232a33ddf80SAlan Tull 233a33ddf80SAlan Tull fpga_region0: fpga-region0 { 234a33ddf80SAlan Tull compatible = "fpga-region"; 235a33ddf80SAlan Tull fpga-mgr = <&fpga_mgr>; 236a33ddf80SAlan Tull }; 237a33ddf80SAlan Tull }; 238a33ddf80SAlan Tull 239a33ddf80SAlan Tull fpga_bridge1: fpga-bridge@ff500000 { 240a33ddf80SAlan Tull compatible = "altr,socfpga-hps2fpga-bridge"; 241a33ddf80SAlan Tull reg = <0xff500000 0x10000>; 242a33ddf80SAlan Tull resets = <&rst HPS2FPGA_RESET>; 243a33ddf80SAlan Tull clocks = <&l4_main_clk>; 244a33ddf80SAlan Tull }; 245a33ddf80SAlan Tull 246a33ddf80SAlan TullOverlay contains: 247a33ddf80SAlan Tull 248f9d2d86dSGeert Uytterhoeven/dts-v1/; 249f9d2d86dSGeert Uytterhoeven/plugin/; 250f9d2d86dSGeert Uytterhoeven 251f9d2d86dSGeert Uytterhoeven&fpga_region0 { 252a33ddf80SAlan Tull #address-cells = <1>; 253a33ddf80SAlan Tull #size-cells = <1>; 254a33ddf80SAlan Tull 255a33ddf80SAlan Tull firmware-name = "soc_system.rbf"; 256a33ddf80SAlan Tull fpga-bridges = <&fpga_bridge1>; 257a33ddf80SAlan Tull ranges = <0x20000 0xff200000 0x100000>, 258a33ddf80SAlan Tull <0x0 0xc0000000 0x20000000>; 259a33ddf80SAlan Tull 260a33ddf80SAlan Tull gpio@10040 { 261a33ddf80SAlan Tull compatible = "altr,pio-1.0"; 262a33ddf80SAlan Tull reg = <0x10040 0x20>; 2636dd5d3b8SAlexandru Ardelean altr,ngpio = <4>; 264a33ddf80SAlan Tull #gpio-cells = <2>; 265a33ddf80SAlan Tull clocks = <2>; 266a33ddf80SAlan Tull gpio-controller; 267a33ddf80SAlan Tull }; 268a33ddf80SAlan Tull 269a33ddf80SAlan Tull onchip-memory { 270a33ddf80SAlan Tull device_type = "memory"; 271a33ddf80SAlan Tull compatible = "altr,onchipmem-15.1"; 272a33ddf80SAlan Tull reg = <0x0 0x10000>; 273a33ddf80SAlan Tull }; 274a33ddf80SAlan Tull}; 275a33ddf80SAlan Tull 276a33ddf80SAlan Tull 277a33ddf80SAlan TullSupported Use Models 278a33ddf80SAlan Tull==================== 279a33ddf80SAlan Tull 280a33ddf80SAlan TullIn all cases the live DT must have the FPGA Manager, FPGA Bridges (if any), and 281a33ddf80SAlan Tulla FPGA Region. The target of the Device Tree Overlay is the FPGA Region. Some 2820508c477STom Rixuses are specific to an FPGA device. 283a33ddf80SAlan Tull 284a33ddf80SAlan Tull * No FPGA Bridges 285a33ddf80SAlan Tull In this case, the FPGA Manager which programs the FPGA also handles the 286a33ddf80SAlan Tull bridges behind the scenes. No FPGA Bridge devices are needed for full 287a33ddf80SAlan Tull reconfiguration. 288a33ddf80SAlan Tull 289a33ddf80SAlan Tull * Full reconfiguration with hardware bridges 290a33ddf80SAlan Tull In this case, there are hardware bridges between the processor and FPGA that 291a33ddf80SAlan Tull need to be controlled during full reconfiguration. Before the overlay is 292a33ddf80SAlan Tull applied, the live DT must include the FPGA Manager, FPGA Bridges, and a 293a33ddf80SAlan Tull FPGA Region. The FPGA Region is the child of the bridge that allows 294a33ddf80SAlan Tull register access to the FPGA. Additional bridges may be listed in a 295a33ddf80SAlan Tull fpga-bridges property in the FPGA region or in the device tree overlay. 296a33ddf80SAlan Tull 297a33ddf80SAlan Tull * Partial reconfiguration with bridges in the FPGA 298a33ddf80SAlan Tull In this case, the FPGA will have one or more PRR's that may be programmed 299a33ddf80SAlan Tull separately while the rest of the FPGA can remain active. To manage this, 300a33ddf80SAlan Tull bridges need to exist in the FPGA that can gate the buses going to each FPGA 301a33ddf80SAlan Tull region while the buses are enabled for other sections. Before any partial 302a33ddf80SAlan Tull reconfiguration can be done, a base FPGA image must be loaded which includes 3030508c477STom Rix PRR's with FPGA bridges. The device tree should have an FPGA region for each 304a33ddf80SAlan Tull PRR. 305a33ddf80SAlan Tull 306a33ddf80SAlan TullDevice Tree Examples 307a33ddf80SAlan Tull==================== 308a33ddf80SAlan Tull 309a33ddf80SAlan TullThe intention of this section is to give some simple examples, focusing on 310a33ddf80SAlan Tullthe placement of the elements detailed above, especially: 311a33ddf80SAlan Tull * FPGA Manager 312a33ddf80SAlan Tull * FPGA Bridges 313a33ddf80SAlan Tull * FPGA Region 314a33ddf80SAlan Tull * ranges 315a33ddf80SAlan Tull * target-path or target 316a33ddf80SAlan Tull 317a33ddf80SAlan TullFor the purposes of this section, I'm dividing the Device Tree into two parts, 318a33ddf80SAlan Tulleach with its own requirements. The two parts are: 319a33ddf80SAlan Tull * The live DT prior to the overlay being added 320a33ddf80SAlan Tull * The DT overlay 321a33ddf80SAlan Tull 322a33ddf80SAlan TullThe live Device Tree must contain an FPGA Region, an FPGA Manager, and any FPGA 323a33ddf80SAlan TullBridges. The FPGA Region's "fpga-mgr" property specifies the manager by phandle 324a33ddf80SAlan Tullto handle programming the FPGA. If the FPGA Region is the child of another FPGA 325a33ddf80SAlan TullRegion, the parent's FPGA Manager is used. If FPGA Bridges need to be involved, 326a33ddf80SAlan Tullthey are specified in the FPGA Region by the "fpga-bridges" property. During 327a33ddf80SAlan TullFPGA programming, the FPGA Region will disable the bridges that are in its 328a33ddf80SAlan Tull"fpga-bridges" list and will re-enable them after FPGA programming has 329a33ddf80SAlan Tullsucceeded. 330a33ddf80SAlan Tull 331a33ddf80SAlan TullThe Device Tree Overlay will contain: 332a33ddf80SAlan Tull * "target-path" or "target" 33312e5bde1SSlark Xiao The insertion point where the contents of the overlay will go into the 334a33ddf80SAlan Tull live tree. target-path is a full path, while target is a phandle. 335a33ddf80SAlan Tull * "ranges" 336a33ddf80SAlan Tull The address space mapping from processor to FPGA bus(ses). 337a33ddf80SAlan Tull * "firmware-name" 338a33ddf80SAlan Tull Specifies the name of the FPGA image file on the firmware search 339a33ddf80SAlan Tull path. The search path is described in the firmware class documentation. 340a33ddf80SAlan Tull * "partial-fpga-config" 341a33ddf80SAlan Tull This binding is a boolean and should be present if partial reconfiguration 342a33ddf80SAlan Tull is to be done. 343a33ddf80SAlan Tull * child nodes corresponding to hardware that will be loaded in this region of 344a33ddf80SAlan Tull the FPGA. 345a33ddf80SAlan Tull 346a33ddf80SAlan TullDevice Tree Example: Full Reconfiguration without Bridges 347a33ddf80SAlan Tull========================================================= 348a33ddf80SAlan Tull 349a33ddf80SAlan TullLive Device Tree contains: 350a33ddf80SAlan Tull fpga_mgr0: fpga-mgr@f8007000 { 351a33ddf80SAlan Tull compatible = "xlnx,zynq-devcfg-1.0"; 352a33ddf80SAlan Tull reg = <0xf8007000 0x100>; 353a33ddf80SAlan Tull interrupt-parent = <&intc>; 354a33ddf80SAlan Tull interrupts = <0 8 4>; 355a33ddf80SAlan Tull clocks = <&clkc 12>; 356a33ddf80SAlan Tull clock-names = "ref_clk"; 357a33ddf80SAlan Tull syscon = <&slcr>; 358a33ddf80SAlan Tull }; 359a33ddf80SAlan Tull 360a33ddf80SAlan Tull fpga_region0: fpga-region0 { 361a33ddf80SAlan Tull compatible = "fpga-region"; 362a33ddf80SAlan Tull fpga-mgr = <&fpga_mgr0>; 363a33ddf80SAlan Tull #address-cells = <0x1>; 364a33ddf80SAlan Tull #size-cells = <0x1>; 365a33ddf80SAlan Tull ranges; 366a33ddf80SAlan Tull }; 367a33ddf80SAlan Tull 368a33ddf80SAlan TullDT Overlay contains: 369f9d2d86dSGeert Uytterhoeven 370f9d2d86dSGeert Uytterhoeven/dts-v1/; 371f9d2d86dSGeert Uytterhoeven/plugin/; 372f9d2d86dSGeert Uytterhoeven 373f9d2d86dSGeert Uytterhoeven&fpga_region0 { 374a33ddf80SAlan Tull #address-cells = <1>; 375a33ddf80SAlan Tull #size-cells = <1>; 376a33ddf80SAlan Tull 377a33ddf80SAlan Tull firmware-name = "zynq-gpio.bin"; 378a33ddf80SAlan Tull 379a33ddf80SAlan Tull gpio1: gpio@40000000 { 380a33ddf80SAlan Tull compatible = "xlnx,xps-gpio-1.00.a"; 381a33ddf80SAlan Tull reg = <0x40000000 0x10000>; 382a33ddf80SAlan Tull gpio-controller; 383a33ddf80SAlan Tull #gpio-cells = <0x2>; 384a33ddf80SAlan Tull xlnx,gpio-width= <0x6>; 385a33ddf80SAlan Tull }; 386a33ddf80SAlan Tull}; 387a33ddf80SAlan Tull 388a33ddf80SAlan TullDevice Tree Example: Full Reconfiguration to add PRR's 389a33ddf80SAlan Tull====================================================== 390a33ddf80SAlan Tull 391a33ddf80SAlan TullThe base FPGA Region is specified similar to the first example above. 392a33ddf80SAlan Tull 393a33ddf80SAlan TullThis example programs the FPGA to have two regions that can later be partially 394a33ddf80SAlan Tullconfigured. Each region has its own bridge in the FPGA fabric. 395a33ddf80SAlan Tull 396a33ddf80SAlan TullDT Overlay contains: 397f9d2d86dSGeert Uytterhoeven 398f9d2d86dSGeert Uytterhoeven/dts-v1/; 399f9d2d86dSGeert Uytterhoeven/plugin/; 400f9d2d86dSGeert Uytterhoeven 401f9d2d86dSGeert Uytterhoeven&fpga_region0 { 402a33ddf80SAlan Tull #address-cells = <1>; 403a33ddf80SAlan Tull #size-cells = <1>; 404a33ddf80SAlan Tull 405a33ddf80SAlan Tull firmware-name = "base.rbf"; 406a33ddf80SAlan Tull 407a33ddf80SAlan Tull fpga-bridge@4400 { 40805ced018SAlan Tull compatible = "altr,freeze-bridge-controller"; 409a33ddf80SAlan Tull reg = <0x4400 0x10>; 410a33ddf80SAlan Tull 411a33ddf80SAlan Tull fpga_region1: fpga-region1 { 412a33ddf80SAlan Tull compatible = "fpga-region"; 413a33ddf80SAlan Tull #address-cells = <0x1>; 414a33ddf80SAlan Tull #size-cells = <0x1>; 415a33ddf80SAlan Tull ranges; 416a33ddf80SAlan Tull }; 417a33ddf80SAlan Tull }; 418a33ddf80SAlan Tull 419a33ddf80SAlan Tull fpga-bridge@4420 { 42005ced018SAlan Tull compatible = "altr,freeze-bridge-controller"; 421a33ddf80SAlan Tull reg = <0x4420 0x10>; 422a33ddf80SAlan Tull 423a33ddf80SAlan Tull fpga_region2: fpga-region2 { 424a33ddf80SAlan Tull compatible = "fpga-region"; 425a33ddf80SAlan Tull #address-cells = <0x1>; 426a33ddf80SAlan Tull #size-cells = <0x1>; 427a33ddf80SAlan Tull ranges; 428a33ddf80SAlan Tull }; 429a33ddf80SAlan Tull }; 430a33ddf80SAlan Tull}; 431a33ddf80SAlan Tull 432a33ddf80SAlan TullDevice Tree Example: Partial Reconfiguration 433a33ddf80SAlan Tull============================================ 434a33ddf80SAlan Tull 435a33ddf80SAlan TullThis example reprograms one of the PRR's set up in the previous example. 436a33ddf80SAlan Tull 437a33ddf80SAlan TullThe sequence that occurs when this overlay is similar to the above, the only 438a33ddf80SAlan Tulldifferences are that the FPGA is partially reconfigured due to the 439a33ddf80SAlan Tull"partial-fpga-config" boolean and the only bridge that is controlled during 440a33ddf80SAlan Tullprogramming is the FPGA based bridge of fpga_region1. 441a33ddf80SAlan Tull 442f9d2d86dSGeert Uytterhoeven/dts-v1/; 443f9d2d86dSGeert Uytterhoeven/plugin/; 444f9d2d86dSGeert Uytterhoeven 445f9d2d86dSGeert Uytterhoeven&fpga_region1 { 446a33ddf80SAlan Tull #address-cells = <1>; 447a33ddf80SAlan Tull #size-cells = <1>; 448a33ddf80SAlan Tull 449a33ddf80SAlan Tull firmware-name = "soc_image2.rbf"; 450a33ddf80SAlan Tull partial-fpga-config; 451a33ddf80SAlan Tull 452a33ddf80SAlan Tull gpio@10040 { 453a33ddf80SAlan Tull compatible = "altr,pio-1.0"; 454a33ddf80SAlan Tull reg = <0x10040 0x20>; 455a33ddf80SAlan Tull clocks = <0x2>; 4566dd5d3b8SAlexandru Ardelean altr,ngpio = <0x4>; 457a33ddf80SAlan Tull #gpio-cells = <0x2>; 458a33ddf80SAlan Tull gpio-controller; 459a33ddf80SAlan Tull }; 460a33ddf80SAlan Tull}; 461a33ddf80SAlan Tull 462a33ddf80SAlan TullConstraints 463a33ddf80SAlan Tull=========== 464a33ddf80SAlan Tull 465a33ddf80SAlan TullIt is beyond the scope of this document to fully describe all the FPGA design 466a33ddf80SAlan Tullconstraints required to make partial reconfiguration work[1] [2] [3], but a few 467a33ddf80SAlan Tulldeserve quick mention. 468a33ddf80SAlan Tull 469*47aab533SBjorn HelgaasA persona must have boundary connections that line up with those of the partition 470a33ddf80SAlan Tullor region it is designed to go into. 471a33ddf80SAlan Tull 472a33ddf80SAlan TullDuring programming, transactions through those connections must be stopped and 473a33ddf80SAlan Tullthe connections must be held at a fixed logic level. This can be achieved by 474a33ddf80SAlan TullFPGA Bridges that exist on the FPGA fabric prior to the partial reconfiguration. 475a33ddf80SAlan Tull 476a33ddf80SAlan Tull-- 477a33ddf80SAlan Tull[1] www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/ug/ug_partrecon.pdf 478a33ddf80SAlan Tull[2] tspace.library.utoronto.ca/bitstream/1807/67932/1/Byma_Stuart_A_201411_MAS_thesis.pdf 4798359b4c1SAlexander A. Klimov[3] https://www.xilinx.com/support/documentation/sw_manuals/xilinx14_1/ug702.pdf 480