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