fpga area and fpga bridge framework
Subsystems (3)
v14 cover fpga area and fpga bridge framework
From: Alan Tull <[email protected]>
For v14 I'm dropping the concept of "simple-fpga-bus" for "fpga-area" with reworked bindings.
An FPGA Area describes a section of an FPGA including the FPGA image needed to program it and the hardware contained once it is programmed. The intent is to support Device Tree controlled programming of FPGA's.
Alan Tull (7):
fpga: add usage documentation for fpga area
fpga: add bindings document for fpga area
add sysfs document for fpga bridge class
ARM: socfpga: add bindings document for fpga bridge drivers
fpga: add fpga bridge framework
fpga: fpga-area: support device tree control for FPGA programming
ARM: socfpga: fpga bridge driver support
Documentation/ABI/testing/sysfs-class-fpga-bridge | 11 + .../bindings/fpga/altera-fpga2sdram-bridge.txt | 15 + .../bindings/fpga/altera-hps2fpga-bridge.txt | 43 +++ .../devicetree/bindings/fpga/fpga-area.txt | 70 ++++ Documentation/fpga/fpga-area.txt | 299 +++++++++++++++ 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 | 313 ++++++++++++++++ drivers/fpga/fpga-bridge.c | 388 ++++++++++++++++++++ include/linux/fpga/fpga-bridge.h | 56 +++ 12 files changed, 1610 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-fpga-bridge 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 Documentation/devicetree/bindings/fpga/fpga-area.txt create mode 100644 Documentation/fpga/fpga-area.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 v14 1/7 fpga: add usage documentation for fpga area
From: Alan Tull <[email protected]>
Add a document spelling out usage of the FPGA Area for reprogramming FPGA's under Device Tree control.
---
v9: Initial version of this patch in patchset v10: s/fpga/FPGA/g
improve formatting
some rewriting
move to staging/simple-fpga-bus
v11: No change in this patch for v11 of the patch set
v12: Moved out of staging
Small changes due to using FPGA bridge framework and not representing the bridges as resets.
v13: Fix some nits
v14: fpga-area instead of simple-fpga-bus
--- Documentation/fpga/fpga-area.txt | 299 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 Documentation/fpga/fpga-area.txt
Documentation/fpga/fpga-area.txt new file +299 -0
@@ -0,0 +1,299 @@ +FPGA Area + +Alan Tull 2015 + +Overview +======== + +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. + +Loading a Device Tree overlay which contains an FPGA Area will cause the +FPGA to be programmed and the children of the FPGA Area will get probed. + +There may be FPGA Bridges involved to prevent spurious data from going out onto +the processor bus during FPGA programming. If so, the FPGA Area will need to +disable and enable bridges that will only affect the child devices that are +below the FPGA Area. In the case of partial reconfiguration, bridges will +be required within the FPGA design such that the active sections of the +FPGA are on the bus while sections that are not programmed or being +reprogrammed at the moment are isolated. + +Removing the overlay will result in the child devices getting removed and the +bridges disabled. Note that in the case of partial reconfiguration the rest of +the FPGA continues to function as normal while this is happening. + +Below are more details on the structuring of the Device Tree for this. + +Terminology +=========== + +Full Reconfiguration + * The entire FPGA is reprogrammed. + +Partial Reconfiguration (PR) + * Part of the FPGA is reprogrammed while the rest of the FPGA is live and + active. Not all FPGA's support this. + +Associated Blocks +================= + +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 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 are not needed in implementations where the FPGA Manager + handles this. + +Device Tree +=========== + +For the purposes of this document, I'm dividing the Device Tree (DT) into two parts, +each with its own requirements. The two parts are: + * The live DT prior to the overlay being added + * The overlay containing an FPGA Area + +The live DT will contain: + * FPGA Manager + * FPGA Bridges as children of the FPGA Manager (optional, architecture specific) + +The live Device Tree must contain an 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 Manager. During full reconfiguration, the FPGA Area will disable +any bridges that are direct children of the manager during full reconfiguration +and will re-enable them afterwards. + +The insertion point in the live tree will also need the "simple-bus" +compatibility string to enable populating the child nodes for the overlay. +That includes the nodes for the FPGA Manager and controlling FPGA Bridges +as explained below. + +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. + +Supported use models +==================== + +Here's a list of the superset of supported use models. We may need to add +more. Some uses are specific to one FPGA or another. + + * No FPGA Bridges + In this case, the FPGA Manager which programs the FPGA also handles the + bridges and 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 DT before the overlay is applied will have an FPGA Manager. The + immediate children of the manager will be the FPGA Bridges that need to be + disabled during FPGA programming. + + The DT overlay will specify one of those bridges as the overlay target, + typically the bridge that allows memory mapped register access ("the + controlling bridge"). + + * Partial reconfiguration with bridges in the FPGA + In this case, the FPGA can have more than one section that will be + reprogrammed separately. Other sections may be active on the bus while FPGA + is being programmed. To manage this, FPGA Bridges 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. + +Controlling Bridge +================== + +It is possible that there are multiple FPGA Bridges connecting the processor +and FPGA. In a text based hierarchy, it is difficult to show this properly +so what we do is consider the bridge that handles register access to be +the controlling bridge. The overlay is targeted to be inserted under the +controlling bridge. Other bridges are on the same level of the device tree +as the controlling bridge, i.e. all are children of the FPGA Manager. The +ranges property handles mapping memory ranges through multiple bridges. + +Sequence +======== + +Load the DT overlay. One way to do that from user space is to use Pantelis +Antoniou's DT-Overlay configfs interface. In that case the sequence from +userspace is: + + $ mkdir /config/device-tree/overlays/1 + $ echo "some_overlay.dtb.o" > /config/device-tree/overlays/1/path + +This causes the FPGA Area to 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. + +Removing the overlay is done by: + + $ rmdir /config/device-tree/overlays/1 + +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 in, especially: + * FPGA Managers + * FPGA Bridges in some cases + * FPGA Areas and associated properties + * simple-bus + * ranges + * target-path + +Please note the "simple-bus" compatible string added for FPGA Managers and for +FPGA Bridges where the overlay is targeted for insertion. This is required for +populating the child nodes. + +Device Tree Example: Partial Reconfiguration with no Bridges +============================================================ + +Live Device Tree contains: + fpgamgr@0 { + 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@0"; /* 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@0x100010010 { + 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@0 { + 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@0/bridge@0"; /* controlling bridge */ + __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + area@0 { + compatible = "fpga-area"; + + #address-cells = <2>; + #size-cells = <1>; + /* Note that two ranges are mapped due to the + * two bridges. */ + ranges = <0 0x00000000 0xc0000000 0x00010000>, + <1 0x00020000 0xff220000 0x00000008>; + + firmware-name = "soc_system.rbf"; + + onchip_memory2_0: memory@000000000 { + device_type = "memory"; + compatible = "altr,onchipmem-15.1"; + reg = <0 0x00000000 0x00010000>; + }; + + jtag_uart: serial@0x100020000 { + compatible = "altr,juart-1.0"; + reg = <1 0x00020000 0x00000008>; + interrupt-parent = <&intc>; + interrupts = <0 42 4>; + clocks = <&osc2>; + }; + }; + }; + }; +}; +
Signature · 1 line
1.7.9.5
Rob Herring
maintainerRe: [PATCH v14 1/7] fpga: add usage documentation for fpga area
Quoted 4 lines · On Thu, Dec 10, 2015 at 05:37:03PM -0600, [email protected] wrote:
From: Alan Tull <[email protected]>
Add a document spelling out usage of the FPGA Area for reprogramming FPGA's under Device Tree control.
I'm not too sure about the split between this and the binding doc. This one clears up a bit after reading the binding doc first and most of this is about DT.
Quoted 153 lines
Signed-off-by Alan Tull <[email protected]>---
v9: Initial version of this patch in patchset v10: s/fpga/FPGA/gimprove formatting
some rewriting
move to staging/simple-fpga-bus
v11: No change in this patch for v11 of the patch set
v12: Moved out of staging
Small changes due to using FPGA bridge framework and not representing the bridges as resets.
v13: Fix some nits
v14: fpga-area instead of simple-fpga-bus--- Documentation/fpga/fpga-area.txt | 299 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 Documentation/fpga/fpga-area.txtDocumentation/fpga/fpga-area.txt new file +128
-0@@ -0,0 +1,299 @@ +FPGA Area + +Alan Tull 2015 + +Overview +======== + +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. + +Loading a Device Tree overlay which contains an FPGA Area will cause the +FPGA to be programmed and the children of the FPGA Area will get probed. + +There may be FPGA Bridges involved to prevent spurious data from going out onto +the processor bus during FPGA programming. If so, the FPGA Area will need to +disable and enable bridges that will only affect the child devices that are +below the FPGA Area. In the case of partial reconfiguration, bridges will +be required within the FPGA design such that the active sections of the +FPGA are on the bus while sections that are not programmed or being +reprogrammed at the moment are isolated. + +Removing the overlay will result in the child devices getting removed and the +bridges disabled. Note that in the case of partial reconfiguration the rest of +the FPGA continues to function as normal while this is happening. + +Below are more details on the structuring of the Device Tree for this. + +Terminology +=========== + +Full Reconfiguration + * The entire FPGA is reprogrammed. + +Partial Reconfiguration (PR) + * Part of the FPGA is reprogrammed while the rest of the FPGA is live and + active. Not all FPGA's support this. + +Associated Blocks +================= + +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 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 are not needed in implementations where the FPGA Manager + handles this. + +Device Tree +=========== + +For the purposes of this document, I'm dividing the Device Tree (DT) into two parts, +each with its own requirements. The two parts are: + * The live DT prior to the overlay being added + * The overlay containing an FPGA Area + +The live DT will contain: + * FPGA Manager + * FPGA Bridges as children of the FPGA Manager (optional, architecture specific) + +The live Device Tree must contain an 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 Manager. During full reconfiguration, the FPGA Area will disable +any bridges that are direct children of the manager during full reconfiguration +and will re-enable them afterwards. + +The insertion point in the live tree will also need the "simple-bus" +compatibility string to enable populating the child nodes for the overlay. +That includes the nodes for the FPGA Manager and controlling FPGA Bridges +as explained below. + +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. + +Supported use models +==================== + +Here's a list of the superset of supported use models. We may need to add +more. Some uses are specific to one FPGA or another. + + * No FPGA Bridges + In this case, the FPGA Manager which programs the FPGA also handles the + bridges and 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 DT before the overlay is applied will have an FPGA Manager. The + immediate children of the manager will be the FPGA Bridges that need to be + disabled during FPGA programming. + + The DT overlay will specify one of those bridges as the overlay target, + typically the bridge that allows memory mapped register access ("the + controlling bridge"). + + * Partial reconfiguration with bridges in the FPGA + In this case, the FPGA can have more than one section that will be + reprogrammed separately. Other sections may be active on the bus while FPGA + is being programmed. To manage this, FPGA Bridges 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. + +Controlling Bridge +================== + +It is possible that there are multiple FPGA Bridges connecting the processor +and FPGA. In a text based hierarchy, it is difficult to show this properly +so what we do is consider the bridge that handles register access to be +the controlling bridge. The overlay is targeted to be inserted under the
Documentation/fpga/fpga-area.txt line 138
Quoted 10 lines
Documentation/fpga/fpga-area.txt new file +10
-0+controlling bridge. Other bridges are on the same level of the device tree +as the controlling bridge, i.e. all are children of the FPGA Manager. The +ranges property handles mapping memory ranges through multiple bridges. + +Sequence +======== + +Load the DT overlay. One way to do that from user space is to use Pantelis +Antoniou's DT-Overlay configfs interface. In that case the sequence from +userspace is:
It will be a problem merging this series if you document things that are not upstream yet.
Quoted 27 lines
Documentation/fpga/fpga-area.txt new file +27
-0+ + $ mkdir /config/device-tree/overlays/1 + $ echo "some_overlay.dtb.o" > /config/device-tree/overlays/1/path + +This causes the FPGA Area to 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. + +Removing the overlay is done by: + + $ rmdir /config/device-tree/overlays/1 + +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 in, especially: + * FPGA Managers + * FPGA Bridges in some cases + * FPGA Areas and associated properties + * simple-bus + * ranges + * target-path
Documentation/fpga/fpga-area.txt line 175
Quoted 10 lines
Documentation/fpga/fpga-area.txt new file +10
-0+ +Please note the "simple-bus" compatible string added for FPGA Managers and for +FPGA Bridges where the overlay is targeted for insertion. This is required for +populating the child nodes. + +Device Tree Example: Partial Reconfiguration with no Bridges +============================================================ + +Live Device Tree contains: + fpgamgr@0 {
Unit address should be ffd03000 here.
Documentation/fpga/fpga-area.txt line 176
Quoted 1 line
Documentation/fpga/fpga-area.txt new file +1
-0+ compatible = "altr,socfpga-a10-fpga-mgr", "simple-bus";
This should not have simple-bus. This would be broken in the case of applying the overlay before booting the kernel. You don't want the devices probed before the fpgamgr has programmed them.
Quoted 22 lines
Documentation/fpga/fpga-area.txt new file +22
-0+ 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@0"; /* targeted to the manager */ + __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + area@0 {
Documentation/fpga/fpga-area.txt line 208
Quoted 10 lines
Documentation/fpga/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@0x100010010 {
Remove 0x
Quoted 7 lines
Documentation/fpga/fpga-area.txt new file +7
-0+ compatible = "altr,pio-1.0"; + reg = <0x10010 0x10>; + altr,ngpio = <4>; + #gpio-cells = <0x2>; + gpio-controller; + }; + };
Documentation/fpga/fpga-area.txt line 225
Quoted 10 lines
Documentation/fpga/fpga-area.txt new file +10
-0+ }; + }; +}; + + +Device Tree Example: Full Reconfiguration with Bridges +====================================================== + +Live Device Tree contains: + fpgamgr@0 {
unit address
Documentation/fpga/fpga-area.txt line 228
Quoted 3 lines
Documentation/fpga/fpga-area.txt new file +3
-0+ compatible = "altr,socfpga-fpga-mgr", "simple-bus"; + reg = <0xFF706000 0x1000 + 0xFFB90000 0x1000>;
lower case
Documentation/fpga/fpga-area.txt line 235
Quoted 7 lines
Documentation/fpga/fpga-area.txt new file +7
-0+ interrupts = <0 175 4>; + + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + + bridge@0 {
Don't the outbound bridges have an address range associated with them? Possibly, they should not be children of the fpgamgr unless the fpgamgr itself is a bridge.
Documentation/fpga/fpga-area.txt line 238
Quoted 3 lines
Documentation/fpga/fpga-area.txt new file +3
-0+ /* both the manager and the controlling bridge have + * the added simple-bus compatible to allow child + * devices to be populated. */
Why? Once you have initialized the bridge, you call of_platform_populate with this node as the starting point. The root does not need any matching string.
Quoted 30 lines
Documentation/fpga/fpga-area.txt new file +30
-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 { + /* 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@0/bridge@0"; /* controlling bridge */ + __overlay__ { + #address-cells = <1>; + #size-cells = <1>;
Documentation/fpga/fpga-area.txt line 278
Quoted 10 lines
Documentation/fpga/fpga-area.txt new file +10
-0+ + area@0 { + compatible = "fpga-area"; + + #address-cells = <2>; + #size-cells = <1>; + /* Note that two ranges are mapped due to the + * two bridges. */ + ranges = <0 0x00000000 0xc0000000 0x00010000>, + <1 0x00020000 0xff220000 0x00000008>;
0 and 1 are address bits or mean something else (chip select # is common example)?
Documentation/fpga/fpga-area.txt line 282
Quoted 4 lines
Documentation/fpga/fpga-area.txt new file +4
-0+ + firmware-name = "soc_system.rbf"; + + onchip_memory2_0: memory@000000000 {
Drop leading zeros (i.e. memory@0).
Documentation/fpga/fpga-area.txt line 288
Quoted 6 lines
Documentation/fpga/fpga-area.txt new file +6
-0+ device_type = "memory"; + compatible = "altr,onchipmem-15.1"; + reg = <0 0x00000000 0x00010000>; + }; + + jtag_uart: serial@0x100020000 {
Drop '0x'
Quoted 14 lines
Documentation/fpga/fpga-area.txt new file +11
-0+ compatible = "altr,juart-1.0"; + reg = <1 0x00020000 0x00000008>; + interrupt-parent = <&intc>; + interrupts = <0 42 4>; + clocks = <&osc2>; + }; + }; + }; + }; +}; +Signature · 1 line
1.7.9.5
Re: [PATCH v14 1/7] fpga: add usage documentation for fpga area
On Fri, 11 Dec 2015, Rob Herring wrote:
Hi Rob,
Quoted 7 lines
Documentation/fpga/fpga-area.txt line 175
Quoted 5 lines
Documentation/fpga/fpga-area.txt new file +5
-0+Device Tree Example: Partial Reconfiguration with no Bridges +============================================================ + +Live Device Tree contains: + fpgamgr@0 {Unit address should be
ffd03000here.
I'll clean up the addresses (and add that to my checklist!).
Quoted 7 lines
Documentation/fpga/fpga-area.txt line 176
Quoted 2 lines
Documentation/fpga/fpga-area.txt new file +1
-0+ compatible = "altr,socfpga-a10-fpga-mgr", "simple-bus";This should not have simple-bus. This would be broken in the case of applying the overlay before booting the kernel. You don't want the devices probed before the fpgamgr has programmed them.
I debugged this and had to add the simple-bus's to see my child devices probe. Otherwise I can apply the overlay, but when I call of_platform_populate, no child nodes get populated.
In drivers/of/platform.c's of_platform_notify(), the OF_POPULATED_BUS flag has to be set for the parent (implying it was set for its parents or it wouldn't be set). The child nodes do not get populated unless the insertion point and all the ancestors of the insertion point are simple-bus's.
So the issue of applying the overlay before booting the kernel:
if FPGA Area gets probed before its children get populated, then I'm K since FPGA Area is responsible for programming the FPGA.
I can rework this to have a virtualized fpgabus that has the fpgamgr and bridges as its children if that is more correct. I actually worked this up several different ways so I have the code. I still would like to keep the FPGA Area because that gives me a module that gets probed that can be in charge of programming the FPGA. If I were to rid of FPGA Area and just have an overlay of "firmware-name" plus child nodes, then I have to add a notifier to the fpgabus. This I can do (and have done and seen it work) so if that is preferable, that's what v15 of this can easily be.
In that case, the target path for the overlay could be the fpgabus. The fpgabus would need to also be a simple-bus but not the manager or bridges.
So if I have a fpgabus, the live tree would be:
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";
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>;
};
};Alan
Rob Herring
maintainerRe: [PATCH v14 1/7] fpga: add usage documentation for fpga area
Quoted 22 lines · atull
On Fri, 11 Dec 2015, Rob Herring wrote:
Hi Rob,
Quoted 7 lines
Documentation/fpga/fpga-area.txt line 175
Quoted 5 lines
Documentation/fpga/fpga-area.txt new file +5
-0+Device Tree Example: Partial Reconfiguration with no Bridges +============================================================ + +Live Device Tree contains: + fpgamgr@0 {Unit address should be
ffd03000here.I'll clean up the addresses (and add that to my checklist!).
Quoted 7 lines
Quoted 2 lines
+ compatible = "altr,socfpga-a10-fpga-mgr", "simple-bus";
This should not have simple-bus. This would be broken in the case of applying the overlay before booting the kernel. You don't want the devices probed before the fpgamgr has programmed them.
Quoted 8 lines
I debugged this and had to add the simple-bus's to see my child devices probe. Otherwise I can apply the overlay, but when I call
of_platform_populate, no child nodes get populated.
In drivers/of/platform.c'sof_platform_notify(), theOF_POPULATED_BUSflag has to be set for the parent (implying it was set for its parents or it wouldn't be set). The child nodes do not get populated unless the insertion point and all the ancestors of the insertion point are simple-bus's.
That's probably an oddity in how overlays are applied. We may not want the core to populate the devices, but require that the FPGA mgr does that.
Quoted 55 lines
So the issue of applying the overlay before booting the kernel:
if FPGA Area gets probed before its children get populated, then I'm K since FPGA Area is responsible for programming the FPGA.I can rework this to have a virtualized fpgabus that has the fpgamgr and bridges as its children if that is more correct. I actually worked this up several different ways so I have the code. I still would like to keep the FPGA Area because that gives me a module that gets probed that can be in charge of programming the FPGA. If I were to rid of FPGA Area and just have an overlay of "firmware-name" plus child nodes, then I have to add a notifier to the fpgabus. This I can do (and have done and seen it work) so if that is preferable, that's what v15 of this can easily be.
In that case, the target path for the overlay could be the fpgabus. The fpgabus would need to also be a simple-bus but not the manager or bridges.
So if I have a fpgabus, the live tree would be:
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"; 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>; }; };Alan
--
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 v14 2/7 fpga: add bindings document for fpga area
In reply to [email protected]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
--- .../devicetree/bindings/fpga/fpga-area.txt | 70 ++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/fpga-area.txt
Documentation/devicetree/bindings/fpga/fpga-area.txt new file +70 -0
@@ -0,0 +1,70 @@ +FPGA Area +========= + +A FPGA Area details information about a section of an FPGA including the FPGA +image needed to program it and the hardware contained in this section of the +FPGA once it is programmed. + +A FPGA Area corresponds to the whole FPGA in the case of full reconfiguration +or a section of a FPGA in the case of partial reconfiguration. + +Required properties: +- compatible : should contain "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 a 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. + +Example: + +/dts-v1/; +/plugin/; +/ { + fragment@0 { + target-path="/soc/fpgamgr@0/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@000000000 { + 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; + }; + }; + }; + }; +}; +
Signature · 1 line
1.7.9.5
Rob Herring
maintainerRe: [PATCH v14 2/7] fpga: add bindings document for fpga area
Quoted 35 lines · On Thu, Dec 10, 2015 at 05:37:04PM -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--- .../devicetree/bindings/fpga/fpga-area.txt | 70 ++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/fpga-area.txtDocumentation/devicetree/bindings/fpga/fpga-area.txt new file +2
-0@@ -0,0 +1,70 @@ +FPGA Area +=========
Documentation/devicetree/bindings/fpga/fpga-area.txt line 12
Quoted 10 lines
Documentation/devicetree/bindings/fpga/fpga-area.txt new file +10
-0+ +A FPGA Area details information about a section of an FPGA including the FPGA +image needed to program it and the hardware contained in this section of the +FPGA once it is programmed. + +A FPGA Area corresponds to the whole FPGA in the case of full reconfiguration +or a section of a FPGA in the case of partial reconfiguration. + +Required properties: +- compatible : should contain "fpga-area"
I'm not too sure about this. I think this needs to be FPGA specfic.
Quoted 7 lines
Documentation/devicetree/bindings/fpga/fpga-area.txt new file +7
-0+- #address-cells, #size-cells, ranges: must be present to handle address space + mapping for children. + +Optional properties: +- firmware-name : should contain the name of a FPGA image file located on the + firmware search path. +- partial-reconfig : boolean property should be defined if partial
Documentation/devicetree/bindings/fpga/fpga-area.txt line 29
Quoted 10 lines
Documentation/devicetree/bindings/fpga/fpga-area.txt new file +10
-0+ reconfiguration of the FPGA is to be done, otherwise full reconfiguration + is done. + +Example: + +/dts-v1/; +/plugin/; +/ { + fragment@0 { + target-path="/soc/fpgamgr@0/bridge@0";
Does the bus really go thru the fpgamgr and then the bridge as this implies? Or fpgamgr is a sideband controller? For example purposes, it would be better to show this not as an overlay so I get the complete picture.
Unit addresses of 0 look a bit questionable as I'd expect these to be addresses.
Documentation/devicetree/bindings/fpga/fpga-area.txt line 34
Quoted 5 lines
Documentation/devicetree/bindings/fpga/fpga-area.txt new file +5
-0+ __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + bridge@ff200000 {
2 levels of bridge devices/buses?
There is nothing programmable for this bridge? clocks, resets, etc.?
Quoted 43 lines
Documentation/devicetree/bindings/fpga/fpga-area.txt new file +36
-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@000000000 { + 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; + }; + }; + }; + }; +}; +Signature · 6 lines
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 v14 3/7 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.
--- Documentation/ABI/testing/sysfs-class-fpga-bridge | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-fpga-bridge
Documentation/ABI/testing/sysfs-class-fpga-bridge new file +11 -0
@@ -0,0 +1,11 @@ +What: /sys/class/fpga_bridge/<bridge>/name +Date: December 2015 +KernelVersion: 4.4 +Contact: Alan Tull <[email protected]> +Description: Name of low level FPGA bridge driver. + +What: /sys/class/fpga_bridge/<bridge>/state +Date: December 2015 +KernelVersion: 4.4 +Contact: Alan Tull <[email protected]> +Description: Show bridge state as "enabled" or "disabled"
Signature · 1 line
1.7.9.5
PATCH v14 4/7 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
--- .../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 v14 5/7 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
--- 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 v14 6/7 fpga: fpga-area: support device tree control for FPGA programming
In reply to [email protected]From: Alan Tull <[email protected]>
FPGA Areas support programming FPGA under control of the Device Tree.
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
The use case where FPGA Bridges are not needed is supported.
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
--- drivers/fpga/Kconfig | 7 ++ drivers/fpga/Makefile | 3 + drivers/fpga/fpga-area.c | 313 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 323 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 +313 -0
313 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v14 7/7 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
--- 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 4 lines · On Thu, Dec 10, 2015 at 3:37 PM, <[email protected]> wrote:
From: Alan Tull <[email protected]>
For v14 I'm dropping the concept of "simple-fpga-bus" for "fpga-area" with reworked bindings.
I had an offline discussion with Josh Cartwright about his concerns. He brought up a good
point on w.r.t to the way FPGA Area (Bus) deals with things.
Currently we only support complete status = "okay" vs "disabled" kind of overlays.
If now you have say a UART in the FPGA that you don't want to go away and come back on reload,
we don't have a good way of expressing this. Is there a good way to express non-mmio FPGA devices?
I've been toying around with hacking up struct device to include a FPGA 'domain', and then, similar
to power domains allow devices to register suspend() / resume() style callbacks (could call them pre_reload() or something like that ...)
I haven't gotten around to think it through. At this point it's just an idea and I don't have real code to show.
I realize the issue with that is we'd have to make changes to struct device.
Cheers,
Moritz
Quoted 12 lines · Moritz Fischer
Hi Alan,
Quoted 4 lines · On Thu, Dec 10, 2015 at 3:37 PM, <[email protected]> wrote:
From: Alan Tull <[email protected]>
For v14 I'm dropping the concept of "simple-fpga-bus" for "fpga-area" with reworked bindings.
I had an offline discussion with Josh Cartwright about his concerns. He brought up a good
point on w.r.t to the way FPGA Area (Bus) deals with things.
Quoted 6 lines
Currently we only support complete status = "okay" vs "disabled" kind of overlays.
If now you have say a UART in the FPGA that you don't want to go away and come back on reload,
we don't have a good way of expressing this.
Maybe i don't understand what you are saying; could you write out a sequence you want to be able to do?
If you want suspend/resume functionality that would reload the FPGA after a suspend powers off the FPGA, that would be simple to add to the FPGA area code and it wasn't a hack at all.
Quoted 2 lines
Is there a good way to
express non-mmio FPGA devices?
Is this a separate question/issue from the above? Are you talking about acceleration?
Quoted 10 lines
I've been toying around with hacking up struct device to include a FPGA 'domain', and then, similar
to power domains allow devices to registersuspend()/resume()style callbacks (could call thempre_reload()or something like that ...)I haven't gotten around to think it through. At this point it's just an idea and I don't have real code to show.
I realize the issue with that is we'd have to make changes to struct device.
That's interesting. Usually a FPGA image has many devices in it, so so way of making that dependency clear would be needed. If any of the devices involved are powered up, that FPGA image would need to be loaded.
Currently I'm trying to get some bindings approved for doing device tree control of loading the FPGA and probing the devices. My idea is that these bindings could be useful for some use cases where we are loading hardware onto the FPGA that needs to show up in the device tree. Some of Rob's feedback is that my proposal may be Altera-specific. If the bindings that I am proposing are useful for at least some uses with Xilinx parts, that would be valuable feedback at this point. If they are Altera-specific, then I may need to add "altr," to some of the compatible strings like "altr,fpga-bus" and "altr,fpga-area". My original intent was to implement something that you could use also, so I hope that's not the future here.
So my question for you is: is this stuff useful for you?
Alan Tull
Quoted 4 lines
Cheers,
Moritz
Hi Alan,
Quoted 9 lines · Alan Tull
Quoted 6 lines
I had an offline discussion with Josh Cartwright about his concerns. He brought up a good
point on w.r.t to the way FPGA Area (Bus) deals with things.Currently we only support complete status = "okay" vs "disabled" kind of overlays.
Maybe i don't understand what you are saying; could you write out a sequence you want to be able to do?
Let's say you have a UART in the FPGA. You want to reprogram the FPGA fabric that includes the UART (assuming proper resets etc happen)
1) Driver gets notified of impending doom, keeps hands off of FPGA
2) FPGA Manager reloads FPGA
3) FPGA Manager lets driver know FPGA is back
4) Driver can continue to function as always
It wouldn't even have to be a UART, on some boards simple SPI lines or UART lines go from the processor through the FPGA logic out to a pin. When you reload the FPGA for a short moment of time that doesn't work, while after the reload it works just fine. Maybe something like extcon could be used for that?
Quoted 2 lines
Is this a separate question/issue from the above? Are you talking about acceleration?
I meant stuff like SPI that gets routed through the FPGA, sorry for being unclear ;-)
Quoted 9 lines
Quoted 9 lines
I've been toying around with hacking up struct device to include a FPGA 'domain', and then, similar
to power domains allow devices to registersuspend()/resume()style callbacks (could call thempre_reload()or something like that ...)I haven't gotten around to think it through. At this point it's just an idea and I don't have real code to show.
Quoted 6 lines
Quoted 1 line
I realize the issue with that is we'd have to make changes to struct device.
That's interesting. Usually a FPGA image has many devices in it, so so way of making that dependency clear would be needed. If any of the devices involved are powered up, that FPGA image would need to be loaded.
Yeah. That's why I think the power domain model we have has a bunch of similarities.
Quoted 12 lines
Currently I'm trying to get some bindings approved for doing device tree control of loading the FPGA and probing the devices. My idea is that these bindings could be useful for some use cases where we are loading hardware onto the FPGA that needs to show up in the device tree. Some of Rob's feedback is that my proposal may be Altera-specific. If the bindings that I am proposing are useful for at least some uses with Xilinx parts, that would be valuable feedback at this point. If they are Altera-specific, then I may need to add "altr," to some of the compatible strings like "altr,fpga-bus" and "altr,fpga-area". My original intent was to implement something that you could use also, so I hope that's not the future here.
Quoted 1 line
So my question for you is: is this stuff useful for you?
Definitely, I'm pretty happy with what you have so far!
I think the points I mentioned above apply to Altera devices, too. Maybe we can solve this in two parts, and the first step is getting the loading bindings accepted ;-)
Cheers,
Moritz