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