altera fpga area and fpga bus
Subsystems (2)
v15 cover altera fpga area and fpga bus
From: Alan Tull <[email protected]>
For v15, I'm not using the FPGA Manager as the bus. I'm adding a FPGA Bus; the FPGA Manager and bridges go below it.
I've gotten enough feedback that my proposals are Altera specific that I am going with that and changing the bindings to include an 'altr,' prefix.
I've combined the bindings document and the other Documentation/fpga/ document and done a rewrite there.
Anybody who tried the previous patchset will not have much changes to do to get this going. The changes are:
* The live tree has a 'altr,fpga-bus' which contains the FPGA Manager and FPGA Bridges.
* The target path in your overlays needs to be adjusted accordingly.
That said, the changes for each of these submissions is getting to be less and less; most of these patches are unchanged for v15.
Alan Tull (6):
fpga: add bindings document for fpga area and fpga bus add sysfs document for fpga bridge class
ARM: socfpga: add bindings document for fpga bridge drivers
fpga: add fpga bridge framework
fpga: fpga-area and fpga-bus: device tree control for FPGA
ARM: socfpga: fpga bridge driver support
Documentation/ABI/testing/sysfs-class-fpga-bridge | 11 + .../bindings/fpga/altera-fpga-bus-fpga-area.txt | 452 ++++++++++++++++++++ .../bindings/fpga/altera-fpga2sdram-bridge.txt | 15 + .../bindings/fpga/altera-hps2fpga-bridge.txt | 43 ++ drivers/fpga/Kconfig | 21 + drivers/fpga/Makefile | 7 + drivers/fpga/altera-fpga2sdram.c | 174 ++++++++ drivers/fpga/altera-hps2fpga.c | 213 +++++++++ drivers/fpga/fpga-area.c | 352 +++++++++++++++ drivers/fpga/fpga-bridge.c | 388 +++++++++++++++++ include/linux/fpga/fpga-bridge.h | 56 +++ 11 files changed, 1732 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-fpga-bridge create mode 100644 Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt create mode 100644 Documentation/devicetree/bindings/fpga/altera-fpga2sdram-bridge.txt create mode 100644 Documentation/devicetree/bindings/fpga/altera-hps2fpga-bridge.txt create mode 100644 drivers/fpga/altera-fpga2sdram.c create mode 100644 drivers/fpga/altera-hps2fpga.c create mode 100644 drivers/fpga/fpga-area.c create mode 100644 drivers/fpga/fpga-bridge.c create mode 100644 include/linux/fpga/fpga-bridge.h
Signature · 1 line
1.7.9.5
PATCH v15 1/6 fpga: add bindings document for fpga area and fpga bus
From: Alan Tull <[email protected]>
New bindings document for FPGA Area for reprogramming FPGA's under Device Tree control
---
v9: initial version added to this patchset v10: s/fpga/FPGA/g
replace DT overlay example with slightly more complicated example move to staging/simple-fpga-bus
v11: No change in this patch for v11 of the patch set
v12: Moved out of staging.
Changed to use FPGA bridges framework instead of resets for bridges.
v13: bridge@0xff20000 -> bridge@ff200000, etc
Leave out directly talking about overlays
Remove regs and clocks directly under simple-fpga-bus in example Use common "firmware-name" binding instead of "fpga-firmware"
v14: Use firmware-name in bindings description
Call it FPGA Area
Remove bindings that specify FPGA Manager and FPGA Bridges
v15: Cleanup as per Rob's comments
Combine usage doc with bindings document
Document as being Altera specific
Additions and changes to add FPGA Bus
--- .../bindings/fpga/altera-fpga-bus-fpga-area.txt | 452 ++++++++++++++++++++ 1 file changed, 452 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +452 -0
@@ -0,0 +1,452 @@ +Altera FPGA Area and FPGA Bus Device Tree Binding + +Alan Tull 2016 + + CONTENTS + - Introduction + - Terminology + - Overview + - Constraints + - FPGA Bus + - FPGA Area + - Supported Use Models + - Sequence + - Device Tree Examples + + +Introduction +============ + +FPGA Buses and FPGA Areas are introduced as a way to solve the problem of how to +reprogram an Altera FPGA under an operating system and have the new hardware +show up in the device tree. By adding these bindings to the Device Tree, a +system can have the information needed to do the FPGA programming to add the +desired hardware, and also the information about the devices to be added to the +Device Tree once the programming has succeeded. + + +Terminology +=========== + +Full Reconfiguration + * The entire FPGA is programmed. + +Partial Reconfiguration (PR) + * The FPGA is broken up into regions. One of these regions is reprogrammed + while the rest of the FPGA is not affected. Not all FPGA's support this. + +FPGA Manager & FPGA Manager Framework + * An FPGA Manager is a hardware block that programs an FPGA under the control + of a host processor. + * The FPGA Manager Framework provides drivers and functions to program an + FPGA. + +FPGA Bridge & FPGA Bridge Framework + * Provides drivers and functions to control bridges that enable/disable + data to the FPGA. + * FPGA Bridges should be disabled while the FPGA is being programmed to + prevent spurious data on the bus. + * FPGA Bridges may not be needed in implementations where the FPGA Manager + handles this. + +Freeze Blocks + * Freeze Blocks function as FPGA Bridges within the FPGA fabric. In the case + of PR, the buses from the processor are split within the FPGA. Each PR + region gets its own split of the buses, protected by an independently + controlled Freeze Block. Several busses may be connected to a single + PR region; a Freeze Block controls the traffic of all these busses + together. + +Controlling Bridge + * The processor and FPGA may be connected by multiple FPGA Bridges. In a text + based hierarchy, it is difficult to show this properly as a device would + have several parents. + * The bridge that handles register access to the FPGA is designated the + "controlling" bridge. + * The controlling bridge will be the target point under which the overlay is + inserted. + + +Overview +======== + +This binding introduces the FPGA Bus and FPGA Area. + +An FPGA Bus is a virtualized bus that contains the devices needed to be able to +program an FPGA device. It contains a child FPGA Manager and may contain child +FPGA Bridges, if needed. The FPGA Manager is the hardware block that handles +programming the FPGA. FPGA Bridges function to prevent spurious data from the +FPGA going on the processor busses during FPGA programming. In the case of +partial reconfiguration, additional bridges (Freeze Blocks) for each +reconfiguration region are required. + +An FPGA Area contains information about a section of an FPGA (in the case of +partial reconfiguration or the whole FPGA (for full reconfiguration). The FPGA +Area contains the name of the FPGA image file to be programmed and the child +devices that will be contained in the FPGA after programming. + +The intended use is that device tree overlays can be used to add hardware to an +FPGA while an operating system is running. In that case, the FPGA Bus and its +associated information will exist in the live device tree, while FPGA Areas are +added to the device tree by applying device tree overlays while the operating +system is running. Loading such an overlay will cause the FPGA to be programmed +and the child devices to be populated. Removing an overlay will cause the +devices to be removed from the device tree and free up those FPGA resources. + + +Constraints +=========== + +It is beyond the scope of this document to fully describe all the FPGA design +constraints required to make partial reconfiguration work[1] [2], but a few +deserve quick mention. A partial reconfiguration FPGA image must have +boundary connections that line up with those the current programming of the +FPGA. Also, those during programming, those connections must be frozen. This +can be achieved by "Freeze Blocks" which are FPGA Bridges that exist on the FPGA +fabric prior to the partial reconfiguration. + + +FPGA Bus +======== + +An FPGA bus is a virtualized bus that specifies the devices needed to program an +FPGA. + +Required properties: +- compatible : should contain "altr,fpga-bus" and "simple-bus" + "simple-bus" is required to allow populating the child nodes. + +A FPGA Bus should contain an FPGA Manager as a child node. + +A FPGA Bus may require FPGA Bridges as child nodes if the FPGA Manager does not +control the hardware bridges. + +The FPGA Bridge that allows memory mapped register access is designated the +"controlling" bridge. This bridge serves as the insertion point of DT overlays. +Both the FPGA Area and the controlling bridge require the "simple-bus" +compatibility string to allow populating the child nodes contained in the +overlay. + +In the example below, fpgamgr@ff706000 would be used to do any programming +operations on the FPGA and the two bridges specified would be disabled +during the programming and re-enabled afterwards if the programming +succeeds. + +Example: + fpgabus@0 { + compatible = "altr,fpga-bus", "simple-bus"; + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + + fpgamgr@ff706000 { + compatible = "altr,socfpga-fpga-mgr"; + reg = <0xff706000 0x1000 + 0xffb90000 0x1000>; + interrupts = <0 175 4>; + }; + + bridge@0 { + compatible = "altr,socfpga-lwhps2fpga-bridge", + "simple-bus"; + resets = <&rst LWHPS2FPGA_RESET>; + reset-names = "lwhps2fpga"; + clocks = <&l4_main_clk>; + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + }; + + bridge@1 { + compatible = "altr,socfpga-hps2fpga-bridge"; + resets = <&rst HPS2FPGA_RESET>; + reset-names = "hps2fpga"; + clocks = <&l4_main_clk>; + }; + }; + +FPGA Area +========= + +An FPGA Area details information about a section of an FPGA including the FPGA +image needed to program it and the hardware contained once it is programmed. + +An FPGA Area corresponds to the whole FPGA in the case of full reconfiguration +or a section of an FPGA in the case of partial reconfiguration. + +Required properties: +- compatible : should contain "altr,fpga-area" +- #address-cells, #size-cells, ranges: must be present to handle address space + mapping for children. + +Optional properties: +- firmware-name : should contain the name of an FPGA image file located on the + firmware search path. +- partial-reconfig : boolean property should be defined if partial + reconfiguration of the FPGA is to be done, otherwise full reconfiguration + is done. + +In the example below, the target path is the controlling bridge of the FPGA Bus +example. The FPGA would be programmed with the image contained in the +"soc_system.rbf" specified. Assuming programming succeeds, the child devices +would be populated afterwords. In this particular example, ranges has two +chip selects as one memory region is tied to the host processor and the +other is a memory region on the FPGA. + +If there are no bridges in the FPGA Bus, the target path would point to +the FPGA Manager. + +Example: + +/dts-v1/; +/plugin/; +/ { + fragment@0 { + target-path="/soc/fpgamgr@ff706000/bridge@0"; + __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + bridge@ff200000 { + compatible = "fpga-area"; + + #address-cells = <2>; + #size-cells = <1>; + + ranges = <0 0x00000000 0xc0000000 0x00010000>, + <1 0x00020000 0xff220000 0x00000008>, + <1 0x00010040 0xff210040 0x00000020>; + + firmware-name = "soc_system.rbf"; + + onchip_memory2_0: memory@0 { + device_type = "memory"; + compatible = "altr,onchipmem-15.1"; + reg = <0 0x00000000 0x00010000>; + }; + + jtag_uart: serial@100020000 { + compatible = "altr,juart-1.0"; + reg = <1 0x00020000 0x00000008>; + interrupt-parent = <&intc>; + interrupts = <0 42 4>; + }; + + led_pio: gpio@100010040 { + compatible = "altr,pio-1.0"; + reg = <1 0x00010040 0x00000020>; + altr,gpio-bank-width = <4>; + #gpio-cells = <2>; + gpio-controller; + }; + }; + }; + }; +}; + +Supported Use Models +==================== + +Here's a list of supported use models. We may need to add more. Some uses are +specific to one FPGA device or another. + + * No FPGA Bridges + In this case, the FPGA Manager which programs the FPGA also handles the + bridges. No FPGA Bridge devices are needed for full reconfiguration. + + The DT overlay will specify the FPGA Manager as the overlay target. + + * Full reconfiguration with bridges + In the case, there are several bridges between the processor and FPGA, that + need to be disabled during full reconfiguration. The live DT before the + overlay is applied will have an FPGA Bus. + + The DT overlay will specify the controlling bridge as the overlay target. + + * Partial reconfiguration with bridges in the FPGA + In this case, the FPGA will have more than one section that will be + programmed separately. Other sections may be active on the bus while FPGA + is being programmed. To manage this, Freeze blocks need to exist on the FPGA + that can freeze all the buses going to one FPGA area while the buses are + enabled for other sections. + +Sequence +======== + +When a DT overlay is loaded, the FPGA Area will be probed and will do the +following: + 1. Disable the FPGA Bridges. + 2. Use the the FPGA manager core to program the FPGA. + 3. Enable the FPGA Bridges. + 4. Call of_platform_populate resulting in device drivers getting probed. + +When the overlay is removed, the FPGA Area in it is removed. This causes the +child nodes to be removed and then the bridges are disabled. + +Device Tree Examples +==================== + +The intention of this section is to give some simple examples, focusing on +the placement of the elements detailed above, especially: + * FPGA Bus and associated FPGA Manager and FPGA Bridges + * FPGA Area and associated properties + * simple-bus + * ranges + * target-path + +For the purposes of this section, I'm dividing the Device Tree into two parts, +each with its own requirements. The two parts are: + * The live DT prior to the overlay being added + * The DT overlay + +The live Device Tree must contain an FPGA Bus, which has a child FPGA Manager to +handle programming the FPGA. If FPGA Bridges need to be involved, they show up +in the DT as direct children of the FPGA Bus. During full reconfiguration, the +FPGA Area will disable any bridges that are direct children of the FPGA Bus and +will re-enable them after FPGA programming has succeeded. + +The Device Tree Overlay will contain: + * "target-path" + The insertion point where the the contents of the overlay will go into the + live tree. + * "ranges" + * "firmware-name" + Specifies the name of the FPGA image file on the firmware search + path. The search path is described in the firmware class documentation. + * "partial-reconfig" + This binding is a boolean and should be present if partial reconfiguration + is to be done. + * child nodes corresponding to hardware that will be loaded in this region of + the FPGA. + + +Device Tree Example: Partial Reconfiguration with no Bridges +============================================================ + +Live Device Tree contains: + fpgamgr@ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr", "simple-bus"; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + reset-names = "fpgamgr"; + reg = <0xffd03000 0x1000 + 0xffcfe400 0x1000>; + + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + }; + +DT Overlay contains: +/dts-v1/; +/plugin/; +/ { + fragment@0 { + target-path="/soc/fpgamgr@ffd03000"; /* targeted to the manager */ + __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + area@0 { + compatible = "fpga-area"; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x10010 0xff210010 0x10>; + + firmware-name = "fit_pr_v1.rbf"; + partial-reconfig; + + gpio@100010010 { + compatible = "altr,pio-1.0"; + reg = <0x10010 0x10>; + altr,ngpio = <4>; + #gpio-cells = <0x2>; + gpio-controller; + }; + }; + }; + }; +}; + + +Device Tree Example: Full Reconfiguration with Bridges +====================================================== + +Live Device Tree contains: + fpgamgr@ff706000 { + compatible = "altr,socfpga-fpga-mgr", "simple-bus"; + reg = <0xff706000 0x1000 + 0xffb90000 0x1000>; + interrupts = <0 175 4>; + + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + + bridge@0 { + /* both the manager and the controlling bridge have + * the added simple-bus compatible to allow child + * devices to be populated. */ + compatible = "altr,socfpga-lwhps2fpga-bridge", + "simple-bus"; + resets = <&rst LWHPS2FPGA_RESET>; + reset-names = "lwhps2fpga"; + clocks = <&l4_main_clk>; + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + }; + + bridge@1 { + /* In the case of full reconfiguration, both bridge@0 + * and bridge@1 will be disabled during FPGA + * programming and enabled afterwards. */ + compatible = "altr,socfpga-hps2fpga-bridge"; + resets = <&rst HPS2FPGA_RESET>; + reset-names = "hps2fpga"; + clocks = <&l4_main_clk>; + }; + }; + +DT Overlay contains: +/dts-v1/; +/plugin/; +/ { + fragment@0 { + target-path="/soc/fpgamgr@ff706000/bridge@0"; /* controlling bridge */ + __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + area@0 { + compatible = "fpga-area"; + + #address-cells = <2>; + #size-cells = <1>; + ranges = <0 0x00000000 0xc0000000 0x00010000>, + <1 0x00020000 0xff220000 0x00000008>; + + firmware-name = "soc_system.rbf"; + + onchip_memory2_0: memory@0 { + device_type = "memory"; + compatible = "altr,onchipmem-15.1"; + reg = <0 0x00000000 0x00010000>; + }; + + jtag_uart: serial@100020000 { + compatible = "altr,juart-1.0"; + reg = <1 0x00020000 0x00000008>; + interrupt-parent = <&intc>; + interrupts = <0 42 4>; + clocks = <&osc2>; + }; + }; + }; + }; +}; + +-- +[1] www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/ug/ug_partrecon.pdf +[2] tspace.library.utoronto.ca/bitstream/1807/67932/1/Byma_Stuart_A_201411_MAS_thesis.pdf
Signature · 1 line
1.7.9.5
Re: [PATCH v15 1/6] fpga: add bindings document for fpga area and fpga bus
Hi Alan,
I tried getting a simple example to work with overlays, however so far I failed getting
the child nodes to probe drivers, maybe you have an idea? The fpga image is loaded just fine.
in dts:
fpga_bus@0 {
compatible = "altr,fpga-bus", "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
ranges;
fpga_mgr0: devcfg@f8007000 {
compatible = "xlnx,zynq-devcfg-1.0",
"simple-bus";
reg = <0xf8007000 0x100>;
interrupt-parent = <&intc>;
interrupts = <0 8 4>;
clocks = <&clkc 12>;
clock-names = "ref_clk";
syscon = <&slcr>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
};
};overlay:
fragment@0 {
target-path = "/amba/devcfg@f8007000";
__overlay__ {
#address-cells = <1>;
#size-cells = <1>;
area@0 {
compatible = "fpga-area";
#address-cells = <1>;
#size-cells = <1>;
ranges;
firmware-name = "dmac.bin";
axi_dma0: axidma@40000000 {
compatible = "xlnx,axi-dma-1.00.a";
reg = <0x40000000 0x10000>;
#dma-cells = <1>;
xlnx,include-sg = <1>;
xlnx,include-dre = <1>;
status = "okay";
[...]
};
};
};
};I also stumbled across those while looking through the examples:
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 202
Quoted 4 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +4
-0+Example: + +/dts-v1/; +/plugin/;
/dts-v1/ / plugin/; the above syntax is deprecated:
Warning (deprecated_plugin_syntax): Use '/dts-v1/ /plugin/'; syntax. /dts-v1/; /plugin/; is going to be removed in next versions
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+Device Tree Example: Partial Reconfiguration with no Bridges +============================================================ + +Live Device Tree contains: + fpgamgr@ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr", "simple-bus"; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + reset-names = "fpgamgr"; + reg = <0xffd03000 0x1000
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 342
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+ 0xffcfe400 0x1000>; + + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + }; + +DT Overlay contains: +/dts-v1/; +/plugin/;
see above
Cheers,
Moritz
Re: [PATCH v15 1/6] fpga: add bindings document for fpga area and fpga bus
Quoted 31 lines · Moritz Fischer
Hi Alan,
I tried getting a simple example to work with overlays, however so far I failed getting
the child nodes to probe drivers, maybe you have an idea? The fpga image is loaded just fine.in dts:
fpga_bus@0 { compatible = "altr,fpga-bus", "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; fpga_mgr0: devcfg@f8007000 { compatible = "xlnx,zynq-devcfg-1.0", "simple-bus"; reg = <0xf8007000 0x100>; interrupt-parent = <&intc>; interrupts = <0 8 4>; clocks = <&clkc 12>; clock-names = "ref_clk"; syscon = <&slcr>; #address-cells = <1>; #size-cells = <1>; ranges; }; };
Quoted 4 lines
overlay:
fragment@0 { target-path = "/amba/devcfg@f8007000";
Hi Moritz,
target-path = "/amba/fpga_bus@0/devcfg@f8007000";
should work, I hope. If it doesn't, turn on debugging for fpga-area.c and maybe add more printk's in the probe function. Hopefully you get to the fpga-area's probe function and can see which step is bailing out. If you get as far as of_platform_populate, but your axidma's probe isn't getting called then you could add some debug to drivers/of/platform.c to see why it's not getting populated.
Alan
Quoted 50 lines
__overlay__ { #address-cells = <1>; #size-cells = <1>; area@0 { compatible = "fpga-area"; #address-cells = <1>; #size-cells = <1>; ranges; firmware-name = "dmac.bin"; axi_dma0: axidma@40000000 { compatible = "xlnx,axi-dma-1.00.a"; reg = <0x40000000 0x10000>; #dma-cells = <1>; xlnx,include-sg = <1>; xlnx,include-dre = <1>; status = "okay"; [...] }; }; }; };I also stumbled across those while looking through the examples:
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 202
Quoted 4 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +4
-0+Example: + +/dts-v1/; +/plugin/;/dts-v1/ / plugin/; the above syntax is deprecated:
Warning (
deprecated_plugin_syntax): Use '/dts-v1/ /plugin/'; syntax. /dts-v1/; /plugin/; is going to be removed in next versionsQuoted 12 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +12
-0+Device Tree Example: Partial Reconfiguration with no Bridges +============================================================ + +Live Device Tree contains: + fpgamgr@ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr", "simple-bus"; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + reset-names = "fpgamgr"; + reg = <0xffd03000 0x1000 + 0xffcfe400 0x1000>; +
Quoted 8 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 342
Quoted 8 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +8
-0+ #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + }; + +DT Overlay contains: +/dts-v1/; +/plugin/;
Yes, thanks! I will adjust the documentation to reflect that.
Alan
Quoted 7 lines
see above
Cheers,
Moritz
Re: [PATCH v15 1/6] fpga: add bindings document for fpga area and fpga bus
Hi Alan,
Quoted 1 line · atull
target-path = "/amba/fpga_bus@0/devcfg@f8007000";
derp ... building in the driver helps ... all good on your side ;-)
Cheers,
Moritz
Rob Herring
maintainerRe: [PATCH v15 1/6] fpga: add bindings document for fpga area and fpga bus
In reply to [email protected]Quoted 37 lines · On Wed, Jan 20, 2016 at 01:24:22PM -0600, [email protected] wrote:
From: Alan Tull <[email protected]>
New bindings document for FPGA Area for reprogramming FPGA's under Device Tree control
Signed-off-by Alan Tull <[email protected]>---
v9: initial version added to this patchset v10: s/fpga/FPGA/greplace DT overlay example with slightly more complicated example move to staging/simple-fpga-bus
v11: No change in this patch for v11 of the patch set
v12: Moved out of staging.
Changed to use FPGA bridges framework instead of resets for bridges.
v13: bridge@0xff20000 -> bridge@ff200000, etc
Leave out directly talking about overlays
Remove regs and clocks directly under simple-fpga-bus in example Use common "firmware-name" binding instead of "fpga-firmware"
v14: Use firmware-name in bindings description
Call it FPGA Area
Remove bindings that specify FPGA Manager and FPGA Bridges
v15: Cleanup as per Rob's comments
Combine usage doc with bindings document
Document as being Altera specific
Additions and changes to add FPGA Bus--- .../bindings/fpga/altera-fpga-bus-fpga-area.txt | 452 ++++++++++++++++++++ 1 file changed, 452 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txtDocumentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +0
-0
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 1
Quoted 1 line
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +1
-0@@ -0,0 +1,452 @@ +Altera FPGA Area and FPGA Bus Device Tree Binding
Getting closer I think...
Quoted 106 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +106
-0+ +Alan Tull 2016 + + CONTENTS + - Introduction + - Terminology + - Overview + - Constraints + - FPGA Bus + - FPGA Area + - Supported Use Models + - Sequence + - Device Tree Examples + + +Introduction +============ + +FPGA Buses and FPGA Areas are introduced as a way to solve the problem of how to +reprogram an Altera FPGA under an operating system and have the new hardware +show up in the device tree. By adding these bindings to the Device Tree, a +system can have the information needed to do the FPGA programming to add the +desired hardware, and also the information about the devices to be added to the +Device Tree once the programming has succeeded. + + +Terminology +=========== + +Full Reconfiguration + * The entire FPGA is programmed. + +Partial Reconfiguration (PR) + * The FPGA is broken up into regions. One of these regions is reprogrammed + while the rest of the FPGA is not affected. Not all FPGA's support this. + +FPGA Manager & FPGA Manager Framework + * An FPGA Manager is a hardware block that programs an FPGA under the control + of a host processor. + * The FPGA Manager Framework provides drivers and functions to program an + FPGA. + +FPGA Bridge & FPGA Bridge Framework + * Provides drivers and functions to control bridges that enable/disable + data to the FPGA. + * FPGA Bridges should be disabled while the FPGA is being programmed to + prevent spurious data on the bus. + * FPGA Bridges may not be needed in implementations where the FPGA Manager + handles this. + +Freeze Blocks + * Freeze Blocks function as FPGA Bridges within the FPGA fabric. In the case + of PR, the buses from the processor are split within the FPGA. Each PR + region gets its own split of the buses, protected by an independently + controlled Freeze Block. Several busses may be connected to a single + PR region; a Freeze Block controls the traffic of all these busses + together. + +Controlling Bridge + * The processor and FPGA may be connected by multiple FPGA Bridges. In a text + based hierarchy, it is difficult to show this properly as a device would + have several parents. + * The bridge that handles register access to the FPGA is designated the + "controlling" bridge. + * The controlling bridge will be the target point under which the overlay is + inserted. + + +Overview +======== + +This binding introduces the FPGA Bus and FPGA Area. + +An FPGA Bus is a virtualized bus that contains the devices needed to be able to +program an FPGA device. It contains a child FPGA Manager and may contain child +FPGA Bridges, if needed. The FPGA Manager is the hardware block that handles +programming the FPGA. FPGA Bridges function to prevent spurious data from the +FPGA going on the processor busses during FPGA programming. In the case of +partial reconfiguration, additional bridges (Freeze Blocks) for each +reconfiguration region are required. + +An FPGA Area contains information about a section of an FPGA (in the case of +partial reconfiguration or the whole FPGA (for full reconfiguration). The FPGA +Area contains the name of the FPGA image file to be programmed and the child +devices that will be contained in the FPGA after programming. + +The intended use is that device tree overlays can be used to add hardware to an +FPGA while an operating system is running. In that case, the FPGA Bus and its +associated information will exist in the live device tree, while FPGA Areas are +added to the device tree by applying device tree overlays while the operating +system is running. Loading such an overlay will cause the FPGA to be programmed +and the child devices to be populated. Removing an overlay will cause the +devices to be removed from the device tree and free up those FPGA resources. + + +Constraints +=========== + +It is beyond the scope of this document to fully describe all the FPGA design +constraints required to make partial reconfiguration work[1] [2], but a few +deserve quick mention. A partial reconfiguration FPGA image must have +boundary connections that line up with those the current programming of the +FPGA. Also, those during programming, those connections must be frozen. This +can be achieved by "Freeze Blocks" which are FPGA Bridges that exist on the FPGA +fabric prior to the partial reconfiguration. +
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 117
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+ +FPGA Bus +======== + +An FPGA bus is a virtualized bus that specifies the devices needed to program an +FPGA. + +Required properties: +- compatible : should contain "altr,fpga-bus" and "simple-bus" + "simple-bus" is required to allow populating the child nodes.
I think I said this before, but you should not need simple-bus. Having it is wrong if the bus requires some configuration before enumerating the child nodes. The way you have it, the bridge driver could probe before the FPGA manager or vice-versa. I'm guessing one way will work and the other will not, and you are getting lucky. You should also test will the overlay applied before boot (i.e. single dtb with all areas populated). The simple rule is does the node (containing simple-bus) require configuration for child nodes to be accessed? If yes, you can't use simple-bus.
Part of your problem is you may need a custom match table. Using of_default_bus_match_table will only match the immediate child nodes of the starting node. Alternatively, you need to make the bridge node the starting node.
Quoted 9 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +9
-0+ +A FPGA Bus should contain an FPGA Manager as a child node. + +A FPGA Bus may require FPGA Bridges as child nodes if the FPGA Manager does not +control the hardware bridges. + +The FPGA Bridge that allows memory mapped register access is designated the +"controlling" bridge. This bridge serves as the insertion point of DT overlays. +Both the FPGA Area and the controlling bridge require the "simple-bus"
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 136
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+compatibility string to allow populating the child nodes contained in the +overlay. + +In the example below, fpgamgr@ff706000 would be used to do any programming +operations on the FPGA and the two bridges specified would be disabled +during the programming and re-enabled afterwards if the programming +succeeds. + +Example: + fpgabus@0 {
If you have a unit-address, then there should be a reg property or ranges parent bus addr.
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 142
Quoted 6 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +6
-0+ compatible = "altr,fpga-bus", "simple-bus"; + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + + fpgamgr@ff706000 {
As mentioned in the other thread, this may be better done as a phandle, but I don't feel too strongly either way.
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 149
Quoted 7 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +7
-0+ compatible = "altr,socfpga-fpga-mgr"; + reg = <0xff706000 0x1000 + 0xffb90000 0x1000>; + interrupts = <0 175 4>; + }; + + bridge@0 {
Same here. Doesn't this bridge have some associated address range.
Essentially, the hierarchy from child devices up to the root should reflect the address decoding at each step.
Quoted 38 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +38
-0+ compatible = "altr,socfpga-lwhps2fpga-bridge", + "simple-bus"; + resets = <&rst LWHPS2FPGA_RESET>; + reset-names = "lwhps2fpga"; + clocks = <&l4_main_clk>; + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + }; + + bridge@1 { + compatible = "altr,socfpga-hps2fpga-bridge"; + resets = <&rst HPS2FPGA_RESET>; + reset-names = "hps2fpga"; + clocks = <&l4_main_clk>; + }; + }; + +FPGA Area +========= + +An FPGA Area details information about a section of an FPGA including the FPGA +image needed to program it and the hardware contained once it is programmed. + +An FPGA Area corresponds to the whole FPGA in the case of full reconfiguration +or a section of an FPGA in the case of partial reconfiguration. + +Required properties: +- compatible : should contain "altr,fpga-area" +- #address-cells, #size-cells, ranges: must be present to handle address space + mapping for children. + +Optional properties: +- firmware-name : should contain the name of an FPGA image file located on the + firmware search path. +- partial-reconfig : boolean property should be defined if partial + reconfiguration of the FPGA is to be done, otherwise full reconfiguration + is done.
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 197
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+ +In the example below, the target path is the controlling bridge of the FPGA Bus +example. The FPGA would be programmed with the image contained in the +"soc_system.rbf" specified. Assuming programming succeeds, the child devices +would be populated afterwords. In this particular example, ranges has two +chip selects as one memory region is tied to the host processor and the +other is a memory region on the FPGA. + +If there are no bridges in the FPGA Bus, the target path would point to +the FPGA Manager.
How do you not have a bridge? There has to be something preventing access. Do you really mean the bridge and fpga-mgr blocks are combined into 1?
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 210
Quoted 13 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +13
-0+ +Example: + +/dts-v1/; +/plugin/; +/ { + fragment@0 { + target-path="/soc/fpgamgr@ff706000/bridge@0"; + __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + bridge@ff200000 {
Wouldn't this be area@...? area is a bit too generic. I'd use "fpga-area" for the node name too.
Quoted 130 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +130
-0+ compatible = "fpga-area"; + + #address-cells = <2>; + #size-cells = <1>; + + ranges = <0 0x00000000 0xc0000000 0x00010000>, + <1 0x00020000 0xff220000 0x00000008>, + <1 0x00010040 0xff210040 0x00000020>; + + firmware-name = "soc_system.rbf"; + + onchip_memory2_0: memory@0 { + device_type = "memory"; + compatible = "altr,onchipmem-15.1"; + reg = <0 0x00000000 0x00010000>; + }; + + jtag_uart: serial@100020000 { + compatible = "altr,juart-1.0"; + reg = <1 0x00020000 0x00000008>; + interrupt-parent = <&intc>; + interrupts = <0 42 4>; + }; + + led_pio: gpio@100010040 { + compatible = "altr,pio-1.0"; + reg = <1 0x00010040 0x00000020>; + altr,gpio-bank-width = <4>; + #gpio-cells = <2>; + gpio-controller; + }; + }; + }; + }; +}; + +Supported Use Models +==================== + +Here's a list of supported use models. We may need to add more. Some uses are +specific to one FPGA device or another. + + * No FPGA Bridges + In this case, the FPGA Manager which programs the FPGA also handles the + bridges. No FPGA Bridge devices are needed for full reconfiguration. + + The DT overlay will specify the FPGA Manager as the overlay target. + + * Full reconfiguration with bridges + In the case, there are several bridges between the processor and FPGA, that + need to be disabled during full reconfiguration. The live DT before the + overlay is applied will have an FPGA Bus. + + The DT overlay will specify the controlling bridge as the overlay target. + + * Partial reconfiguration with bridges in the FPGA + In this case, the FPGA will have more than one section that will be + programmed separately. Other sections may be active on the bus while FPGA + is being programmed. To manage this, Freeze blocks need to exist on the FPGA + that can freeze all the buses going to one FPGA area while the buses are + enabled for other sections. + +Sequence +======== + +When a DT overlay is loaded, the FPGA Area will be probed and will do the +following: + 1. Disable the FPGA Bridges. + 2. Use the the FPGA manager core to program the FPGA. + 3. Enable the FPGA Bridges. + 4. Call of_platform_populate resulting in device drivers getting probed. + +When the overlay is removed, the FPGA Area in it is removed. This causes the +child nodes to be removed and then the bridges are disabled. + +Device Tree Examples +==================== + +The intention of this section is to give some simple examples, focusing on +the placement of the elements detailed above, especially: + * FPGA Bus and associated FPGA Manager and FPGA Bridges + * FPGA Area and associated properties + * simple-bus + * ranges + * target-path + +For the purposes of this section, I'm dividing the Device Tree into two parts, +each with its own requirements. The two parts are: + * The live DT prior to the overlay being added + * The DT overlay + +The live Device Tree must contain an FPGA Bus, which has a child FPGA Manager to +handle programming the FPGA. If FPGA Bridges need to be involved, they show up +in the DT as direct children of the FPGA Bus. During full reconfiguration, the +FPGA Area will disable any bridges that are direct children of the FPGA Bus and +will re-enable them after FPGA programming has succeeded. + +The Device Tree Overlay will contain: + * "target-path" + The insertion point where the the contents of the overlay will go into the + live tree. + * "ranges" + * "firmware-name" + Specifies the name of the FPGA image file on the firmware search + path. The search path is described in the firmware class documentation. + * "partial-reconfig" + This binding is a boolean and should be present if partial reconfiguration + is to be done. + * child nodes corresponding to hardware that will be loaded in this region of + the FPGA. + + +Device Tree Example: Partial Reconfiguration with no Bridges +============================================================ + +Live Device Tree contains: + fpgamgr@ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr", "simple-bus"; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + reset-names = "fpgamgr"; + reg = <0xffd03000 0x1000 + 0xffcfe400 0x1000>; + + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + }; + +DT Overlay contains:
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 350
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+/dts-v1/; +/plugin/; +/ { + fragment@0 { + target-path="/soc/fpgamgr@ffd03000"; /* targeted to the manager */ + __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + area@0 {
Are the number of areas software configurable? If not, then the areas should be part of the base DT rather than the overlay.
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 360
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+ compatible = "fpga-area"; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x10010 0xff210010 0x10>; + + firmware-name = "fit_pr_v1.rbf"; + partial-reconfig; + + gpio@100010010 {
gpio@10010
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+ compatible = "altr,pio-1.0"; + reg = <0x10010 0x10>; + altr,ngpio = <4>; + #gpio-cells = <0x2>; + gpio-controller; + }; + }; + }; + }; +};
Re: [PATCH v15 1/6] fpga: add bindings document for fpga area and fpga bus
Quoted 32 lines · Rob Herring
Quoted 31 lines · On Wed, Jan 20, 2016 at 01:24:22PM -0600, [email protected] wrote:
From: Alan Tull <[email protected]>
New bindings document for FPGA Area for reprogramming FPGA's under Device Tree control
Signed-off-by Alan Tull <[email protected]>---
v9: initial version added to this patchset v10: s/fpga/FPGA/greplace DT overlay example with slightly more complicated example move to staging/simple-fpga-bus
v11: No change in this patch for v11 of the patch set
v12: Moved out of staging.
Changed to use FPGA bridges framework instead of resets for bridges.
v13: bridge@0xff20000 -> bridge@ff200000, etc
Leave out directly talking about overlays
Remove regs and clocks directly under simple-fpga-bus in example Use common "firmware-name" binding instead of "fpga-firmware"
v14: Use firmware-name in bindings description
Call it FPGA Area
Remove bindings that specify FPGA Manager and FPGA Bridges
v15: Cleanup as per Rob's comments
Combine usage doc with bindings document
Document as being Altera specific
Additions and changes to add FPGA Bus--- .../bindings/fpga/altera-fpga-bus-fpga-area.txt | 452 ++++++++++++++++++++ 1 file changed, 452 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt
Quoted 9 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 1
Quoted 7 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +1
-0@@ -0,0 +1,452 @@ +Altera FPGA Area and FPGA Bus Device Tree BindingGetting closer I think...
Great!
Quoted 119 lines
Quoted 107 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +106
-0+ +Alan Tull 2016 + + CONTENTS + - Introduction + - Terminology + - Overview + - Constraints + - FPGA Bus + - FPGA Area + - Supported Use Models + - Sequence + - Device Tree Examples + + +Introduction +============ + +FPGA Buses and FPGA Areas are introduced as a way to solve the problem of how to +reprogram an Altera FPGA under an operating system and have the new hardware +show up in the device tree. By adding these bindings to the Device Tree, a +system can have the information needed to do the FPGA programming to add the +desired hardware, and also the information about the devices to be added to the +Device Tree once the programming has succeeded. + + +Terminology +=========== + +Full Reconfiguration + * The entire FPGA is programmed. + +Partial Reconfiguration (PR) + * The FPGA is broken up into regions. One of these regions is reprogrammed + while the rest of the FPGA is not affected. Not all FPGA's support this. + +FPGA Manager & FPGA Manager Framework + * An FPGA Manager is a hardware block that programs an FPGA under the control + of a host processor. + * The FPGA Manager Framework provides drivers and functions to program an + FPGA. + +FPGA Bridge & FPGA Bridge Framework + * Provides drivers and functions to control bridges that enable/disable + data to the FPGA. + * FPGA Bridges should be disabled while the FPGA is being programmed to + prevent spurious data on the bus. + * FPGA Bridges may not be needed in implementations where the FPGA Manager + handles this. + +Freeze Blocks + * Freeze Blocks function as FPGA Bridges within the FPGA fabric. In the case + of PR, the buses from the processor are split within the FPGA. Each PR + region gets its own split of the buses, protected by an independently + controlled Freeze Block. Several busses may be connected to a single + PR region; a Freeze Block controls the traffic of all these busses + together. + +Controlling Bridge + * The processor and FPGA may be connected by multiple FPGA Bridges. In a text + based hierarchy, it is difficult to show this properly as a device would + have several parents. + * The bridge that handles register access to the FPGA is designated the + "controlling" bridge. + * The controlling bridge will be the target point under which the overlay is + inserted. + + +Overview +======== + +This binding introduces the FPGA Bus and FPGA Area. + +An FPGA Bus is a virtualized bus that contains the devices needed to be able to +program an FPGA device. It contains a child FPGA Manager and may contain child +FPGA Bridges, if needed. The FPGA Manager is the hardware block that handles +programming the FPGA. FPGA Bridges function to prevent spurious data from the +FPGA going on the processor busses during FPGA programming. In the case of +partial reconfiguration, additional bridges (Freeze Blocks) for each +reconfiguration region are required. + +An FPGA Area contains information about a section of an FPGA (in the case of +partial reconfiguration or the whole FPGA (for full reconfiguration). The FPGA +Area contains the name of the FPGA image file to be programmed and the child +devices that will be contained in the FPGA after programming. + +The intended use is that device tree overlays can be used to add hardware to an +FPGA while an operating system is running. In that case, the FPGA Bus and its +associated information will exist in the live device tree, while FPGA Areas are +added to the device tree by applying device tree overlays while the operating +system is running. Loading such an overlay will cause the FPGA to be programmed +and the child devices to be populated. Removing an overlay will cause the +devices to be removed from the device tree and free up those FPGA resources. + + +Constraints +=========== + +It is beyond the scope of this document to fully describe all the FPGA design +constraints required to make partial reconfiguration work[1] [2], but a few +deserve quick mention. A partial reconfiguration FPGA image must have +boundary connections that line up with those the current programming of the +FPGA. Also, those during programming, those connections must be frozen. This +can be achieved by "Freeze Blocks" which are FPGA Bridges that exist on the FPGA +fabric prior to the partial reconfiguration. +Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 117
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+ +FPGA Bus +======== + +An FPGA bus is a virtualized bus that specifies the devices needed to program an +FPGA. + +Required properties: +- compatible : should contain "altr,fpga-bus" and "simple-bus" + "simple-bus" is required to allow populating the child nodes.I think I said this before, but you should not need simple-bus. Having
Quoted 8 lines
it is wrong if the bus requires some configuration before enumerating the child nodes. The way you have it, the bridge driver could probe before the FPGA manager or vice-versa. I'm guessing one way will work and the other will not, and you are getting lucky. You should also test will the overlay applied before boot (i.e. single dtb with all areas populated). The simple rule is does the node (containing simple-bus) require configuration for child nodes to be accessed? If yes, you can't use simple-bus.
Yes you did say that before. Thanks for the explanation here, it clarifies a lot. I'll work on something that implements this without relying on luck and simple-busses.
Quoted 6 lines
Part of your problem is you may need a custom match table. Using
of_default_bus_match_tablewill only match the immediate child nodes of the starting node. Alternatively, you need to make the bridge node the starting node.
Not sure what you ment here, maybe you mean leaving out the fpga-bus? I'm using fpga-bus to bring the specific manager and bridges together needed to handle reprogramming cycles on a specific FPGA.
Quoted 23 lines
Quoted 9 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +9
-0+ +A FPGA Bus should contain an FPGA Manager as a child node. + +A FPGA Bus may require FPGA Bridges as child nodes if the FPGA Manager does not +control the hardware bridges. + +The FPGA Bridge that allows memory mapped register access is designated the +"controlling" bridge. This bridge serves as the insertion point of DT overlays. +Both the FPGA Area and the controlling bridge require the "simple-bus"Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 136
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+compatibility string to allow populating the child nodes contained in the +overlay. + +In the example below, fpgamgr@ff706000 would be used to do any programming +operations on the FPGA and the two bridges specified would be disabled +during the programming and re-enabled afterwards if the programming +succeeds. + +Example: + fpgabus@0 {If you have a unit-address, then there should be a reg property or ranges parent bus addr.
Quoted 9 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 142
Quoted 6 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +6
-0+ compatible = "altr,fpga-bus", "simple-bus"; + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + + fpgamgr@ff706000 {As mentioned in the other thread, this may be better done as a phandle, but I don't feel too strongly either way.
I can see reasons for having the fpga manager and also the bridges specified by phandle within a fpga-bus. So an fpga-bus will add the following propertities:
fpga-mgr = <fpgamgr0>; fpga-bridges = <bridge0>, <bridge1>;
Quoted 11 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 149
Quoted 8 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +7
-0+ compatible = "altr,socfpga-fpga-mgr"; + reg = <0xff706000 0x1000 + 0xffb90000 0x1000>; + interrupts = <0 175 4>; + }; + + bridge@0 {Same here. Doesn't this bridge have some associated address range.
Quoted 2 lines
Essentially, the hierarchy from child devices up to the root should reflect the address decoding at each step.
Yes
Quoted 45 lines
Quoted 45 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +44
-0+ compatible = "altr,socfpga-lwhps2fpga-bridge", + "simple-bus"; + resets = <&rst LWHPS2FPGA_RESET>; + reset-names = "lwhps2fpga"; + clocks = <&l4_main_clk>; + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + }; + + bridge@1 { + compatible = "altr,socfpga-hps2fpga-bridge"; + resets = <&rst HPS2FPGA_RESET>; + reset-names = "hps2fpga"; + clocks = <&l4_main_clk>; + }; + }; + +FPGA Area +========= + +An FPGA Area details information about a section of an FPGA including the FPGA +image needed to program it and the hardware contained once it is programmed. + +An FPGA Area corresponds to the whole FPGA in the case of full reconfiguration +or a section of an FPGA in the case of partial reconfiguration. + +Required properties: +- compatible : should contain "altr,fpga-area" +- #address-cells, #size-cells, ranges: must be present to handle address space + mapping for children. + +Optional properties: +- firmware-name : should contain the name of an FPGA image file located on the + firmware search path. +- partial-reconfig : boolean property should be defined if partial + reconfiguration of the FPGA is to be done, otherwise full reconfiguration + is done. + +In the example below, the target path is the controlling bridge of the FPGA Bus +example. The FPGA would be programmed with the image contained in the +"soc_system.rbf" specified. Assuming programming succeeds, the child devices +would be populated afterwords. In this particular example, ranges has two +chip selects as one memory region is tied to the host processor and the
Quoted 8 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 197
Quoted 4 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +4
-0+other is a memory region on the FPGA. + +If there are no bridges in the FPGA Bus, the target path would point to +the FPGA Manager.How do you not have a bridge? There has to be something preventing access. Do you really mean the bridge and fpga-mgr blocks are combined into 1?
In the Xilinx case, the manager and bridge are still two hardware blocks but handled together by the manager driver. I didn't want to make Moritz write a FPGA Bridge when he already had code that handled his hardware bridges when he told his manager to do a write cycle.
Quoted 17 lines
Quoted 4 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +3
-0+ +Example: +Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 210
Quoted 10 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+/dts-v1/; +/plugin/; +/ { + fragment@0 { + target-path="/soc/fpgamgr@ff706000/bridge@0"; + __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + bridge@ff200000 {Wouldn't this be area@...? area is a bit too generic. I'd use "fpga-area" for the node name too.
This could be called fpga-area or fpga-region. More on that below.
Quoted 136 lines
Quoted 136 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +135
-0+ compatible = "fpga-area"; + + #address-cells = <2>; + #size-cells = <1>; + + ranges = <0 0x00000000 0xc0000000 0x00010000>, + <1 0x00020000 0xff220000 0x00000008>, + <1 0x00010040 0xff210040 0x00000020>; + + firmware-name = "soc_system.rbf"; + + onchip_memory2_0: memory@0 { + device_type = "memory"; + compatible = "altr,onchipmem-15.1"; + reg = <0 0x00000000 0x00010000>; + }; + + jtag_uart: serial@100020000 { + compatible = "altr,juart-1.0"; + reg = <1 0x00020000 0x00000008>; + interrupt-parent = <&intc>; + interrupts = <0 42 4>; + }; + + led_pio: gpio@100010040 { + compatible = "altr,pio-1.0"; + reg = <1 0x00010040 0x00000020>; + altr,gpio-bank-width = <4>; + #gpio-cells = <2>; + gpio-controller; + }; + }; + }; + }; +}; + +Supported Use Models +==================== + +Here's a list of supported use models. We may need to add more. Some uses are +specific to one FPGA device or another. + + * No FPGA Bridges + In this case, the FPGA Manager which programs the FPGA also handles the + bridges. No FPGA Bridge devices are needed for full reconfiguration. + + The DT overlay will specify the FPGA Manager as the overlay target. + + * Full reconfiguration with bridges + In the case, there are several bridges between the processor and FPGA, that + need to be disabled during full reconfiguration. The live DT before the + overlay is applied will have an FPGA Bus. + + The DT overlay will specify the controlling bridge as the overlay target. + + * Partial reconfiguration with bridges in the FPGA + In this case, the FPGA will have more than one section that will be + programmed separately. Other sections may be active on the bus while FPGA + is being programmed. To manage this, Freeze blocks need to exist on the FPGA + that can freeze all the buses going to one FPGA area while the buses are + enabled for other sections. + +Sequence +======== + +When a DT overlay is loaded, the FPGA Area will be probed and will do the +following: + 1. Disable the FPGA Bridges. + 2. Use the the FPGA manager core to program the FPGA. + 3. Enable the FPGA Bridges. + 4. Call of_platform_populate resulting in device drivers getting probed. + +When the overlay is removed, the FPGA Area in it is removed. This causes the +child nodes to be removed and then the bridges are disabled. + +Device Tree Examples +==================== + +The intention of this section is to give some simple examples, focusing on +the placement of the elements detailed above, especially: + * FPGA Bus and associated FPGA Manager and FPGA Bridges + * FPGA Area and associated properties + * simple-bus + * ranges + * target-path + +For the purposes of this section, I'm dividing the Device Tree into two parts, +each with its own requirements. The two parts are: + * The live DT prior to the overlay being added + * The DT overlay + +The live Device Tree must contain an FPGA Bus, which has a child FPGA Manager to +handle programming the FPGA. If FPGA Bridges need to be involved, they show up +in the DT as direct children of the FPGA Bus. During full reconfiguration, the +FPGA Area will disable any bridges that are direct children of the FPGA Bus and +will re-enable them after FPGA programming has succeeded. + +The Device Tree Overlay will contain: + * "target-path" + The insertion point where the the contents of the overlay will go into the + live tree. + * "ranges" + * "firmware-name" + Specifies the name of the FPGA image file on the firmware search + path. The search path is described in the firmware class documentation. + * "partial-reconfig" + This binding is a boolean and should be present if partial reconfiguration + is to be done. + * child nodes corresponding to hardware that will be loaded in this region of + the FPGA. + + +Device Tree Example: Partial Reconfiguration with no Bridges +============================================================ + +Live Device Tree contains: + fpgamgr@ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr", "simple-bus"; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + reset-names = "fpgamgr"; + reg = <0xffd03000 0x1000 + 0xffcfe400 0x1000>; + + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + }; + +DT Overlay contains: +/dts-v1/; +/plugin/; +/ { + fragment@0 { + target-path="/soc/fpgamgr@ffd03000"; /* targeted to the manager */
Quoted 8 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 350
Quoted 5 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +5
-0+ __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + area@0 {Are the number of areas software configurable? If not, then the areas should be part of the base DT rather than the overlay.
The number of areas is set by the FPGA image that creates the areas. A base FPGA image could be loaded by the bootloader or by the OS with a set number of area slots available.
So this could be done differently, divided into something where the areas (some call them "regions") are created in the live DT when the base FPGA image is loaded. Then the overlays would have something called 'personas' that plug into them. The areas would contain the information of which bridges to control and which fpga manager. Maybe this heirarchy (indexes are probably screwed up below).
Below, the fpga manager and hardware fpga bridges are specified outside the fpga bus and are referred to by phandles. Leaving out ranges, cells for brevity.
Live tree (after base FPGA image is loaded):
fpga-bus@0 {
compatible = "fpga-bus";
fpga-mgr = <fpgamgr@something>;
fpga-bridges = <..>, <..>;
fpga-area@0 {
compatible = "fpga-area";
bridges = <bridge@>;
};
fpga-area@... {
compatible = "fpga-area";
bridges = <bridge@...>;
};
}; The overlay would target one of the fpga-area's and contain the firmware-name and children.
In the case of full reconfiguration, there would not be any fpga-areas. The overlay would target the fpga-bus.
Quoted 13 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 360
Quoted 11 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+ compatible = "fpga-area"; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x10010 0xff210010 0x10>; + + firmware-name = "fit_pr_v1.rbf"; + partial-reconfig; + + gpio@100010010 {gpio@10010
OK
Quoted 12 lines
Quoted 11 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +10
-0+ compatible = "altr,pio-1.0"; + reg = <0x10010 0x10>; + altr,ngpio = <4>; + #gpio-cells = <0x2>; + gpio-controller; + }; + }; + }; + }; +};
Re: [PATCH v15 1/6] fpga: add bindings document for fpga area and fpga bus
Hi,
Quoted 21 lines · atull
Quoted 9 lines
I think I said this before, but you should not need simple-bus. Having it is wrong if the bus requires some configuration before enumerating the child nodes. The way you have it, the bridge driver could probe before the FPGA manager or vice-versa. I'm guessing one way will work and the other will not, and you are getting lucky. You should also test will the overlay applied before boot (i.e. single dtb with all areas populated). The simple rule is does the node (containing simple-bus) require configuration for child nodes to be accessed? If yes, you can't use simple-bus.
Yes you did say that before. Thanks for the explanation here, it clarifies a lot. I'll work on something that implements this without relying on luck and simple-busses.
Quoted 6 lines
Part of your problem is you may need a custom match table. Using
of_default_bus_match_tablewill only match the immediate child nodes of the starting node. Alternatively, you need to make the bridge node the starting node.
Quoted 3 lines
Not sure what you ment here, maybe you mean leaving out the fpga-bus? I'm using fpga-bus to bring the specific manager and bridges together needed to handle reprogramming cycles on a specific FPGA.
While I see the grouping argument I don't see binding wise why the manager needs to move into the bus. If each area specifies the bridges by handle, would that make more sense?
Quoted 47 lines
I can see reasons for having the fpga manager and also the bridges specified by phandle within a fpga-bus. So an fpga-bus will add the following propertities:
fpga-mgr = <fpgamgr0>; fpga-bridges = <bridge0>, <bridge1>;Quoted 9 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 149
Quoted 8 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +7
-0+ compatible = "altr,socfpga-fpga-mgr"; + reg = <0xff706000 0x1000 + 0xffb90000 0x1000>; + interrupts = <0 175 4>; + }; + + bridge@0 {Quoted 4 lines
Same here. Doesn't this bridge have some associated address range.
Essentially, the hierarchy from child devices up to the root should reflect the address decoding at each step.
Yes
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +14
-0+ compatible = "altr,socfpga-lwhps2fpga-bridge", + "simple-bus"; + resets = <&rst LWHPS2FPGA_RESET>; + reset-names = "lwhps2fpga"; + clocks = <&l4_main_clk>; + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + }; + + bridge@1 { + compatible = "altr,socfpga-hps2fpga-bridge"; + resets = <&rst HPS2FPGA_RESET>; + reset-names = "hps2fpga";Quoted 8 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt line 167
Quoted 4 lines
Documentation/devicetree/bindings/fpga/altera-fpga-bus-fpga-area.txt new file +4
-0+ clocks = <&l4_main_clk>; + }; + }; +How do you not have a bridge? There has to be something preventing access. Do you really mean the bridge and fpga-mgr blocks are combined into 1?
Quoted 4 lines
In the Xilinx case, the manager and bridge are still two hardware blocks but handled together by the manager driver. I didn't want to make Moritz write a FPGA Bridge when he already had code that handled his hardware bridges when he told his manager to do a write cycle.
If we all feel that as a good abstraction bridges are necessary, I can add that. They're basically level shifters that you turn on and off, there's nothing smart beyond that. If you disable the bridge and try to access stuff it just doesn't work.
Quoted 9 lines
This could be called fpga-area or fpga-region. More on that below.
Quoted 2 lines
Are the number of areas software configurable? If not, then the areas should be part of the base DT rather than the overlay.
The number of areas is set by the FPGA image that creates the areas. A base FPGA image could be loaded by the bootloader or by the OS with a set number of area slots available.
Not a big fan of this idea. See below. Somehow the info needs. That seems like an unnatural abstraction for an FPGA. See below:
Quoted 13 lines
So this could be done differently, divided into something where the areas (some call them "regions") are created in the live DT when the base FPGA image is loaded. Then the overlays would have something called 'personas' that plug into them. The areas would contain the information of which bridges to control and which fpga manager. Maybe this heirarchy (indexes are probably screwed up below).
Below, the fpga manager and hardware fpga bridges are specified outside the fpga bus and are referred to by phandles. Leaving out ranges, cells for brevity.
Live tree (after base FPGA image is loaded):
Quoted 15 lines
fpga-bus@0 {
compatible = "fpga-bus";
fpga-mgr = <fpgamgr@something>;
fpga-bridges = <..>, <..>;
fpga-area@0 {
compatible = "fpga-area";
bridges = <bridge@>;
};
fpga-area@... {
compatible = "fpga-area";
bridges = <bridge@...>;
};
};Where would we get this info from, though? There would have to be a first overlay to update the live tree, I suppose. Or anything that updates the live tree based on the non-inspectable bitstream / firmware.
How would the above make the connection between the address hierarchy i.e. fpga-area and bus the FPGA logic is child of. In the same image one area could be
connected via ... GMII and MDIO while another one is connected via AXI4 (mmio), SPI or I2C.
I checked on socfpga you can also (as well as zynq) implement the e.g. sgmii part
of a gigabit ethernet connection to an sfp connector in the FPGA. In that case the address hierarchy would be (in my opinion) an fpga-area as a child node of
your gigabit mac containing the phy.
Tell me if I'm crazy. Communication is hard :) Maybe I'm trying to solve, too many
issues at the same time. And we should tackle this separately using some sort of connector
mapping as Rob suggested in one of the last mails.
Quoted 5 lines
The overlay would target one of the fpga-area's and contain the firmware-name and children.
In the case of full reconfiguration, there would not be any fpga-areas. The overlay would target the fpga-bus.
Or a single area for consistency reasons? Full reconfiguration is just a special case of partial reconfiguration,
right?
Cheers,
Moritz
PATCH v15 2/6 add sysfs document for fpga bridge class
In reply to [email protected]From: Alan Tull <[email protected]>
Add documentation for new FPGA bridge class's sysfs interface.
Re: [PATCH v15 2/6] add sysfs document for fpga bridge class
Quoted 5 lines · <[email protected]> writes:
From: Alan Tull <[email protected]>
Add documentation for new FPGA bridge class's sysfs interface.
Signed-off-by Alan Tull <[email protected]>
I don't see a patch in this email.
Signature · 1 line
Måns Rullgård
Re: [PATCH v15 2/6] add sysfs document for fpga bridge class
Quoted 1 line · Måns Rullgård
I don't see a patch in this email.
So it's not just me :-)
Cheers,
Moritz
Re: [PATCH v15 2/6] add sysfs document for fpga bridge class
In reply to [email protected]Quoted 5 lines · On Wed, 20 Jan 2016, [email protected]…
From: Alan Tull <[email protected]>
Add documentation for new FPGA bridge class's sysfs interface.
Signed-off-by Alan Tull <[email protected]>
I've received two emails that there was no patch in this email. The copy I received has 11 lines of changes, adding one file Documentation/ABI/testing/sysfs-class-fpga-bridge
Alan
Quoted 28 lines
--
v15: Document added in v15 of patch set--- Documentation/ABI/testing/sysfs-class-fpga-bridge | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-fpga-bridgeDocumentation/ABI/testing/sysfs-class-fpga-bridge new file +11
-0@@ -0,0 +1,11 @@ +What: /sys/class/fpga_bridge/<bridge>/name +Date: January 2016 +KernelVersion: 4.5 +Contact: Alan Tull <[email protected]> +Description: Name of low level FPGA bridge driver. + +What: /sys/class/fpga_bridge/<bridge>/state +Date: January 2016 +KernelVersion: 4.5 +Contact: Alan Tull <[email protected]> +Description: Show bridge state as "enabled" or "disabled"Signature · 1 line
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v15 3/6 ARM: socfpga: add bindings document for fpga bridge drivers
In reply to [email protected]From: Alan Tull <[email protected]>
Add bindings documentation for Altera SOCFPGA bridges:
* fpga2sdram
* fpga2hps
* hps2fpga
* lwhps2fpga
---
v2: separate into 2 documents for the 2 drivers v12: bump version to line up with simple-fpga-bus version
remove Linux specific notes such as references to sysfs move non-DT specific documentation elsewhere
remove bindings that would have been used to pass configuration clean up formatting
v13: Remove 'label' property
Change property from init-val to bridge-enable
Fix email address
v14: Add resets
Change order of bridges to put lw bridge (controlling bridge) first
v15: No change in this patch for v15 of this patch set
--- .../bindings/fpga/altera-fpga2sdram-bridge.txt | 15 +++++++ .../bindings/fpga/altera-hps2fpga-bridge.txt | 43 ++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/altera-fpga2sdram-bridge.txt create mode 100644 Documentation/devicetree/bindings/fpga/altera-hps2fpga-bridge.txt
Documentation/devicetree/bindings/fpga/altera-fpga2sdram-bridge.txt new file +15 -0
@@ -0,0 +1,15 @@ +Altera FPGA To SDRAM Bridge Driver + +Required properties: +- compatible : Should contain "altr,socfpga-fpga2sdram-bridge" + +Optional properties: +- bridge-enable : 0 if driver should disable bridge at startup + 1 if driver should enable bridge at startup + Default is to leave bridge in current state. + +Example: + fpga2sdram_br: fpgabridge@3 { + compatible = "altr,socfpga-fpga2sdram-bridge"; + bridge-enable = <0>; + };
Documentation/devicetree/bindings/fpga/altera-hps2fpga-bridge.txt new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v15 4/6 fpga: add fpga bridge framework
In reply to [email protected]From: Alan Tull <[email protected]>
This framework adds API functions for enabling/
disabling FPGA bridges under kernel control.
This allows the Linux kernel to disable FPGA bridges during FPGA reprogramming and to enable FPGA bridges when FPGA reprogramming is done. This framework is be manufacturer-agnostic, allowing it to be used in interfaces that use the FPGA Manager Framework to reprogram FPGA's.
The functions are:
* of_fpga_bridge_get
* fpga_bridge_put
Get/put an exclusive reference to a FPGA bridge.
* fpga_bridge_enable
* fpga_bridge_disable
Enable/Disable traffic through a bridge.
* fpga_bridge_register
* fpga_bridge_unregister
Register/unregister a device-specific low level FPGA Bridge driver.
Get an exclusive reference to a bridge and add it to a list:
* fpga_bridge_get_to_list
To enable/disable/put a set of bridges that are on a list:
* fpga_bridges_enable
* fpga_bridges_disable
* fpga_bridges_put
---
v2: Minor cleanup v12: Bump version to line up with simple fpga bus
Remove sysfs
Improve get/put functions, get the low level driver too. Clean up class implementation
Add kernel doc documentation
Rename (un)register_fpga_bridge -> fpga_bridge_(un)register
v13: Add inlined empty functions for if not CONFIG_FPGA_BRIDGE
Clean up debugging
Remove unneeded #include in .h
Remove unnecessary prints
Remove 'label' DT binding.
Document the mutex
v14: Allow bridges with no ops
*const* struct fpga_bridge_ops
Add functions to git/put/enable/disable list of bridges Add list node to struct fpga_bridge
Do of_node_get/put in of_fpga_bridge_get()
Add r/o attributes: name and state
v15: No change in this patch for v15 of this patch set
--- drivers/fpga/Kconfig | 7 + drivers/fpga/Makefile | 3 + drivers/fpga/fpga-bridge.c | 388 ++++++++++++++++++++++++++++++++++++++ include/linux/fpga/fpga-bridge.h | 56 ++++++ 4 files changed, 454 insertions(+) create mode 100644 drivers/fpga/fpga-bridge.c create mode 100644 include/linux/fpga/fpga-bridge.h
drivers/fpga/Kconfig +7 -0
@@ -24,6 +24,13 @@ config FPGA_MGR_ZYNQ_FPGA help FPGA manager driver support for Xilinx Zynq FPGAs. +config FPGA_BRIDGE + bool "FPGA Bridge Framework" + depends on OF + help + Say Y here if you want to support bridges connected between host + processors and FPGAs or between FPGAs. + endif # FPGA endmenu
drivers/fpga/Makefile +3 -0
@@ -8,3 +8,6 @@ obj-$(CONFIG_FPGA) += fpga-mgr.o # FPGA Manager Drivers obj-$(CONFIG_FPGA_MGR_SOCFPGA) += socfpga.o obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o + +# FPGA Bridge Drivers +obj-$(CONFIG_FPGA_BRIDGE) += fpga-bridge.o
drivers/fpga/fpga-bridge.c new file +388 -0
388 lines not on this page · raw message
include/linux/fpga/fpga-bridge.h new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v15 5/6 fpga: fpga-area and fpga-bus: device tree control for FPGA
In reply to [email protected]From: Alan Tull <[email protected]>
FPGA Area and FPGA Bus support programming FPGA under control of the Device Tree.
A FPGA Bus contains the devices necessary for programming an FPGA.
When a Device Tree Overlay containing a FPGA Area is applied, the FPGA Area will be probed and will:
* check to see if there is an image to program to a FPGA
* get references to the FPGA manager and bridges if any
* disable FPGA bridges to prevent spurious data on busses
* reprogram the FPGA
* enable the specified FPGA bridges
* populate the child devices
Removing the Device Tree Overlay is also supported.
This supports fpga use where hardware blocks on a fpga will need drivers.
---
v9: initial version (this patch added during rest of patchset's v9) v10: request deferral if fpga mgr or bridges not available yet
cleanup as fpga manager core goes into the real kernel Don't assume bridges are disabled before programming FPGA Don't hang onto reference for fpga manager
Move to staging/simple-fpga-bus
v11: No change in this patch for v11 of the patch set
v12: Moved out of staging.
Use fpga bridges framework.
v13: If no bridges are specified, assume we don't need any.
Clean up debug messages
Some dev_info -> dev_dbg
Remove unneeded #include
Fix size of array of pointers
Don't need to specify .owner
Use common binding: firmware-name
v14: OK it's not a simple bus. Call it "FPGA Area"
Remove bindings that specify FPGA manager and FPGA bridges Use parent FPGA bridge and bridges that are its peers Use ancestor FPGA Manager
v15: Add altr,fpga-bus implementation
Change compatible string "fpga-area" -> "altr,fpga-area" --- drivers/fpga/Kconfig | 7 + drivers/fpga/Makefile | 3 + drivers/fpga/fpga-area.c | 352 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 362 insertions(+) create mode 100644 drivers/fpga/fpga-area.c
drivers/fpga/Kconfig +7 -0
@@ -31,6 +31,13 @@ config FPGA_BRIDGE Say Y here if you want to support bridges connected between host processors and FPGAs or between FPGAs. +config FPGA_AREA + bool "Device Tree Based FPGA Reprogramming" + depends on FPGA_BRIDGE + help + Enable FPGA Area which supports programming FPGAs under control of + Device Tree. + endif # FPGA endmenu
drivers/fpga/Makefile +3 -0
@@ -11,3 +11,6 @@ obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o # FPGA Bridge Drivers obj-$(CONFIG_FPGA_BRIDGE) += fpga-bridge.o + +# High Level Interfaces +obj-$(CONFIG_FPGA_AREA) += fpga-area.o
drivers/fpga/fpga-area.c new file +352 -0
352 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH v15 5/6] fpga: fpga-area and fpga-bus: device tree control for FPGA
Hi Alan,
minor nits inline:
Quoted 2 lines · On Wed, Jan 20, 2016 at 8:24 PM, <[email protected]> wrote:
v15: Add altr,fpga-bus implementation
Change compatible string "fpga-area" -> "altr,fpga-area"
Doesn't look that way down there. Or am I reading the code wrong?
drivers/fpga/fpga-area.c line 334
Quoted 2 lines
drivers/fpga/fpga-area.c new file +2
-0+static const struct of_device_id fpga_area_of_match[] = { + { .compatible ="fpga-area" , },
I'm fine with keeping it as fpga-area, this isn't altera specific imho
Cheers,
Moritz
Re: [PATCH v15 5/6] fpga: fpga-area and fpga-bus: device tree control for FPGA
Quoted 10 lines · Moritz Fischer
Hi Alan,
minor nits inline:
Quoted 2 lines · On Wed, Jan 20, 2016 at 8:24 PM, <[email protected]> wrote:
v15: Add altr,fpga-bus implementation
Change compatible string "fpga-area" -> "altr,fpga-area"Doesn't look that way down there. Or am I reading the code wrong?
Hi Moritz,
Yes, I left that out accidentally. But hopefully we won't have pushback around this issue and I can leave it out permanently and also change altr,fpga-bus to fpga-bus.
Alan
Quoted 10 lines
drivers/fpga/fpga-area.c line 334
Quoted 3 lines
drivers/fpga/fpga-area.c new file +2
-0+static const struct of_device_id fpga_area_of_match[] = { + { .compatible ="fpga-area" , },I'm fine with keeping it as fpga-area, this isn't altera specific imho
Cheers,
Moritz
Re: [PATCH v15 5/6] fpga: fpga-area and fpga-bus: device tree control for FPGA
In reply to [email protected]Alan,
Quoted 13 lines · On Wed, Jan 20, 2016 at 8:24 PM, <[email protected]> wrote:
drivers/fpga/fpga-area.c new file +13
-0+static int fpga_area_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +struct fpga_area *area; +int ret; + + area =devm_kzalloc (dev,sizeof (*area),GFP_KERNEL ); +if (!area) +return -ENOMEM ; + +INIT_LIST_HEAD (&area->bridge_list); +
drivers/fpga/fpga-area.c line 258
Quoted 10 lines
drivers/fpga/fpga-area.c new file +10
-0+ ret =fpga_bridge_register (dev,"FPGA Area" ,NULL , area); +if (ret) +return ret; + area->br =dev_get_drvdata (dev); + +if (of_property_read_string (np,"firmware-name" , + &area->firmware_name)) { +of_platform_populate (np, of_default_bus_match_table,NULL , dev); +return 0 ; + }
This is the use case where the bootloader loaded the fpga, and you just want to populate
the devices in the fabric, right?
drivers/fpga/fpga-area.c line 267
Quoted 8 lines
drivers/fpga/fpga-area.c new file +8
-0+if (of_property_read_bool (np,"partial-reconfig" )) + area->flags |=FPGA_MGR_PARTIAL_RECONFIG ; + + ret =fpga_area_get_bus (area); +if (ret) { +dev_dbg (dev,"Should be child of a FPGA Bus" ); + goto err_unreg; + }
Looking at socfpga.dtsi, would that mean that the fpgamgr0 node would need to become a subnode of fpgabus@0 at the same place?
i.e. /soc/fpgamgr@ff706000 -> /soc/fpgabus@0/fpgamgr@ff706000
and the ranges property would be used to translate to the fpga memory mapped space?
I know we're going back and forth on this. I think Rob brought up a similar question:
"Does the bus really go thru the fpgamgr and then the bridge as this implies? Or fpgamgr is a sideband controller?"
To which I think the answer is 'sideband' controller, yet with the new bindings it looks like
the bus goes through the fpgamgr.
Cheers,
Moritz
Re: [PATCH v15 5/6] fpga: fpga-area and fpga-bus: device tree control for FPGA
Quoted 23 lines · Moritz Fischer
Alan,
Quoted 19 lines · On Wed, Jan 20, 2016 at 8:24 PM, <[email protected]> wrote:
drivers/fpga/fpga-area.c new file +19
-0+static int fpga_area_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +struct fpga_area *area; +int ret; + + area =devm_kzalloc (dev,sizeof (*area),GFP_KERNEL ); +if (!area) +return -ENOMEM ; + +INIT_LIST_HEAD (&area->bridge_list); + + ret =fpga_bridge_register (dev,"FPGA Area" ,NULL , area); +if (ret) +return ret; + area->br =dev_get_drvdata (dev); + + if (of_property_read_string(np, "firmware-name",
Quoted 8 lines
drivers/fpga/fpga-area.c line 258
Quoted 4 lines
drivers/fpga/fpga-area.c new file +4
-0+ &area->firmware_name)) { +of_platform_populate (np, of_default_bus_match_table,NULL , dev); +return 0 ; + }This is the use case where the bootloader loaded the fpga, and you just want to populate
the devices in the fabric, right?
Hi Moritz,
Yes
Quoted 18 lines
drivers/fpga/fpga-area.c line 267
Quoted 9 lines
drivers/fpga/fpga-area.c new file +8
-0+if (of_property_read_bool (np,"partial-reconfig" )) + area->flags |=FPGA_MGR_PARTIAL_RECONFIG ; + + ret =fpga_area_get_bus (area); +if (ret) { +dev_dbg (dev,"Should be child of a FPGA Bus" ); + goto err_unreg; + }Looking at
socfpga.dtsi, would that mean that the fpgamgr0 node would need to become a subnode of fpgabus@0 at the same place?i.e. /soc/fpgamgr@ff706000 -> /soc/fpgabus@0/fpgamgr@ff706000
and the ranges property would be used to translate to the fpga memory mapped space?
Quoted 8 lines
I know we're going back and forth on this. I think Rob brought up a similar question:
"Does the bus really go thru the fpgamgr and then the bridge as this implies? Or fpgamgr is a sideband controller?"To which I think the answer is 'sideband' controller, yet with the new bindings it looks like
the bus goes through the fpgamgr.
Yeah, let's get this right. First, let's be clear on the reason for FPGA Bus to exist. There may be >1 FPGA in a system. I want the FPGA Bus bring together the bridges and manager that are associated with a certain FPGA. This allows the system designer to specify which FPGA is getting programmed with which image/hardware. So at minimum, we need some way of associating a FPGA Bus with a FPGA Manager.
As far as the target path is concerned, in the case of no bridges, we could have the overlay target the FPGA Bus instead of the FPGA Manager. That may be more logical. This would just be a documentation change; I think fpga-area.c will work OK if you specify the FPGA bus as your target (the manager still has to be a child of the bus so the bus knows what manager to use).
Alan
Quoted 5 lines
Cheers,
Moritz
Re: [PATCH v15 5/6] fpga: fpga-area and fpga-bus: device tree control for FPGA
Quoted 65 lines · atull
Quoted 23 lines · Moritz Fischer
Alan,
Quoted 19 lines · On Wed, Jan 20, 2016 at 8:24 PM, <[email protected]> wrote:
drivers/fpga/fpga-area.c new file +19
-0+static int fpga_area_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +struct fpga_area *area; +int ret; + + area =devm_kzalloc (dev,sizeof (*area),GFP_KERNEL ); +if (!area) +return -ENOMEM ; + +INIT_LIST_HEAD (&area->bridge_list); + + ret =fpga_bridge_register (dev,"FPGA Area" ,NULL , area); +if (ret) +return ret; + area->br =dev_get_drvdata (dev); + + if (of_property_read_string(np, "firmware-name",Quoted 8 lines
drivers/fpga/fpga-area.c line 258
Quoted 4 lines
drivers/fpga/fpga-area.c new file +4
-0+ &area->firmware_name)) { +of_platform_populate (np, of_default_bus_match_table,NULL , dev); +return 0 ; + }This is the use case where the bootloader loaded the fpga, and you just want to populate
the devices in the fabric, right?Hi Moritz,
Yes
Quoted 18 lines
drivers/fpga/fpga-area.c line 267
Quoted 9 lines
drivers/fpga/fpga-area.c new file +8
-0+if (of_property_read_bool (np,"partial-reconfig" )) + area->flags |=FPGA_MGR_PARTIAL_RECONFIG ; + + ret =fpga_area_get_bus (area); +if (ret) { +dev_dbg (dev,"Should be child of a FPGA Bus" ); + goto err_unreg; + }Looking at
socfpga.dtsi, would that mean that the fpgamgr0 node would need to become a subnode of fpgabus@0 at the same place?i.e. /soc/fpgamgr@ff706000 -> /soc/fpgabus@0/fpgamgr@ff706000
and the ranges property would be used to translate to the fpga memory mapped space?
Quoted 8 lines
I know we're going back and forth on this. I think Rob brought up a similar question:
"Does the bus really go thru the fpgamgr and then the bridge as this implies? Or fpgamgr is a sideband controller?"To which I think the answer is 'sideband' controller, yet with the new bindings it looks like
the bus goes through the fpgamgr.
Quoted 6 lines
Yeah, let's get this right. First, let's be clear on the reason for FPGA Bus to exist. There may be >1 FPGA in a system. I want the FPGA Bus bring together the bridges and manager that are associated with a certain FPGA. This allows the system designer to specify which FPGA is getting programmed with which image/hardware. So at minimum, we need some way of associating a FPGA Bus with a FPGA Manager.
I see your argument for the FPGA bus. I agree that we need to distinguish different FPGAs,
and we need a way to associate an area with a manager (and potentially bridges).
Quoted 5 lines
As far as the target path is concerned, in the case of no bridges, we could have the overlay target the FPGA Bus instead of the FPGA Manager. That may be more logical. This would just be a documentation change; I think
fpga-area.cwill work OK if you specify the FPGA bus as your target (the manager still has to be a child of the bus so the bus knows what manager to use).
Could the bus not just use a phandle to the manager? Or the area a phandle to the bus?
Like that one could have potentially disjunct groups. Say I have a SPI device that is in an FPGA area.
With our current system, I'd have a FPGA Manager that needs to be a child of the bus as child of the SPI controller
with the memory addresses being addresses on the SOC's memory bus:
spi_ctrl@deadbeef {
fpga_bus@0 {
fpgamgr@f8007000 {
mgr regs etc...
... and now the SPI slaves ...
slave@42 {
};
};
};
};(or something like that, maybe I'm confused)
with my proposed one it looks like it would work with any bus (maybe then areas would have to register with
the manager or something like that...)
spi_ctrl@deadbeef {
fpga_area {
fpga-mgr = <&fpgamgr0>;
slave0@42 {
};
};
};I keep bringing up SPI because it's another bus with addresses, not because I think we should particularly
optimize for that use case ;-)
Cheers,
Moritz
PS: Feel free to 'break' my suggestion above. It's just an idea
Re: [PATCH v15 5/6] fpga: fpga-area and fpga-bus: device tree control for FPGA
Quoted 35 lines · Moritz Fischer
Quoted 34 lines · atull
Quoted 31 lines · Moritz Fischer
Alan,
Quoted 13 lines · On Wed, Jan 20, 2016 at 8:24 PM, <[email protected]> wrote:
drivers/fpga/fpga-area.c new file +13
-0+static int fpga_area_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +struct fpga_area *area; +int ret; + + area =devm_kzalloc (dev,sizeof (*area),GFP_KERNEL ); +if (!area) +return -ENOMEM ; + +INIT_LIST_HEAD (&area->bridge_list); +drivers/fpga/fpga-area.c line 258
Quoted 10 lines
drivers/fpga/fpga-area.c new file +10
-0+ ret =fpga_bridge_register (dev,"FPGA Area" ,NULL , area); +if (ret) +return ret; + area->br =dev_get_drvdata (dev); + +if (of_property_read_string (np,"firmware-name" , + &area->firmware_name)) { +of_platform_populate (np, of_default_bus_match_table,NULL , dev); +return 0 ; + }This is the use case where the bootloader loaded the fpga, and you just want to populate
the devices in the fabric, right?
Quoted 3 lines
Quoted 3 lines
Hi Moritz,
Yes
That is very strange logic. It should be fine to just call of_platform_populate unconditionally. If there are no children of np, then it will be a nop.
Quoted 37 lines
Quoted 26 lines
Quoted 17 lines
drivers/fpga/fpga-area.c line 267
Quoted 8 lines
drivers/fpga/fpga-area.c new file +8
-0+if (of_property_read_bool (np,"partial-reconfig" )) + area->flags |=FPGA_MGR_PARTIAL_RECONFIG ; + + ret =fpga_area_get_bus (area); +if (ret) { +dev_dbg (dev,"Should be child of a FPGA Bus" ); + goto err_unreg; + }Looking at
socfpga.dtsi, would that mean that the fpgamgr0 node would need to become a subnode of fpgabus@0 at the same place?i.e. /soc/fpgamgr@ff706000 -> /soc/fpgabus@0/fpgamgr@ff706000
and the ranges property would be used to translate to the fpga memory mapped space?
Quoted 8 lines
I know we're going back and forth on this. I think Rob brought up a similar question:
"Does the bus really go thru the fpgamgr and then the bridge as this implies? Or fpgamgr is a sideband controller?"To which I think the answer is 'sideband' controller, yet with the new bindings it looks like
the bus goes through the fpgamgr.Quoted 6 lines
Yeah, let's get this right. First, let's be clear on the reason for FPGA Bus to exist. There may be >1 FPGA in a system. I want the FPGA Bus bring together the bridges and manager that are associated with a certain FPGA. This allows the system designer to specify which FPGA is getting programmed with which image/hardware. So at minimum, we need some way of associating a FPGA Bus with a FPGA Manager.
I see your argument for the FPGA bus. I agree that we need to distinguish different FPGAs,
and we need a way to associate an area with a manager (and potentially bridges).
Quoted 8 lines
Quoted 5 lines
As far as the target path is concerned, in the case of no bridges, we could have the overlay target the FPGA Bus instead of the FPGA Manager. That may be more logical. This would just be a documentation change; I think
fpga-area.cwill work OK if you specify the FPGA bus as your target (the manager still has to be a child of the bus so the bus knows what manager to use).Could the bus not just use a phandle to the manager? Or the area a phandle to the bus?
That may be better as it would avoid the virtual fpga-bus which is a bit questionable. I'm okay with allowing it, but will happily take any examples where it doesn't work. However, I'm not sure this case is one.
Quoted 6 lines
Like that one could have potentially disjunct groups. Say I have a SPI device that is in an FPGA area.
With our current system, I'd have a FPGA Manager that needs to be a child of the bus as child of the SPI controller
with the memory addresses being addresses on the SOC's memory bus:
Quoted 10 lines
spi_ctrl@deadbeef {
fpga_bus@0 {
fpgamgr@f8007000 {
mgr regs etc...
... and now the SPI slaves ...
slave@42 {
};
};
};
};I think Alan's assumption is there's always a memory mapped control interface and the DT hierarchy follows that. While I see you could have other interfaces like SPI, that would not be the control interface related to FPGA programming AIUI. You could also have GPIOs, I2C, or any other bus/interface we describe in DT in theory.
How to deal with additional connections like this is similar to overlays for daughterboards (e.g. capes, hats, shields) where the need for mapping slave devices on a connector to host controllers/buses which can vary. In that case, you don't want to have to create a different overlay for every host board just to change the parent devices of each child. If there is a SPI connection to FPGA (or area), then we need a way to map the host SPI bus to the FPGA. In this example, the overlay should only say "slave@42" is connected to the spi bus of the FPGA area and it would not have direct reference to "spi_ctrl@deadbeef." There's some ideas around how to support these usecases probably involving a connector node with mappings of connector i/o's to host i/o's (paging Pantelis, where's your proposal?). I think the same would work here, so I would suggest we not try to address it immediately other than decide the requirements here are similar enough to what is needed for connectors.
Rob
Re: [PATCH v15 5/6] fpga: fpga-area and fpga-bus: device tree control for FPGA
Quoted 37 lines · Rob Herring
Quoted 35 lines · Moritz Fischer
Quoted 34 lines · atull
Quoted 31 lines · Moritz Fischer
Alan,
Quoted 13 lines · On Wed, Jan 20, 2016 at 8:24 PM, <[email protected]> wrote:
drivers/fpga/fpga-area.c new file +13
-0+static int fpga_area_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +struct fpga_area *area; +int ret; + + area =devm_kzalloc (dev,sizeof (*area),GFP_KERNEL ); +if (!area) +return -ENOMEM ; + +INIT_LIST_HEAD (&area->bridge_list); +drivers/fpga/fpga-area.c line 258
Quoted 10 lines
drivers/fpga/fpga-area.c new file +10
-0+ ret =fpga_bridge_register (dev,"FPGA Area" ,NULL , area); +if (ret) +return ret; + area->br =dev_get_drvdata (dev); + +if (of_property_read_string (np,"firmware-name" , + &area->firmware_name)) { +of_platform_populate (np, of_default_bus_match_table,NULL , dev); +return 0 ; + }This is the use case where the bootloader loaded the fpga, and you just want to populate
the devices in the fabric, right?
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Hi Moritz,
Yes
That is very strange logic. It should be fine to just call
of_platform_populateunconditionally. If there are no children of np, then it will be a nop.
That's what it is doing. It's coded this way to reduce indentation. If there is no FPGA image to load, call of_platform_populate() and return. Otherwise do a bunch of steps to load the FPGA image and handle the bridges, then call of_platform_populate() and return. If there's no children, no problem.
Quoted 44 lines
Quoted 44 lines
Quoted 27 lines
Quoted 18 lines
drivers/fpga/fpga-area.c line 267
Quoted 9 lines
drivers/fpga/fpga-area.c new file +8
-0+if (of_property_read_bool (np,"partial-reconfig" )) + area->flags |=FPGA_MGR_PARTIAL_RECONFIG ; + + ret =fpga_area_get_bus (area); +if (ret) { +dev_dbg (dev,"Should be child of a FPGA Bus" ); + goto err_unreg; + }Looking at
socfpga.dtsi, would that mean that the fpgamgr0 node would need to become a subnode of fpgabus@0 at the same place?i.e. /soc/fpgamgr@ff706000 -> /soc/fpgabus@0/fpgamgr@ff706000
and the ranges property would be used to translate to the fpga memory mapped space?
Quoted 8 lines
I know we're going back and forth on this. I think Rob brought up a similar question:
"Does the bus really go thru the fpgamgr and then the bridge as this implies? Or fpgamgr is a sideband controller?"To which I think the answer is 'sideband' controller, yet with the new bindings it looks like
the bus goes through the fpgamgr.Quoted 6 lines
Yeah, let's get this right. First, let's be clear on the reason for FPGA Bus to exist. There may be >1 FPGA in a system. I want the FPGA Bus bring together the bridges and manager that are associated with a certain FPGA. This allows the system designer to specify which FPGA is getting programmed with which image/hardware. So at minimum, we need some way of associating a FPGA Bus with a FPGA Manager.
I see your argument for the FPGA bus. I agree that we need to distinguish different FPGAs,
and we need a way to associate an area with a manager (and potentially bridges).Quoted 5 lines
As far as the target path is concerned, in the case of no bridges, we could have the overlay target the FPGA Bus instead of the FPGA Manager. That may be more logical. This would just be a documentation change; I think
fpga-area.cwill work OK if you specify the FPGA bus as your target (the manager still has to be a child of the bus so the bus knows what manager to use).
Quoted 7 lines
Quoted 2 lines
Could the bus not just use a phandle to the manager? Or the area a phandle to the bus?
That may be better as it would avoid the virtual fpga-bus which is a bit questionable. I'm okay with allowing it, but will happily take any examples where it doesn't work. However, I'm not sure this case is one.
I have no problem with specifying FPGA manager with a phandle, seems like it will be better in some cases.
I'm proposing FPGA Bus to specify all the things (manager and bridges) that are needed to do a reprogramming cycle on a specific FPGA. The FPGA Bus may seem less necessary in Moritz' case where there are no FPGA Bridges in the DT.
I'll discuss this more on the other thread.
Quoted 42 lines
Quoted 7 lines
Like that one could have potentially disjunct groups. Say I have a SPI device that is in an FPGA area.
With our current system, I'd have a FPGA Manager that needs to be a child of the bus as child of the SPI controller
with the memory addresses being addresses on the SOC's memory bus:Quoted 10 lines
spi_ctrl@deadbeef { fpga_bus@0 { fpgamgr@f8007000 { mgr regs etc... ... and now the SPI slaves ... slave@42 { }; }; }; };I think Alan's assumption is there's always a memory mapped control interface and the DT hierarchy follows that. While I see you could have other interfaces like SPI, that would not be the control interface related to FPGA programming AIUI. You could also have GPIOs, I2C, or any other bus/interface we describe in DT in theory.
How to deal with additional connections like this is similar to overlays for daughterboards (e.g. capes, hats, shields) where the need for mapping slave devices on a connector to host controllers/buses which can vary. In that case, you don't want to have to create a different overlay for every host board just to change the parent devices of each child. If there is a SPI connection to FPGA (or area), then we need a way to map the host SPI bus to the FPGA. In this example, the overlay should only say "slave@42" is connected to the spi bus of the FPGA area and it would not have direct reference to "spi_ctrl@deadbeef." There's some ideas around how to support these usecases probably involving a connector node with mappings of connector i/o's to host i/o's (paging Pantelis, where's your proposal?). I think the same would work here, so I would suggest we not try to address it immediately other than decide the requirements here are similar enough to what is needed for connectors.
Rob
PATCH v15 6/6 ARM: socfpga: fpga bridge driver support
In reply to [email protected]From: Alan Tull <[email protected]>
Supports Altera SOCFPGA bridges:
* fpga2sdram
* fpga2hps
* hps2fpga
* lwhps2fpga
Allows enabling/disabling the bridges through the FPGA Bridge Framework API functions.
The fpga2sdram driver only supports enabling and disabling of the ports that been configured early on. This is due to a hardware limitation where the read, write, and command ports on the fpga2sdram bridge can only be reconfigured while there are no transactions to the sdram, i.e. when running out of OCRAM before the kernel boots.
Device tree property 'init-val' configures the driver to enable or disable the bridge during probe. If the property does not exist, the driver will leave the bridge in its current state.
---
v2: Use resets instead of directly writing reset registers v12: Bump version to align with simple-fpga-bus version
Get rid of the sysfs interface
fpga2sdram: get configuration stored in handoff register
v13: Remove unneeded WARN_ON
Change property from init-val to bridge-enable Checkpatch cleanup
Fix email address
v14: use module_platform_driver
remove unused struct field and some #defines don't really need exclamation points on error msgs *const* struct fpga_bridge_ops
v15: No change in this patch for v15 of this patch set
--- drivers/fpga/Kconfig | 7 ++ drivers/fpga/Makefile | 1 + drivers/fpga/altera-fpga2sdram.c | 174 +++++++++++++++++++++++++++++++ drivers/fpga/altera-hps2fpga.c | 213 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 395 insertions(+) create mode 100644 drivers/fpga/altera-fpga2sdram.c create mode 100644 drivers/fpga/altera-hps2fpga.c
drivers/fpga/Kconfig +7 -0
@@ -38,6 +38,13 @@ config FPGA_AREA Enable FPGA Area which supports programming FPGAs under control of Device Tree. +config SOCFPGA_FPGA_BRIDGE + bool "Altera SoCFPGA FPGA Bridges" + depends on ARCH_SOCFPGA && FPGA_BRIDGE + help + Say Y to enable drivers for FPGA bridges for Altera SOCFPGA + devices. + endif # FPGA endmenu
drivers/fpga/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o # FPGA Bridge Drivers obj-$(CONFIG_FPGA_BRIDGE) += fpga-bridge.o +obj-$(CONFIG_SOCFPGA_FPGA_BRIDGE) += altera-hps2fpga.o altera-fpga2sdram.o # High Level Interfaces obj-$(CONFIG_FPGA_AREA) += fpga-area.o
drivers/fpga/altera-fpga2sdram.c new file +174 -0
174 lines not on this page · raw message
drivers/fpga/altera-hps2fpga.c new file +213 -0
213 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Hi Alan,
Quoted 7 lines · On Wed, Jan 20, 2016 at 8:24 PM, <atull-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@publi…
From: Alan Tull <[email protected]>
For v15, I'm not using the FPGA Manager as the bus. I'm adding a FPGA Bus; the FPGA Manager and bridges go below it.
I've gotten enough feedback that my proposals are Altera specific that I am going with that and changing the bindings to include an 'altr,' prefix.
I hope this wasn't a misunderstanding of one of my earlier remarks. I think the fpga-area & fpga bus
parts do apply to to Xilinx FPGAs, too. I think for fpga-area and fpga-bus we could drop the 'altr' prefix.
Quoted 3 lines
I've combined the bindings document and the other
Documentation/fpga/document and done a rewrite there.
Looks great!
I'll test it on hardware and look at the patches individually,
Cheers,
Moritz
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Moritz Fischer
Hi Alan,
Quoted 5 lines · On Wed, Jan 20, 2016 at 8:24 PM, <[email protected]> wrote:
From: Alan Tull <[email protected]>
For v15, I'm not using the FPGA Manager as the bus. I'm adding a FPGA Bus; the FPGA Manager and bridges go below it.
Quoted 7 lines
Quoted 2 lines
I've gotten enough feedback that my proposals are Altera specific that I am going with that and changing the bindings to include an 'altr,' prefix.
I hope this wasn't a misunderstanding of one of my earlier remarks. I think the fpga-area & fpga bus
parts do apply to to Xilinx FPGAs, too. I think for fpga-area and fpga-bus we could drop the 'altr' prefix.
Yes, I would very much like to drop the altr prefix if we have general acceptance that this isn't all Altera specific. I'll need to rename altera-fpga-bus-fpga-area.txt to drop the 'altera-' prefix and clean up a little there.
If you want to send me a Xilinx example of usage for me to include in that document, that would be useful also. I think you might have sent me something a while ago, but I can't find it now.
Quoted 8 lines
Quoted 4 lines
I've combined the bindings document and the other
Documentation/fpga/document and done a rewrite there.Looks great!
I'll test it on hardware and look at the patches individually,
Thank you!
Quoted 5 lines
Cheers,
Moritz
Hi Alan,
Quoted 3 lines · atull
If you want to send me a Xilinx example of usage for me to include in that document, that would be useful also. I think you might have sent me something a while ago, but I can't find it now.
Will do. I'll clean up some of my examples with an in-tree driver and get back to you.
Having more examples never hurts.
Cheers,
Moritz