Add support for loading FPGA bitstream
v7 cover Add support for loading FPGA bitstream
From: Tien Fong Chee <[email protected]>
These series of patches enable peripheral bitstream being programmed into FPGA to get the DDR up running. This's also called early IO release, because the peripheral bitstream is only initializing FPGA IOs, PLL, IO48 and DDR.
Once DDR is up running, core bitstream from MMC which contains user FPGA design would be loaded into DDR location. socfpga loadfs would be called to program core bitstream into FPGA and entering user mode.
Lastly, u-boot-dtb.img from MMC FAT partition would be loaded to DDR, and up running from there.
For this whole mechanism to work, the SDMMC flash layout would be designed as shown in below:
RAW partition:
1. spl_w_dtb-mkpimage.bin
mkpimage -hv 1 -o spl/spl_w_dtb-mkpimage.bin spl/u-boot-spl-dtb.bin
spl/u-boot-spl-dtb.bin spl/u-boot-spl-dtb.bin spl/u-boot-spl-dtb.bin
FAT partition contains:
FPGA FIT image(fit_spl_fpga.itb)
--------------------------------
Early IO release method is recommended for the sake of performance, improve up to 86% compare to full bitstream.
To generate FPGA FIT image for Early IO release, runs this command:tools/mkimage -E -p 400
-f board/altera/arria10-socdk/fit_spl_fpga.its fit_spl_fpga.itb
Before running above command, ensure U-Boot source directory contains both peripheral bitstream(ghrd_10as066n2.periph.rbf) and
core bitstream(ghrd_10as066n2.core.rbf_.
For details of describing structure and contents of the FIT image, please refer board/altera/arria10-socdk/fit_spl_fpga.its
Additonal note:
---------------
There is performance penalty if the memory used for loading
the bitstream is unalligned to ARCH_DMA_MINALIGN inside function "static intget_cluster()" in fs/fat/fat.c. Sometimes child functions would alter the memory location and causing unalligned to ARCH_DMA_MINALIGN. This only happend when reading a FAT file by offset.
To avoid performance penalty, core bitstream(fpga-2) contains large size should be at 1st then following by peripheral bitstream(fpga-1) as shown in fit_spl_fpga.its.
After that, enable the DEBUG in fs/fat/fat.c and ensure no
print out "FAT: Misaligned buffer address (%p)" when loading core bitstream on SPL console. Print out when loading peripheral bitstream can be ignored because the size is too small.
If there is print out, please set an allign data position by running mkimage with optional -p xxx when generating FIT image.
U-Boot image
------------
3. u-boot-dtb.img
For the testing purpose, these 3 series of patches are required to apply 1st before applying this series of patches.
1. [U-Boot] [PATCH v4] misc: fs_loader: Add support for initializing block device
https://www.mail-archive.com/u-boot at lists.denx.de/msg314453.html Version 4 under review
2. [U-Boot] [PATCH v2 1/4] spl: Kconfig: Replace CONFIG_SPL_FAT_SUPPORT with CONFIG_SPL_FS_FAT
https://www.mail-archive.com/u-boot at lists.denx.de/msg313259.html All series Reviewed-by: Tom Rini <[email protected]>
Some patches of the series Reviewed-by: Simon Goldschmidt
3. [U-Boot] [PATCH v2 1/2] fs: fat: dynamically allocate memory for temporary buffer
https://www.mail-archive.com/u-boot at lists.denx.de/msg314470.html Version 2 under review
This series is working on top of u-boot.git -
http://git.denx.de/u-boot.git .
Tien Fong Chee (7):
ARM: socfpga: Description on FPGA bitstream type and file name for
Arria 10
ARM: socfpga: Add default FPGA bitstream fitImage for Arria10 SoCDK
ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
ARM: socfpga: Add the configuration for FPGA SoCFPGA A10 SoCDK spl : socfpga: Implement fpga bitstream loading with socfpga loadfs
ARM: socfpga: Synchronize the configuration for A10 SoCDK
ARM: socfpga: Increase Malloc pool size to support FAT filesystem in
SPL
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- arch/arm/mach-socfpga/spl_a10.c | 46 ++- board/altera/arria10-socdk/fit_spl_fpga.its | 31 ++ configs/socfpga_arria10_defconfig | 21 +- .../fpga/altera-socfpga-a10-fpga-mgr.txt | 34 +- drivers/fpga/socfpga_arria10.c | 417 ++++++++++++++++++++- include/configs/socfpga_common.h | 4 +- 8 files changed, 584 insertions(+), 26 deletions(-) create mode 100644 board/altera/arria10-socdk/fit_spl_fpga.its
Signature · 1 line
2.2.0
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used for both peripheral bitstream and core bitstream.
---
changes for v7
- Provided example of setting FPGA FIT image for both early IO release and full release FPGA configuration.
--- .../fpga/altera-socfpga-a10-fpga-mgr.txt | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +33 -1
@@ -7,8 +7,39 @@ Required properties: - The second index is for writing FPGA configuration data. - resets : Phandle and reset specifier for the device's reset. - clocks : Clocks used by the device. +- altr,bitstream : File name for FPGA peripheral bitstream which is used + to initialize FPGA IOs, PLL, IO48 and DDR. This bitstream is + required to get DDR up running. + or + File name for full bitstream, consist of peripheral bitstream + and core bitstream. +- altr,bitstream-core(optional) : File name for core bitstream which contains + FPGA design which is used to program FPGA CRAM + and ERAM. -Example: +Example: Bundles both peripheral bitstream and core bitstream into FIT image + called fit_spl_fpga.itb. This FIT image can be created through running + this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its + fit_spl_fpga.itb + + For details of describing structure and contents of the FIT image, + please refer board/altera/arria10-socdk/fit_spl_fpga.its + +- Examples for booting with early IO release, and enter early user mode: + + fpga_mgr: fpga-mgr at ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb"; + }; + +- Examples for booting with full release, enter user mode with full bitstream: fpga_mgr: fpga-mgr at ffd03000 { compatible = "altr,socfpga-a10-fpga-mgr";
@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
Signature · 1 line
2.2.0
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 21 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used for both peripheral bitstream and core bitstream.
Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO release and full release FPGA configuration.--- .../fpga/altera-socfpga-a10-fpga-mgr.txt | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +0
-0
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt Required properties: · line 16
Quoted 10 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +7
-0@@ -7,8 +7,39 @@ Required properties: - The second index is for writing FPGA configuration data. - resets : Phandle and reset specifier for the device's reset. - clocks : Clocks used by the device. +- altr,bitstream : File name for FPGA peripheral bitstream which is used + to initialize FPGA IOs, PLL, IO48 and DDR. This bitstream is + required to get DDR up running. + or + File name for full bitstream, consist of peripheral bitstream + and core bitstream. +- altr,bitstream-core(optional) : File name for core bitstream which contains
Is the name of the property 'altr,bitstream-core(optional)' ? I think the "optional" part should be in the description.
Quoted 14 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +12
-1+ FPGA design which is used to program FPGA CRAM + and ERAM. -Example: +Example: Bundles both peripheral bitstream and core bitstream into FIT image + called fit_spl_fpga.itb. This FIT image can be created through running + this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its + fit_spl_fpga.itb + + For details of describing structure and contents of the FIT image, + please refer board/altera/arria10-socdk/fit_spl_fpga.its +
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt Required properties: · line 39
Quoted 10 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +10
-0+- Examples for booting with early IO release, and enter early user mode: + + fpga_mgr: fpga-mgr at ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb";
It's the same file, why does it use two properties ? And where is this file loaded from ?
Quoted 13 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +4
-0+ }; + +- Examples for booting with full release, enter user mode with full bitstream: fpga_mgr: fpga-mgr at ffd03000 { compatible = "altr,socfpga-a10-fpga-mgr";@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 37 lines · Marek Vasut
Quoted 36 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used for both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO release
and full release FPGA configuration.
---
.../fpga/altera-socfpga-a10-fpga-mgr.txt | 34
+++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga- mgr.txt
index 2fd8e7a..5f81a32 100644doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +0
-0@@ -7,8 +7,39 @@ Required properties:- The second index is for writing FPGA configuration data.
- resets : Phandle and reset specifier for the device's reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream which is useddoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ to initialize FPGA IOs, PLL, IO48 and DDR. Thisbitstream is
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ required to get DDR up running.
Quoted 8 lines
Quoted 6 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-0+ or + File name for full bitstream, consist ofperipheral bitstream
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name for core bitstreamwhich contains
Is the name of the property 'altr,bitstream-core(optional)' ? I think the "optional" part should be in the description.
Yes, you are right.
Quoted 25 lines
Quoted 25 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ FPGA design which is used toprogram FPGA CRAM
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ and ERAM.doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-1-Example: +Example: Bundles both peripheral bitstream and core bitstream intoFIT image
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ called fit_spl_fpga.itb. This FIT image can be createdthrough running
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ fit_spl_fpga.itb + + For details of describing structure and contents of theFIT image,
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its + +- Examples for booting with early IO release, and enter early usermode:
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-0+ + fpga_mgr: fpga-mgr at ffd03000 {
Quoted 8 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt Required properties: · line 39
Quoted 7 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +7
-0+ compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb";It's the same file, why does it use two properties ?
1. Allows user to run optional for program core. When "" is set to altr,bitstream-core, then SPL would skip programming FPGA with core, so user can program it later on U-Boot or Linux.
2. Allows core in different FIT file.
Quoted 2 lines
And where is this
file loaded from ?
You need to set the default source in DTS, for example "firmware-loader = &fs_loader0", that's for power boot up purpose. After that, generic firmware loader would go to the dsignated storage as described below to find the FPGA FIT image according description from above.
fs_loader0: fs-loader at 0 {
u-boot,dm-pre-reloc;
compatible = "u-boot,fs-loader";
phandlepart = <&mmc 1>;
};Quoted 17 lines
Quoted 16 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ }; + +- Examples for booting with full release, enter user mode withfull bitstream:
fpga_mgr: fpga-mgr atffd03000{ compatible = "altr,socfpga-a10-fpga-mgr";doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 80 lines · Tien Fong
Quoted 37 lines · Marek Vasut
Quoted 36 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used for both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO release
and full release FPGA configuration.
---
.../fpga/altera-socfpga-a10-fpga-mgr.txt | 34
+++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga- mgr.txt
index 2fd8e7a..5f81a32 100644doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +0
-0@@ -7,8 +7,39 @@ Required properties:- The second index is for writing FPGA configuration data.
- resets : Phandle and reset specifier for the device's reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream which is useddoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ to initialize FPGA IOs, PLL, IO48 and DDR. Thisbitstream is
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ required to get DDR up running.Quoted 8 lines
Quoted 6 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-0+ or + File name for full bitstream, consist ofperipheral bitstream
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name for core bitstreamwhich contains
Is the name of the property 'altr,bitstream-core(optional)' ? I think the "optional" part should be in the description.
Yes, you are right.
Quoted 25 lines
Quoted 25 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ FPGA design which is used toprogram FPGA CRAM
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ and ERAM.doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-1-Example: +Example: Bundles both peripheral bitstream and core bitstream intoFIT image
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ called fit_spl_fpga.itb. This FIT image can be createdthrough running
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ fit_spl_fpga.itb + + For details of describing structure and contents of theFIT image,
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its + +- Examples for booting with early IO release, and enter early usermode:
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-0+ + fpga_mgr: fpga-mgr at ffd03000 {Quoted 8 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt Required properties: · line 39
Quoted 7 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +7
-0+ compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb";It's the same file, why does it use two properties ?
Quoted 3 lines
1. Allows user to run optional for program core. When "" is set to altr,bitstream-core, then SPL would skip programming FPGA with core, so user can program it later on U-Boot or Linux.
You can just pass in a fitImage with only the periph image in it in such a case.
Quoted 1 line
2. Allows core in different FIT file.
Is this really useful ?
Quoted 7 lines
Quoted 2 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware-loader =
&fs_loader0", that's for power boot up purpose. After that, generic firmware loader would go to the dsignated storage as described below to find the FPGA FIT image according description from above.
Quoted 5 lines
fs_loader0: fs-loader at 0 {
u-boot,dm-pre-reloc;
compatible = "u-boot,fs-loader";
phandlepart = <&mmc 1>;
};How does the driver bound to fpga-mgr know which firmware loader instance to use ? There's no phandle.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ }; + +- Examples for booting with full release, enter user mode withfull bitstream:
fpga_mgr: fpga-mgr atffd03000{ compatible = "altr,socfpga-a10-fpga-mgr";doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 100 lines · Marek Vasut
Quoted 99 lines · Tien Fong
Quoted 48 lines · Marek Vasut
Quoted 46 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO release
and full release FPGA configuration.
---
.../fpga/altera-socfpga-a10-fpga-mgr.txt | 34
+++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga- mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga- mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties:- The second index is for writing FPGA configuration data.
- resets : Phandle and reset specifier for the device's reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL, IO48 and DDR.This
bitstream isdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-0+ required to get DDR up running. + orQuoted 8 lines
Quoted 5 lines
(quoted diff) +1
-0+ File name for full bitstream, consist ofperipheral bitstream
(quoted diff) +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name for core bitstreamwhich contains
Is the name of the property 'altr,bitstream-core(optional)' ? I think
the "optional" part should be in the description.Yes, you are right.
Quoted 40 lines
Quoted 30 lines
(quoted diff) +1
-0+ FPGA design which is used toprogram FPGA CRAM
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ and ERAM.(quoted diff) +1
-1-Example: +Example: Bundles both peripheral bitstream and core bitstreaminto
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT image can becreated
through runningdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ fit_spl_fpga.itb + + For details of describing structure and contents ofthe
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter early user
mode:doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt Required properties: · line 39
Quoted 9 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +9
-0+ + fpga_mgr: fpga-mgr at ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb";It's the same file, why does it use two properties ?
Quoted 7 lines
Quoted 4 lines
1. Allows user to run optional for program core. When "" is set to altr,bitstream-core, then SPL would skip programming FPGA with core, so
user can program it later on U-Boot or Linux.You can just pass in a fitImage with only the periph image in it in such
a case.
What if user want to program the core on U-Boot? User need to create two FIT images, one FIT with periph image, and another FIT with core image only.
Current implementation supports one FIT image for above configuration.
Quoted 4 lines
Quoted 3 lines
2. Allows core in different FIT file.
Is this really useful ?
Yes, for the use case which support different core image for different revision of board but using same periph image.
Quoted 13 lines
Quoted 13 lines
Quoted 5 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware- loader
=&fs_loader0", that's for power boot up purpose. After that, generic
firmware loader would go to the dsignated storage as described below to
find the FPGA FIT image according description from above.
Quoted 7 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader instance to use ? There's no phandle.
Current firmware loader supports only one instance, that is default instance described in chosen node. It is good enough to solve our problem where to define a default storage for FPGA images and how to tell the SPL to load it from the default storage when the board is powered up. I don't see there is a need to support more than one instance for fpga-mgr during SPL runtime, at least for now. User can program the FPGA with core image from any storage with series of commands such as fatload and socfpga load on U-Boot console.
It is good to improve the firmware loader to support
the DM_FLAG_PRE_RELOC, which allow user to choose different firmware loader node through setting the right sequence number when creating the firmare loader instance in the parent driver such as fpga mgr, but i don't see there is urgency need to be done now.
Quoted 19 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ }; + +- Examples for booting with full release, enter user mode withfull bitstream:
fpga_mgr: fpga-mgr atffd03000{ compatible = "altr,socfpga-a10-fpga-mgr";doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 107 lines · Tien Fong
Quoted 95 lines · Marek Vasut
Quoted 94 lines · Tien Fong
Quoted 46 lines · Marek Vasut
Quoted 45 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO release
and full release FPGA configuration.--- .../fpga/altera-socfpga-a10-fpga-mgr.txt | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga- mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga- mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties: - The second index is for writing FPGAconfiguration data.
- resets : Phandle and reset specifier for the device's
reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL, IO48 and DDR.This
bitstream isdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-0+ required to get DDR up running. + orQuoted 8 lines
Quoted 5 lines
(quoted diff) +1
-0+ File name for full bitstream, consist ofperipheral bitstream
(quoted diff) +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name for core bitstreamwhich contains
Is the name of the property 'altr,bitstream-core(optional)' ? I think
the "optional" part should be in the description.Yes, you are right.
Quoted 38 lines
Quoted 28 lines
(quoted diff) +1
-0+ FPGA design which is used toprogram FPGA CRAM
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-1+ and ERAM. -Example: +Example: Bundles both peripheral bitstream and core bitstreaminto
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT image can becreated
through runningdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ fit_spl_fpga.itb + + For details of describing structure and contents ofthe
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter early user
mode:doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt Required properties: · line 39
Quoted 9 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +9
-0+ + fpga_mgr: fpga-mgr at ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb";It's the same file, why does it use two properties ?
Quoted 7 lines
Quoted 4 lines
1. Allows user to run optional for program core. When "" is set to altr,bitstream-core, then SPL would skip programming FPGA with core, so
user can program it later on U-Boot or Linux.You can just pass in a fitImage with only the periph image in it in such
a case.What if user want to program the core on U-Boot? User need to create two FIT images, one FIT with periph image, and another FIT with core image only.
Quoted 5 lines
Current implementation supports one FIT image for above configuration.
Quoted 2 lines
Quoted 1 line
2. Allows core in different FIT file.
Is this really useful ?
Yes, for the use case which support different core image for different revision of board but using same periph image.
I would have to disagree here. This is not a supported flow, the periph image and core image must come from the same compilation of quartus for arria10 to guarantee functionality. That is unless something has changed that I am not aware of? I believe this holds true in S10, the difference being that in s10 you can reconfigure the periph rbf without affecting the processor IO.
Why are there separate fit images for uboot and the fpga? would it not make sense to combine them into a single fit image? Wouldn't you want to couple a devicetree and a periph image together and then allow for selection of configurations?
I also wonder why there is a need to support core image programming in SPL? If the desire is to have the full image programmed, would you not just create a single rbf (combined periph and core?)
--dalon
Quoted 45 lines
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware- loader
=&fs_loader0", that's for power boot up purpose. After that, generic
firmware loader would go to the dsignated storage as described below to
find the FPGA FIT image according description from above.Quoted 7 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader instance to use ? There's no phandle.
Current firmware loader supports only one instance, that is default instance described in chosen node. It is good enough to solve our problem where to define a default storage for FPGA images and how to tell the SPL to load it from the default storage when the board is powered up. I don't see there is a need to support more than one instance for fpga-mgr during SPL runtime, at least for now. User can program the FPGA with core image from any storage with series of commands such as fatload and socfpga load on U-Boot console.
It is good to improve the firmware loader to support
theDM_FLAG_PRE_RELOC, which allow user to choose different firmware loader node through setting the right sequence number when creating the firmare loader instance in the parent driver such as fpga mgr, but i don't see there is urgency need to be done now.Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ }; + +- Examples for booting with full release, enter user mode withfull bitstream:
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0fpga_mgr: fpga-mgr at ffd03000 { compatible = "altr,socfpga-a10-fpga-mgr";@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 117 lines · Dalon L Westergreen
Quoted 104 lines · Tien Fong
Quoted 92 lines · Marek Vasut
Quoted 91 lines · Tien Fong
Quoted 45 lines · Marek Vasut
Quoted 44 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO release
and full release FPGA configuration.--- .../fpga/altera-socfpga-a10-fpga-mgr.txt | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga- mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga- mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties: - The second index is for writing FPGAconfiguration data.
- resets : Phandle and reset specifier for the device's
reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL, IO48 and DDR.This
bitstream isdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-0+ required to get DDR up running. + orQuoted 8 lines
Quoted 5 lines
(quoted diff) +1
-0+ File name for full bitstream, consist ofperipheral bitstream
(quoted diff) +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name for core bitstreamwhich contains
Is the name of the property 'altr,bitstream-core(optional)' ? I think
the "optional" part should be in the description.Yes, you are right.
Quoted 36 lines
Quoted 26 lines
(quoted diff) +1
-0+ FPGA design which is used toprogram FPGA CRAM
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-1+ and ERAM. -Example: +Example: Bundles both peripheral bitstream and core bitstreaminto
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT image can becreated
through runningdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ fit_spl_fpga.itb + + For details of describing structure and contents ofthe
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter early user
mode:doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt Required properties: · line 39
Quoted 9 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +9
-0+ + fpga_mgr: fpga-mgr at ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb";It's the same file, why does it use two properties ?
Quoted 7 lines
Quoted 4 lines
1. Allows user to run optional for program core. When "" is set to altr,bitstream-core, then SPL would skip programming FPGA with core, so
user can program it later on U-Boot or Linux.You can just pass in a fitImage with only the periph image in it in such
a case.What if user want to program the core on U-Boot? User need to create two FIT images, one FIT with periph image, and another FIT with core image only.
Quoted 5 lines
Current implementation supports one FIT image for above configuration.
Quoted 2 lines
Quoted 1 line
2. Allows core in different FIT file.
Is this really useful ?
Yes, for the use case which support different core image for different revision of board but using same periph image.
I would have to disagree here. This is not a supported flow, the periph image and core image must come from the same compilation of quartus for arria10 to guarantee functionality. That is unless something has changed that I am not aware of? I believe this holds true in S10, the difference being that in s10 you can reconfigure the periph rbf without affecting the processor IO.
Quoted 9 lines
Why are there separate fit images for uboot and the fpga? would it not make sense to combine them into a single fit image? Wouldn't you want to couple a devicetree and a periph image together and then allow for selection of configurations?
I also wonder why there is a need to support core image programming in SPL? If the desire is to have the full image programmed, would you not just create a single rbf (combined periph and core?)
Looking further, i see now why you want a separate core image. I do see a use case for multiple fpga images in the fit image though and allowing selecting a configuration as in:
u-boot/doc/uImage.FIT/multi-with-fpga.its
--dalon
Quoted 47 lines
--dalon
Quoted 45 lines
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware- loader
=&fs_loader0", that's for power boot up purpose. After that, generic
firmware loader would go to the dsignated storage as described below to
find the FPGA FIT image according description from above.Quoted 7 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader instance to use ? There's no phandle.
Current firmware loader supports only one instance, that is default instance described in chosen node. It is good enough to solve our problem where to define a default storage for FPGA images and how to tell the SPL to load it from the default storage when the board is powered up. I don't see there is a need to support more than one instance for fpga-mgr during SPL runtime, at least for now. User can program the FPGA with core image from any storage with series of commands such as fatload and socfpga load on U-Boot console.
It is good to improve the firmware loader to support
theDM_FLAG_PRE_RELOC, which allow user to choose different firmware loader node through setting the right sequence number when creating the firmare loader instance in the parent driver such as fpga mgr, but i don't see there is urgency need to be done now.Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ }; + +- Examples for booting with full release, enter user mode withfull bitstream:
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0fpga_mgr: fpga-mgr at ffd03000 { compatible = "altr,socfpga-a10-fpga-mgr";@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
Chee
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 146 lines · Dalon L Westergreen
Quoted 145 lines · Dalon L Westergreen
Quoted 143 lines · Tien Fong
Quoted 122 lines · Marek Vasut
Quoted 114 lines · Tien Fong
Quoted 59 lines · Marek Vasut
Quoted 57 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used
for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO
release
and full release FPGA configuration.
---
.../fpga/altera-socfpga-a10-fpga-mgr.txt | 34
+++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0socfpga-a10-
fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga- a10-
fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties:- The second index is for writing FPGA configuration data.
- resets : Phandle and reset specifier for the device's
reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream
which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL, IO48 andDDR.
This
bitstream is(quoted diff) +3
-0+ required to get DDR up running. + or + File name for full bitstream, consistof
peripheral bitstreamQuoted 8 lines
Quoted 4 lines
(quoted diff) +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name for corebitstream
which containsIs the name of the property 'altr,bitstream-core(optional)' ? I
think
the "optional" part should be in the description.Yes, you are right.
Quoted 36 lines
Quoted 36 lines
(quoted diff) +1
-0+ FPGA design which isused to
program FPGA CRAM(quoted diff) +1
-0+ and ERAM.(quoted diff) +1
-1-Example: +Example: Bundles both peripheral bitstream and corebitstream
into
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT image can becreated
through running(quoted diff) +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
(quoted diff) +3
-0+ fit_spl_fpga.itb + + For details of describing structure andcontents of
the
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter early
user
mode:(quoted diff) +3
-0+ + fpga_mgr: fpga-mgr at ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr";
Quoted 8 lines
Quoted 7 lines
(quoted diff) +6
-0+ reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core ="fit_spl_fpga.itb";
It's the same file, why does it use two properties ?
Quoted 6 lines
1. Allows user to run optional for program core. When "" is set to
altr,bitstream-core, then SPL would skip programming FPGA with
core, so
user can program it later on U-Boot or Linux.Quoted 4 lines
You can just pass in a fitImage with only the periph image in it in
such
a case.What if user want to program the core on U-Boot? User need to create
two FIT images, one FIT with periph image, and another FIT with core
image only.Current implementation supports one FIT image for above configuration.
Quoted 4 lines
Quoted 3 lines
2. Allows core in different FIT file.
Is this really useful ?
Yes, for the use case which support different core image for different
revision of board but using same periph image.
Quoted 10 lines
Quoted 10 lines
I would have to disagree here. This is not a supported flow, the periph image
and core image must come from the same compilation of quartus for arria10 to
guarantee functionality. That is unless something has changed that I am not
aware of? I believe this holds true in S10, the difference being that in s10
you can reconfigure the periph rbf without affecting the processor IO.
That's work when the same design on periph rbf, and different design only on core rbf. So, you can pass in FIT image with static periph rbf at altr,bitstream, then another FIT image just for core rbf only at altr,bitstream-core.
Quoted 7 lines
Quoted 7 lines
Why are there separate fit images for uboot and the fpga? would it not
make sense to combine them into a single fit image? Wouldn't you want to
couple a devicetree and a periph image together and then allow for selection of configurations?
I assume this question is for item 1. Item 1 allows SPL easily skipping the default support core image programming without codes changes, and also keeping both periph and core in one FIT image, so you can program the core image after SPL.
Quoted 4 lines
Quoted 4 lines
I also wonder why there is a need to support core image programming in SPL? If the desire is to have the full image programmed, would you not just create a single rbf (combined periph and core?)
That's is default implementation for SPL to program core, but you can easily change that without code changes and keeping both RBFs in same FIT image as long as item 1 is still there.
There is a big difference in the performance between full image and split rbfs. Full image is programmed into FPGA chunk by chunk on small OCRAM.
The core for split rbfs is programmed into FPGA in one big chunk on DDR.
Quoted 6 lines
Quoted 1 line
Looking further, i see now why you want a separate core image. I do see a use case for multiple fpga images in the fit image though and allowing selecting a configuration as in:
u-boot/doc/uImage.FIT/multi-with-fpga.its
Yes, you can use spl_load_fit_image from common framework to support this.
Quoted 71 lines
--dalon
Quoted 68 lines
--dalon
Quoted 65 lines
Quoted 16 lines
Quoted 16 lines
Quoted 6 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware-
loader
=&fs_loader0", that's for power boot up purpose. After that, generic
firmware loader would go to the dsignated storage as described
below to
find the FPGA FIT image according description from above.Quoted 8 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader
instance to use ? There's no phandle.Current firmware loader supports only one instance, that is default
instance described in chosen node. It is good enough to solve our problem where to define a default storage for FPGA images and how to
tell the SPL to load it from the default storage when the board is
powered up. I don't see there is a need to support more than one instance for fpga-mgr during SPL runtime, at least for now. User can
program the FPGA with core image from any storage with series of commands such as fatload and socfpga load on U-Boot console.It is good to improve the firmware loader to support the
DM_FLAG_PRE_RELOC, which allow user to choose different firmware
loader node through setting the right sequence number when creating the
firmare loader instance in the parent driver such as fpga mgr, but i
don't see there is urgency need to be done now.Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
(quoted diff) +3
-0+ }; + +- Examples for booting with full release, enter usermode with
full bitstream:
fpga_mgr: fpga-mgr atffd03000{ compatible = "altr,socfpga-a10-fpga- mgr";(quoted diff) +1
-0@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
In reply to CheeQuoted 105 lines · Tien Fong
Quoted 104 lines · Marek Vasut
Quoted 103 lines · Tien Fong
Quoted 48 lines · Marek Vasut
Quoted 46 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO release
and full release FPGA configuration.
---
.../fpga/altera-socfpga-a10-fpga-mgr.txt | 34
+++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga- mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga- mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties:- The second index is for writing FPGA configuration data.
- resets : Phandle and reset specifier for the device's reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL, IO48 and DDR.This
bitstream isdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +2
-0+ required to get DDR up running. + orQuoted 8 lines
Quoted 5 lines
(quoted diff) +1
-0+ File name for full bitstream, consist ofperipheral bitstream
(quoted diff) +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name for core bitstreamwhich contains
Is the name of the property 'altr,bitstream-core(optional)' ? I think
the "optional" part should be in the description.Yes, you are right.
Quoted 32 lines
Quoted 32 lines
(quoted diff) +1
-0+ FPGA design which is used toprogram FPGA CRAM
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ and ERAM.(quoted diff) +1
-1-Example: +Example: Bundles both peripheral bitstream and core bitstreaminto
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT image can becreated
through runningdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ fit_spl_fpga.itb + + For details of describing structure and contents ofthe
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter early user
mode:(quoted diff) +2
-0+ + fpga_mgr: fpga-mgr at ffd03000 {Quoted 8 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt Required properties: · line 39
Quoted 7 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +7
-0+ compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb";It's the same file, why does it use two properties ?
1. Allows user to run optional for program core. When "" is set to altr,bitstream-core, then SPL would skip programming FPGA with core, so
user can program it later on U-Boot or Linux.
Quoted 8 lines
Quoted 3 lines
You can just pass in a fitImage with only the periph image in it in such
a case.What if user want to program the core on U-Boot? User need to create two FIT images, one FIT with periph image, and another FIT with core image only.
Current implementation supports one FIT image for above configuration.
What if user want to program the core on U-Boot in this implementation? It is not possible either, is it ?
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
2. Allows core in different FIT file.
Is this really useful ?
Yes, for the use case which support different core image for different revision of board but using same periph image.
Seems you an Dalon are discussing this and it's not a supported flow ?
Quoted 17 lines
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware- loader
=&fs_loader0", that's for power boot up purpose. After that, generic
firmware loader would go to the dsignated storage as described below to
find the FPGA FIT image according description from above.Quoted 7 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader instance to use ? There's no phandle.
Quoted 8 lines
Current firmware loader supports only one instance, that is default instance described in chosen node. It is good enough to solve our problem where to define a default storage for FPGA images and how to tell the SPL to load it from the default storage when the board is powered up. I don't see there is a need to support more than one instance for fpga-mgr during SPL runtime, at least for now. User can program the FPGA with core image from any storage with series of commands such as fatload and socfpga load on U-Boot console.
Since you already have the label for the fs-loader _and_ you have the address for it (fs-loader at 0), you should supply the phandle. And eventually, someone will try to use multiple loaders, so we should do this correctly from the beginning -- by supplying the phandle to the loader node.
Quoted 23 lines
It is good to improve the firmware loader to support
the DM_FLAG_PRE_RELOC, which allow user to choose different firmware loader node through setting the right sequence number when creating the firmare loader instance in the parent driver such as fpga mgr, but i don't see there is urgency need to be done now.Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ }; + +- Examples for booting with full release, enter user mode withfull bitstream:
fpga_mgr: fpga-mgr atffd03000{ compatible = "altr,socfpga-a10-fpga-mgr";doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 138 lines · Marek Vasut
Quoted 137 lines · Tien Fong
Quoted 125 lines · Marek Vasut
Quoted 118 lines · Tien Fong
Quoted 60 lines · Marek Vasut
Quoted 57 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used
for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO
release
and full release FPGA configuration.
---
.../fpga/altera-socfpga-a10-fpga-mgr.txt | 34
+++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0a10-
fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties:- The second index is for writing FPGA configuration data.
- resets : Phandle and reset specifier for the device's
reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL, IO48 andDDR.
This
bitstream isdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ required to get DDR up running. + or + File name for full bitstream, consistof
peripheral bitstreamQuoted 8 lines
Quoted 4 lines
(quoted diff) +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name for corebitstream
which containsIs the name of the property 'altr,bitstream-core(optional)' ? I
think
the "optional" part should be in the description.Yes, you are right.
Quoted 38 lines
Quoted 38 lines
(quoted diff) +1
-0+ FPGA design which isused to
program FPGA CRAMdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0+ and ERAM.(quoted diff) +1
-1-Example: +Example: Bundles both peripheral bitstream and corebitstream
into
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT image can becreated
through runningdoc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ fit_spl_fpga.itb + + For details of describing structure and contentsof
the
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter early
user
mode:(quoted diff) +2
-0+ + fpga_mgr: fpga-mgr at ffd03000 {Quoted 8 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt Required properties: · line 39
Quoted 7 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +7
-0+ compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb";It's the same file, why does it use two properties ?
Quoted 5 lines
1. Allows user to run optional for program core. When "" is set to
altr,bitstream-core, then SPL would skip programming FPGA with core, so
user can program it later on U-Boot or Linux.Quoted 4 lines
You can just pass in a fitImage with only the periph image in it in
such
a case.What if user want to program the core on U-Boot? User need to create
two FIT images, one FIT with periph image, and another FIT with core
image only.
Quoted 5 lines
Quoted 2 lines
Current implementation supports one FIT image for above configuration.
What if user want to program the core on U-Boot in this implementation?
It is not possible either, is it ?
There are few ways user can do:
1. Running commands such as imxtract/fatload with socfpga load
2. Script
3. Env
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
2. Allows core in different FIT file.
Is this really useful ?
Yes, for the use case which support different core image for different
revision of board but using same periph image.Seems you an Dalon are discussing this and it's not a supported flow ?
Dalon has some concerns.
But, we can keep the more flexibility for users by adding support of configuration in fit image, then removing the altr,bitstream-core properties in FPGA manager node. So, users are freely to use this implementation in their own use cases.
So, user need to add the default configuration for FPGA. For property "fpga" = 1st string is for periph.rbf or full rbf.
= 2nd string is for core.rbf. This is optional, no
string is found, the core configuration would be skipped.
= 3rd string onwards would be ignored.
configurations {
default = "config-1";
config-1 {
description = "Boot with FPGA early IO release config";
fpga = "fpga-1", "fpga-2"; <= sequence for bitstream
configuration
};
};Anyway, please bear in mind that multi fpga nodes in one fpga fit image is not good for performance. I have tried few ideas to fix the performance penalty caused by buffer alignment@reading cluster, but it didn't work.
What do you think?
Quoted 33 lines
Quoted 23 lines
Quoted 16 lines
Quoted 16 lines
Quoted 7 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware-
loader
=&fs_loader0", that's for power boot up purpose. After that, generic
firmware loader would go to the dsignated storage as described below to
find the FPGA FIT image according description from above.Quoted 7 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader instance to use ? There's no phandle.
Quoted 10 lines
Current firmware loader supports only one instance, that is default instance described in chosen node. It is good enough to solve our problem where to define a default storage for FPGA images and how to
tell the SPL to load it from the default storage when the board is powered up. I don't see there is a need to support more than one instance for fpga-mgr during SPL runtime, at least for now. User can
program the FPGA with core image from any storage with series of commands such as fatload and socfpga load on U-Boot console.
Quoted 5 lines
Since you already have the label for the fs-loader _and_ you have the address for it (fs-loader at 0), you should supply the phandle. And eventually, someone will try to use multiple loaders, so we should do this correctly from the beginning -- by supplying the phandle to the loader node.
Okay, i will improve firmware loader in separate patch set. Basically, the ideas are for
1. For majority HWs use default storage, defined in console node. (Already supported)
2. For minority HWs use, other than default storage, users should add this property "firmware-loader = <phandle>" to their respective HW nodes. This would enable overwritten of default storage, phandle from console node. (planning to enhance)
3. Enable sequence number(DM_FLAG_PRE_RELOC) support through hard coding. (planning to enhance)
So, the interface is still same for this patch set, using item 1, default storage.
What do you think?
Quoted 34 lines
Quoted 33 lines
It is good to improve the firmware loader to support
the DM_FLAG_PRE_RELOC, which allow user to choose different firmware
loader node through setting the right sequence number when creating the
firmare loader instance in the parent driver such as fpga mgr, but i
don't see there is urgency need to be done now.Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +3
-0+ }; + +- Examples for booting with full release, enter user modewith
full bitstream:
fpga_mgr: fpga-mgr atffd03000{ compatible = "altr,socfpga-a10-fpga-mgr";doc/device-tree-bindings/fpga/altera-socfpga-a10-fpga-mgr.txt +1
-0@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 141 lines · Tien Fong
Quoted 140 lines · Marek Vasut
Quoted 139 lines · Tien Fong
Quoted 125 lines · Marek Vasut
Quoted 118 lines · Tien Fong
Quoted 60 lines · Marek Vasut
Quoted 57 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used
for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO
release
and full release FPGA configuration.
---
.../fpga/altera-socfpga-a10-fpga-mgr.txt | 34
+++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0a10-
fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties:- The second index is for writing FPGA configuration data.
- resets : Phandle and reset specifier for the device's
reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL, IO48 andDDR.
This
bitstream is(quoted diff) +3
-0+ required to get DDR up running. + or + File name for full bitstream, consistof
peripheral bitstreamQuoted 8 lines
Quoted 4 lines
(quoted diff) +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name for corebitstream
which containsIs the name of the property 'altr,bitstream-core(optional)' ? I
think
the "optional" part should be in the description.Yes, you are right.
Quoted 38 lines
Quoted 38 lines
(quoted diff) +1
-0+ FPGA design which isused to
program FPGA CRAM(quoted diff) +1
-0+ and ERAM.(quoted diff) +1
-1-Example: +Example: Bundles both peripheral bitstream and corebitstream
into
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT image can becreated
through running(quoted diff) +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
(quoted diff) +3
-0+ fit_spl_fpga.itb + + For details of describing structure and contentsof
the
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter early
user
mode:(quoted diff) +2
-0+ + fpga_mgr: fpga-mgr at ffd03000 {Quoted 8 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb";It's the same file, why does it use two properties ?
Quoted 5 lines
1. Allows user to run optional for program core. When "" is set to
altr,bitstream-core, then SPL would skip programming FPGA with core, so
user can program it later on U-Boot or Linux.Quoted 4 lines
You can just pass in a fitImage with only the periph image in it in
such
a case.What if user want to program the core on U-Boot? User need to create
two FIT images, one FIT with periph image, and another FIT with core
image only.Current implementation supports one FIT image for above configuration.
Quoted 7 lines
Quoted 3 lines
What if user want to program the core on U-Boot in this implementation?
It is not possible either, is it ?There are few ways user can do:
1. Running commands such as imxtract/fatload with socfpga load
2. Script
3. Env
And how is that different from using a single fitImage with configuration node describing the parts of the bitstream that should be loaded ?
Quoted 20 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
2. Allows core in different FIT file.
Is this really useful ?
Yes, for the use case which support different core image for different
revision of board but using same periph image.Seems you an Dalon are discussing this and it's not a supported flow ?
Dalon has some concerns.
But, we can keep the more flexibility for users by adding support of configuration in fit image, then removing the altr,bitstream-core properties in FPGA manager node. So, users are freely to use this implementation in their own use cases.
So, user need to add the default configuration for FPGA. For property "fpga" = 1st string is for periph.rbf or full rbf.
= 2nd string is for core.rbf. This is optional, no
string is found, the core configuration would be skipped.
= 3rd string onwards would be ignored.
Quoted 8 lines
configurations {
default = "config-1";
config-1 {
description = "Boot with FPGA early IO release config";
fpga = "fpga-1", "fpga-2"; <= sequence for bitstream
configuration
};
};I want to be able to do something like
configuration {
...
config-board1 {
...
fpga = "fpga-core1";
};
config-board2 {
...
fpga = "fpga-core2", "fpga-periph2";
};
};Does this make sense ?
Dalon, is this mix-and-match approach to bitstreams something we want to support at all ? It seems a bit dangerous to me.
Quoted 6 lines
Anyway, please bear in mind that multi fpga nodes in one fpga fit image is not good for performance. I have tried few ideas to fix the performance penalty caused by buffer alignment at reading cluster, but it didn't work.
What do you think?
I think if there is a performance penalty when loading file from VFAT, it is VFAT code or SD/MMC driver that needs fixing. We definitely can not hack it up by realigning fitImage to magically work around that.
Quoted 38 lines
Quoted 33 lines
Quoted 23 lines
Quoted 16 lines
Quoted 16 lines
Quoted 7 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware-
loader
=&fs_loader0", that's for power boot up purpose. After that, generic
firmware loader would go to the dsignated storage as described below to
find the FPGA FIT image according description from above.Quoted 7 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader instance to use ? There's no phandle.
Quoted 10 lines
Current firmware loader supports only one instance, that is default instance described in chosen node. It is good enough to solve our problem where to define a default storage for FPGA images and how to
tell the SPL to load it from the default storage when the board is powered up. I don't see there is a need to support more than one instance for fpga-mgr during SPL runtime, at least for now. User can
program the FPGA with core image from any storage with series of commands such as fatload and socfpga load on U-Boot console.Quoted 5 lines
Since you already have the label for the fs-loader _and_ you have the address for it (fs-loader at 0), you should supply the phandle. And eventually, someone will try to use multiple loaders, so we should do this correctly from the beginning -- by supplying the phandle to the loader node.
Quoted 4 lines
Okay, i will improve firmware loader in separate patch set. Basically, the ideas are for
1. For majority HWs use default storage, defined in console node. (Already supported)
I'm not sure I understand this point, default storage in console node ?
Quoted 6 lines
2. For minority HWs use, other than default storage, users should add this property "firmware-loader = <phandle>" to their respective HW nodes. This would enable overwritten of default storage, phandle from console node. (planning to enhance)
3. Enable sequencenumber(DM_FLAG_PRE_RELOC)support through hard coding. (planning to enhance)
Why do we want to hard-code anything ?
Quoted 37 lines
So, the interface is still same for this patch set, using item 1, default storage.
What do you think?
Quoted 33 lines
Quoted 33 lines
It is good to improve the firmware loader to support
the DM_FLAG_PRE_RELOC, which allow user to choose different firmware
loader node through setting the right sequence number when creating the
firmare loader instance in the parent driver such as fpga mgr, but i
don't see there is urgency need to be done now.Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
(quoted diff) +3
-0+ }; + +- Examples for booting with full release, enter user modewith
full bitstream:
fpga_mgr: fpga-mgr atffd03000{ compatible = "altr,socfpga-a10-fpga-mgr";(quoted diff) +1
-0@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
Signature · 2 lines
Best regards, Marek Vasut
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 184 lines · Marek Vasut
Quoted 129 lines · Tien Fong
Quoted 128 lines · Marek Vasut
Quoted 127 lines · Tien Fong
Quoted 114 lines · Marek Vasut
Quoted 108 lines · Tien Fong
Quoted 56 lines · Marek Vasut
Quoted 55 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name used
for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Provided example of setting FPGA FIT image for both early IO
release
and full release FPGA configuration.--- .../fpga/altera-socfpga-a10-fpga-mgr.txt | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0a10-
fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties: - The second index is for writing FPGAconfiguration data.
- resets : Phandle and reset specifier for the
device's
reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL, IO48 andDDR.
This
bitstream is(quoted diff) +3
-0+ required to get DDR up running. + or + File name for full bitstream, consistof
peripheral bitstreamQuoted 8 lines
Quoted 4 lines
(quoted diff) +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name for corebitstream
which containsIs the name of the property 'altr,bitstream-core(optional)' ? I
think
the "optional" part should be in the description.Yes, you are right.
Quoted 34 lines
Quoted 34 lines
(quoted diff) +1
-0+ FPGA design which isused to
program FPGA CRAM(quoted diff) +2
-1+ and ERAM. -Example: +Example: Bundles both peripheral bitstream and corebitstream
into
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT image can becreated
through running(quoted diff) +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
(quoted diff) +3
-0+ fit_spl_fpga.itb + + For details of describing structure and contentsof
the
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter early
user
mode:(quoted diff) +2
-0+ + fpga_mgr: fpga-mgr at ffd03000 {Quoted 8 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ compatible = "altr,socfpga-a10-fpga-mgr"; + reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb";It's the same file, why does it use two properties ?
Quoted 5 lines
1. Allows user to run optional for program core. When "" is set to
altr,bitstream-core, then SPL would skip programming FPGA with core, so
user can program it later on U-Boot or Linux.Quoted 4 lines
You can just pass in a fitImage with only the periph image in it in
such
a case.What if user want to program the core on U-Boot? User need to create
two FIT images, one FIT with periph image, and another FIT with core
image only.Current implementation supports one FIT image for above configuration.
Quoted 7 lines
Quoted 3 lines
What if user want to program the core on U-Boot in this implementation?
It is not possible either, is it ?There are few ways user can do:
1. Running commands such as imxtract/fatload with socfpga load
2. Script
3. EnvAnd how is that different from using a single fitImage with configuration node describing the parts of the bitstream that should be loaded ?
Quoted 20 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
2. Allows core in different FIT file.
Is this really useful ?
Yes, for the use case which support different core image for different
revision of board but using same periph image.Seems you an Dalon are discussing this and it's not a supported flow ?
Dalon has some concerns.
But, we can keep the more flexibility for users by adding support of configuration in fit image, then removing the altr,bitstream-core properties in FPGA manager node. So, users are freely to use this implementation in their own use cases.
So, user need to add the default configuration for FPGA. For property "fpga" = 1st string is for periph.rbf or full rbf.
= 2nd string is for core.rbf. This is optional, no
string is found, the core configuration would be skipped.
= 3rd string onwards would be ignored.Quoted 8 lines
configurations { default = "config-1"; config-1 { description = "Boot with FPGA early IO release config"; fpga = "fpga-1", "fpga-2"; <= sequence for bitstream configuration }; };I want to be able to do something like
configuration { ... config-board1 { ... fpga = "fpga-core1"; }; config-board2 { ... fpga = "fpga-core2", "fpga-periph2"; }; };
Quoted 4 lines
Does this make sense ?
Dalon, is this mix-and-match approach to bitstreams something we want to support at all ? It seems a bit dangerous to me.
We definitely do not want to support using different core images with a single periph image. That said, i would like to see a single fit image have multiple fpga images with the goal of allowing board specific code to do a select on the config much like is supported now in devicetrees, I believe.
Quoted 10 lines
Quoted 6 lines
Anyway, please bear in mind that multi fpga nodes in one fpga fit image is not good for performance. I have tried few ideas to fix the performance penalty caused by buffer alignment at reading cluster, but it didn't work.
What do you think?
I think if there is a performance penalty when loading file from VFAT, it is VFAT code or SD/MMC driver that needs fixing. We definitely can not hack it up by realigning fitImage to magically work around that.
I agree. Let the performance fall where is may. The VFAT or SD/MMC code should be fixed. If the alignment in the fitimage happens to work out, then great.
Until the issue fixed, users can easily configure the core FPGA using a u-boot script or in linux.
--dalon
Quoted 76 lines
Quoted 33 lines
Quoted 28 lines
Quoted 18 lines
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware-
loader
=&fs_loader0", that's for power boot up purpose. After that, generic
firmware loader would go to the dsignated storage as described below to
find the FPGA FIT image according description from above.Quoted 7 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader instance to use ? There's no phandle.
Quoted 10 lines
Current firmware loader supports only one instance, that is default instance described in chosen node. It is good enough to solve our problem where to define a default storage for FPGA images and how to
tell the SPL to load it from the default storage when the board is powered up. I don't see there is a need to support more than one instance for fpga-mgr during SPL runtime, at least for now. User can
program the FPGA with core image from any storage with series of commands such as fatload and socfpga load on U-Boot console.Quoted 5 lines
Since you already have the label for the fs-loader _and_ you have the address for it (fs-loader at 0), you should supply the phandle. And eventually, someone will try to use multiple loaders, so we should do this correctly from the beginning -- by supplying the phandle to the loader node.
Quoted 4 lines
Okay, i will improve firmware loader in separate patch set. Basically, the ideas are for
1. For majority HWs use default storage, defined in console node. (Already supported)I'm not sure I understand this point, default storage in console node ?
Quoted 6 lines
2. For minority HWs use, other than default storage, users should add this property "firmware-loader = <phandle>" to their respective HW nodes. This would enable overwritten of default storage, phandle from console node. (planning to enhance)
3. Enable sequencenumber(DM_FLAG_PRE_RELOC)support through hard coding. (planning to enhance)Why do we want to hard-code anything ?
Quoted 27 lines
So, the interface is still same for this patch set, using item 1, default storage.
What do you think?
Quoted 23 lines
Quoted 23 lines
It is good to improve the firmware loader to support
theDM_FLAG_PRE_RELOC, which allow user to choose different firmware
loader node through setting the right sequence number when creating the
firmare loader instance in the parent driver such as fpga mgr, but i
don't see there is urgency need to be done now.Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
(quoted diff) +3
-0+ }; + +- Examples for booting with full release, enter user modewith
full bitstream:(quoted diff) +1
-0fpga_mgr: fpga-mgr at ffd03000 { compatible = "altr,socfpga-a10-fpga-mgr";@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
Chee
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
In reply to Marek VasutQuoted 172 lines · Marek Vasut
Quoted 171 lines · Tien Fong
Quoted 169 lines · Marek Vasut
Quoted 156 lines · Tien Fong
Quoted 148 lines · Marek Vasut
Quoted 138 lines · Tien Fong
Quoted 72 lines · Marek Vasut
Quoted 68 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name
used
for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]Quoted 1 line
---
changes for v7
- Provided example of setting FPGA FIT image for both early
IO
release
and full release FPGA configuration.
---
.../fpga/altera-socfpga-a10-fpga-mgr.txt | 34
+++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0socfpga-
a10-
fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga- a10-
fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties:- The second index is for writing FPGA configuration data.
- resets : Phandle and reset specifier for the device's
reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral bitstream
which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL, IO48and
DDR.
This
bitstream is(quoted diff) +3
-0+ required to get DDR up running. + or + File name for full bitstream,consist
of
peripheral bitstream(quoted diff) +1
-0+ and core bitstream.Quoted 8 lines
Quoted 3 lines
+- altr,bitstream-core(optional) : File name for core bitstream
which containsIs the name of the property 'altr,bitstream-
core(optional)' ?
I
think
the "optional" part should be in the description.Yes, you are right.
Quoted 45 lines
Quoted 45 lines
(quoted diff) +1
-0+ FPGA design which isused to
program FPGA CRAM(quoted diff) +1
-0+ and ERAM.(quoted diff) +1
-1-Example: +Example: Bundles both peripheral bitstream and corebitstream
into
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT image canbe
created
through running(quoted diff) +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
(quoted diff) +3
-0+ fit_spl_fpga.itb + + For details of describing structure andcontents
of
the
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter
early
user
mode:(quoted diff) +3
-0+ + fpga_mgr: fpga-mgr at ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr";
Quoted 8 lines
Quoted 7 lines
(quoted diff) +6
-0+ reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core ="fit_spl_fpga.itb";
It's the same file, why does it use two properties ?
Quoted 7 lines
1. Allows user to run optional for program core. When "" is set
to
altr,bitstream-core, then SPL would skip programming FPGA with
core, so
user can program it later on U-Boot or Linux.Quoted 5 lines
You can just pass in a fitImage with only the periph image in it
in
such
a case.Quoted 8 lines
What if user want to program the core on U-Boot? User need to create
two FIT images, one FIT with periph image, and another FIT with core
image only.Current implementation supports one FIT image for above configuration.
What if user want to program the core on U-Boot in this implementation?
It is not possible either, is it ?
Quoted 8 lines
Quoted 4 lines
There are few ways user can do:
1. Running commands such as imxtract/fatload with socfpga load
2. Script
3. EnvAnd how is that different from using a single fitImage with configuration node describing the parts of the bitstream that should be
loaded ?
Please correct me if my answer doesn't match your question.
In previous implementation, fpga-1 must be periph.rbf, and fpga-2 must always be core.rbf. If altr,bitstream-core is not defined, then SPL would skip the core configuration. If user want to program core on U- Boot, then user need to extract the fpga-2 and program it.
Current proposal, altr,bitstream-core would be removed, and this would replaced by the rule of describing sequence of the fpga strings set in the fpga property in fitImage with configuration.
For property "fpga" = 1st string is for periph.rbf or full rbf.> >
= 2nd string is for core.rbf. This is optional,
no> > string is found, the core configuration would be skipped.> > = 3rd string onwards would be ignored.> >
For example, if user want to program periph.rbf or full rbf, user can describe the fpga sequence as below
configurations {
default = "config-1";
config-1 {
fpga = "fpga-1"; <=perih.rbf or full rbf
};};
if user want to program periph.rbf and core.rbf in SPL
configurations {
default = "config-1";
config-1 {fpga = "fpga-1", "fpga-2"; };
};
if user want to program periph.rbf in spl, but core.rbf in U-Boot
configurations {
default = "config-1";
config-1 {
fpga = "fpga-1"; <=perih.rbf
};
config-2 {
fpga = "fpga-1", "fpga-2";
};};
So for core.rbf, user need to look the config-2, then extract the fpga- 2 from few ways described above.
Quoted 49 lines
Quoted 28 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
2. Allows core in different FIT file.
Is this really useful ?
Yes, for the use case which support different core image for different
revision of board but using same periph image.Seems you an Dalon are discussing this and it's not a supported flow
?Dalon has some concerns.
But, we can keep the more flexibility for users by adding support of
configuration in fit image, then removing the altr,bitstream-core properties in FPGA manager node. So, users are freely to use this implementation in their own use cases.So, user need to add the default configuration for FPGA. For property "fpga" = 1st string is for periph.rbf or full rbf.
= 2nd string is for core.rbf. This is optional, no
string is found, the core configuration would be skipped.
= 3rd string onwards would be ignored.Quoted 8 lines
configurations { default = "config-1"; config-1 { description = "Boot with FPGA early IO release config"; fpga = "fpga-1", "fpga-2"; <= sequence for bitstream configuration }; };I want to be able to do something like
configuration { ... config-board1 { ... fpga = "fpga-core1"; }; config-board2 { ... fpga = "fpga-core2", "fpga-periph2"; }; };
Quoted 1 line
Does this make sense ?
1. How user can tell the SPL which config if there is no default property described?
2. You want the code to recognize the string "fpga-core" for core.rbf and "fpga-periph" for periph.rbf?
3. What's your concern with the 1st and 2nd string represent periph.rbf and core.rbf respectively?
Quoted 13 lines
Dalon, is this mix-and-match approach to bitstreams something we want to
support at all ? It seems a bit dangerous to me.Quoted 8 lines
Anyway, please bear in mind that multi fpga nodes in one fpga fit image
is not good for performance. I have tried few ideas to fix the performance penalty caused by buffer alignment at reading cluster, but
it didn't work.
Quoted 5 lines
Quoted 1 line
What do you think?
I think if there is a performance penalty when loading file from VFAT,
it is VFAT code or SD/MMC driver that needs fixing. We definitely can not hack it up by realigning fitImage to magically work around that.
Please see my replied in patch 2/7
Quoted 58 lines
Quoted 58 lines
Quoted 58 lines
Quoted 42 lines
Quoted 25 lines
Quoted 25 lines
Quoted 12 lines
Quoted 2 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware-
loader
=&fs_loader0", that's for power boot up purpose. After that,
generic
firmware loader would go to the dsignated storage as described
below to
find the FPGA FIT image according description from above.Quoted 8 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader
instance to use ? There's no phandle.Current firmware loader supports only one instance, that is default
instance described in chosen node. It is good enough to solve our
problem where to define a default storage for FPGA images and how
to
tell the SPL to load it from the default storage when the board isQuoted 8 lines
powered up. I don't see there is a need to support more than one
instance for fpga-mgr during SPL runtime, at least for now. User
can
program the FPGA with core image from any storage with series of
commands such as fatload and socfpga load on U-Boot console.Since you already have the label for the fs-loader _and_ you have the
address for it (fs-loader at 0), you should supply the phandle. And eventually, someone will try to use multiple loaders, so we should do
this correctly from the beginning -- by supplying the phandle to the
loader node.
Quoted 6 lines
Quoted 4 lines
Okay, i will improve firmware loader in separate patch set. Basically, the ideas are for
1. For majority HWs use default storage, defined in console node. (Already supported)I'm not sure I understand this point, default storage in console node ?
For example, we have 5 fpga manager nodes.
fpga_mgr1, fpga_mgr2, fpga_mgr3, and fpga_mgr4 are using sdmmc as storage, so we can define sdmmc as default storage in console node instead of setting phandle to each of fpga_mgr nodes.
Let say fpga_mgr5 is using QSPI, then we can set "firmware-loader = <phandle>" to fpga_mgr5.
Quoted 11 lines
Quoted 10 lines
2. For minority HWs use, other than default storage, users should add
this property "firmware-loader = <phandle>" to their respective HW nodes. This would enable overwritten of default storage, phandle from
console node. (planning to enhance)
3. Enable sequencenumber(DM_FLAG_PRE_RELOC)support through hard coding. (planning to enhance)Why do we want to hard-code anything ?
The purpose here is to support the feature of DM_FLAG_PRE_RELOC. One of the use case i think of searching the file such as u-boot.img in every storage supported in firmware loader. I have no strong opinion for item 3, we can support it in later when it is needed.
Quoted 50 lines
Quoted 49 lines
So, the interface is still same for this patch set, using item 1, default storage.
What do you think?
Quoted 43 lines
Quoted 43 lines
It is good to improve the firmware loader to support the DM_FLAG_PRE_RELOC, which allow user to choose different firmware
loader node through setting the right sequence number when creating
the
firmare loader instance in the parent driver such as fpga mgr, but
i
don't see there is urgency need to be done now.Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
(quoted diff) +3
-0+ }; + +- Examples for booting with full release, enter usermode
with
full bitstream:
fpga_mgr: fpga-mgr atffd03000{ compatible = "altr,socfpga-a10-fpga- mgr";(quoted diff) +1
-0@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
Westergreen
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 217 lines · Tien Fong
Quoted 162 lines · Marek Vasut
Quoted 161 lines · Tien Fong
Quoted 160 lines · Marek Vasut
Quoted 148 lines · Tien Fong
Quoted 141 lines · Marek Vasut
Quoted 132 lines · Tien Fong
Quoted 69 lines · Marek Vasut
Quoted 66 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about file name
used
for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <[email protected]---
changes for v7
- Provided example of setting FPGA FIT image for both early
IO
release
and full release FPGA configuration.
---
.../fpga/altera-socfpga-a10-fpga-mgr.txt|
34
+++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0socfpga-
a10-
fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera-socfpga- a10-
fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga-a10- fpga-
mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties: - The second index is for writing FPGAconfiguration data.
- resets : Phandle and reset specifier for the
device's
reset.
- clocks : Clocks used by the device.
+- altr,bitstream : File name for FPGA peripheral
bitstream
which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL, IO48and
DDR.
This
bitstream is(quoted diff) +3
-0+ required to get DDR up running. + or + File name for full bitstream,consist
of
peripheral bitstream(quoted diff) +1
-0+ and core bitstream.Quoted 8 lines
Quoted 3 lines
+- altr,bitstream-core(optional) : File name for core bitstream
which containsIs the name of the property 'altr,bitstream-
core(optional)' ?
I
think
the "optional" part should be in the description.Yes, you are right.
Quoted 43 lines
Quoted 43 lines
(quoted diff) +1
-0+ FPGA design which isused to
program FPGA CRAM(quoted diff) +2
-1+ and ERAM. -Example: +Example: Bundles both peripheral bitstream and corebitstream
into
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT image canbe
created
through running(quoted diff) +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
(quoted diff) +3
-0+ fit_spl_fpga.itb + + For details of describing structure andcontents
of
the
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter
early
user
mode:(quoted diff) +3
-0+ + fpga_mgr: fpga-mgr at ffd03000 { + compatible = "altr,socfpga-a10-fpga-mgr";
Quoted 8 lines
Quoted 7 lines
(quoted diff) +6
-0+ reg = <0xffd03000 0x100 + 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core ="fit_spl_fpga.itb";
It's the same file, why does it use two properties ?
Quoted 7 lines
1. Allows user to run optional for program core. When "" is set
to
altr,bitstream-core, then SPL would skip programming FPGA with
core, so
user can program it later on U-Boot or Linux.Quoted 5 lines
You can just pass in a fitImage with only the periph image in it
in
such
a case.Quoted 8 lines
What if user want to program the core on U-Boot? User need to create
two FIT images, one FIT with periph image, and another FIT with core
image only.Current implementation supports one FIT image for above configuration.
What if user want to program the core on U-Boot in this implementation?
It is not possible either, is it ?Quoted 8 lines
Quoted 4 lines
There are few ways user can do:
1. Running commands such as imxtract/fatload with socfpga load
2. Script
3. EnvAnd how is that different from using a single fitImage with configuration node describing the parts of the bitstream that should be
loaded ?Please correct me if my answer doesn't match your question.
In previous implementation, fpga-1 must be periph.rbf, and fpga-2 must always be core.rbf. If altr,bitstream-core is not defined, then SPL would skip the core configuration. If user want to program core on U- Boot, then user need to extract the fpga-2 and program it.
Current proposal, altr,bitstream-core would be removed, and this would replaced by the rule of describing sequence of the fpga strings set in the fpga property in fitImage with configuration.
For property "fpga" = 1st string is for periph.rbf or full rbf.> >
= 2nd string is for core.rbf. This is optional,
no> > string is found, the core configuration would be skipped.> >
= 3rd string onwards would be ignored.> >For example, if user want to program periph.rbf or full rbf, user can describe the fpga sequence as below
configurations { default = "config-1"; config-1 { fpga = "fpga-1"; <=perih.rbf or full rbf };};
if user want to program periph.rbf and core.rbf in SPL
configurations { default = "config-1"; config-1 {fpga = "fpga-1", "fpga-2"; };};
if user want to program periph.rbf in spl, but core.rbf in U-Boot
configurations { default = "config-1"; config-1 { fpga = "fpga-1"; <=perih.rbf }; config-2 { fpga = "fpga-1", "fpga-2"; };
Quoted 4 lines
};
So for core.rbf, user need to look the config-2, then extract the fpga- 2 from few ways described above.
Or, store the core rbf outside of the fit image, no?
my preference for the fit image would be
...
images {
fpga at 1 {
description = "FPGA Periph";
...
type = "fpga_periph";
...
}
fpga at 2 {
description = "FPGA Core";
...
type = "fpga" or
"fpga_core";
... }
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga at 1"; // periph only
};
config at 2 {
fpga = "fpga at 1", "fpga at 2"; };
};
with the expectation that the order of fpga at 1 and fpga at 2 in config at 2 is not relevant. the code should find the fpga_periph type and program it first. just my comment, i dont like rellying on the order or name.
--dalon
Quoted 178 lines
Quoted 43 lines
Quoted 22 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
2. Allows core in different FIT file.
Is this really useful ?
Yes, for the use case which support different core image for different
revision of board but using same periph image.Seems you an Dalon are discussing this and it's not a supported flow
?Dalon has some concerns.
But, we can keep the more flexibility for users by adding support of
configuration in fit image, then removing the altr,bitstream-core properties in FPGA manager node. So, users are freely to use this implementation in their own use cases.So, user need to add the default configuration for FPGA. For property "fpga" = 1st string is for periph.rbf or full rbf.
= 2nd string is for core.rbf. This is optional, no
string is found, the core configuration would be skipped.
= 3rd string onwards would be ignored.Quoted 8 lines
configurations { default = "config-1"; config-1 { description = "Boot with FPGA early IO release config"; fpga = "fpga-1", "fpga-2"; <= sequence for bitstream configuration }; };I want to be able to do something like
configuration { ... config-board1 { ... fpga = "fpga-core1"; }; config-board2 { ... fpga = "fpga-core2", "fpga-periph2"; }; };Quoted 1 line
Does this make sense ?
1. How user can tell the SPL which config if there is no default property described?
2. You want the code to recognize the string "fpga-core" for core.rbf and "fpga-periph" for periph.rbf?
3. What's your concern with the 1st and 2nd string represent periph.rbf and core.rbf respectively?
Quoted 11 lines
Dalon, is this mix-and-match approach to bitstreams something we want to
support at all ? It seems a bit dangerous to me.Quoted 7 lines
Anyway, please bear in mind that multi fpga nodes in one fpga fit image
is not good for performance. I have tried few ideas to fix the performance penalty caused by buffer alignment at reading cluster, but
it didn't work.Quoted 5 lines
Quoted 1 line
What do you think?
I think if there is a performance penalty when loading file from VFAT,
it is VFAT code or SD/MMC driver that needs fixing. We definitely can not hack it up by realigning fitImage to magically work around that.Please see my replied in patch 2/7
Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
Quoted 35 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware-
loader
=&fs_loader0", that's for power boot up purpose. After that,
generic
firmware loader would go to the dsignated storage as described
below to
find the FPGA FIT image according description from above.Quoted 8 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader
instance to use ? There's no phandle.Current firmware loader supports only one instance, that is default
instance described in chosen node. It is good enough to solve our
problem where to define a default storage for FPGA images and how
to
tell the SPL to load it from the default storage when the board isQuoted 8 lines
powered up. I don't see there is a need to support more than one
instance for fpga-mgr during SPL runtime, at least for now. User
can
program the FPGA with core image from any storage with series of
commands such as fatload and socfpga load on U-Boot console.Since you already have the label for the fs-loader _and_ you have the
address for it (fs-loader at 0), you should supply the phandle. And eventually, someone will try to use multiple loaders, so we should do
this correctly from the beginning -- by supplying the phandle to the
loader node.Quoted 6 lines
Quoted 4 lines
Okay, i will improve firmware loader in separate patch set. Basically, the ideas are for
1. For majority HWs use default storage, defined in console node. (Already supported)I'm not sure I understand this point, default storage in console node ?
For example, we have 5 fpga manager nodes.
fpga_mgr1,fpga_mgr2,fpga_mgr3, andfpga_mgr4are using sdmmc as storage, so we can define sdmmc as default storage in console node instead of setting phandle to each offpga_mgrnodes.Let say
fpga_mgr5is using QSPI, then we can set "firmware-loader = <phandle>" tofpga_mgr5.Quoted 9 lines
Quoted 8 lines
2. For minority HWs use, other than default storage, users should add
this property "firmware-loader = <phandle>" to their respective HW nodes. This would enable overwritten of default storage, phandle from
console node. (planning to enhance)
3. Enable sequencenumber(DM_FLAG_PRE_RELOC)support through hard coding. (planning to enhance)Why do we want to hard-code anything ?
The purpose here is to support the feature of
DM_FLAG_PRE_RELOC. One of the use case i think of searching the file such as u-boot.img in every storage supported in firmware loader. I have no strong opinion for item 3, we can support it in later when it is needed.Quoted 31 lines
Quoted 31 lines
So, the interface is still same for this patch set, using item 1, default storage.
What do you think?
Quoted 27 lines
Quoted 27 lines
It is good to improve the firmware loader to support the
DM_FLAG_PRE_RELOC, which allow user to choose different firmware
loader node through setting the right sequence number when creating
the
firmare loader instance in the parent driver such as fpga mgr, but
i
don't see there is urgency need to be done now.Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
(quoted diff) +3
-0+ }; + +- Examples for booting with full release, enter usermode
with
full bitstream:
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Review Example: · line 51
Quoted 10 lines
(quoted diff) +0
-0fpga_mgr: fpga-mgr at ffd03000 { compatible = "altr,socfpga-a10-fpga-mgr";
(quoted diff) +1
-0@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb"; };
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3282 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190211/b9a38969/attachment.bin>
Chee
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 278 lines · Dalon
Quoted 256 lines · Tien Fong
Quoted 196 lines · Marek Vasut
Quoted 187 lines · Tien Fong
Quoted 185 lines · Marek Vasut
Quoted 183 lines · Tien Fong
Quoted 164 lines · Marek Vasut
Quoted 152 lines · Tien Fong
Quoted 81 lines · Marek Vasut
Quoted 77 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
This patch adds description on properties about
file
name
used
for
both
peripheral bitstream and core bitstream.Signed-off-by Tien Fong Chee <tien.fong.chee@intel.com
---
changes for v7
- Provided example of setting FPGA FIT image for
both
early
IO
release
and full release FPGA configuration.
---
.../fpga/altera-socfpga-a10-fpga-
mgr.txt |
34
+++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)(quoted diff) +0
-0socfpga-
a10-
fpga-
mgr.txt b/doc/device-tree-bindings/fpga/altera- socfpga-
a10-
fpga-
mgr.txt
index 2fd8e7a..5f81a32 100644
--- a/doc/device-tree-bindings/fpga/altera-socfpga- a10-
fpga-
mgr.txt
+++ b/doc/device-tree-bindings/fpga/altera-socfpga- a10-
fpga-
mgr.txt(quoted diff) +0
-0@@ -7,8 +7,39 @@ Required properties:- The second index is for writing FPGA
configuration data.
- resets : Phandle and reset specifier for the device's
reset.
- clocks : Clocks used by the device. +- altr,bitstream : File name for FPGA peripheral bitstream
which
is used(quoted diff) +1
-0+ to initialize FPGA IOs, PLL,IO48
and
DDR.
This
bitstream is(quoted diff) +3
-0+ required to get DDR up running. + or + File name for full bitstream,consist
of
peripheral bitstream(quoted diff) +2
-0+ and core bitstream. +- altr,bitstream-core(optional) : File name forQuoted 8 lines
Quoted 3 lines
core
bitstream
which containsIs the name of the property 'altr,bitstream-
core(optional)' ?
I
think
the "optional" part should be in the description.Yes, you are right.
Quoted 50 lines
Quoted 50 lines
(quoted diff) +1
-0+ FPGA designwhich is
used to
program FPGA CRAM(quoted diff) +1
-0+ and ERAM.(quoted diff) +1
-1-Example: +Example: Bundles both peripheral bitstream andcore
bitstream
into
FIT image(quoted diff) +1
-0+ called fit_spl_fpga.itb. This FIT imagecan
be
created
through running(quoted diff) +3
-0+ this command: tools/mkimage + -E -p 400 + -f board/altera/arria10-socdk/fit_spl_fpga.its
(quoted diff) +3
-0+ fit_spl_fpga.itb + + For details of describing structure andcontents
of
the
FIT image,(quoted diff) +1
-0+ please refer board/altera/arria10-socdk/fit_spl_fpga.its
+
+- Examples for booting with early IO release, and enter
early
user
mode:(quoted diff) +3
-0+ + fpga_mgr: fpga-mgr at ffd03000 { + compatible = "altr,socfpga-a10-fpga-
mgr";(quoted diff) +1
-0+ reg = <0xffd03000 0x100Quoted 8 lines
Quoted 7 lines
(quoted diff) +4
-0+ 0xffcfe400 0x20>; + clocks = <&l4_mp_clk>; + resets = <&rst FPGAMGR_RESET>; + altr,bitstream ="fit_spl_fpga.itb";
(quoted diff) +1
-0+ altr,bitstream-core ="fit_spl_fpga.itb";
It's the same file, why does it use two properties ?
Quoted 9 lines
1. Allows user to run optional for program core. When "" is
set
to
altr,bitstream-core, then SPL would skip programming FPGA
with
core, so
user can program it later on U-Boot or Linux.Quoted 6 lines
You can just pass in a fitImage with only the periph image in
it
in
such
a case.What if user want to program the core on U-Boot? User need to
create
two FIT images, one FIT with periph image, and another FIT with
core
image only.Current implementation supports one FIT image for above configuration.
Quoted 7 lines
Quoted 3 lines
What if user want to program the core on U-Boot in this implementation?
It is not possible either, is it ?There are few ways user can do:
1. Running commands such as imxtract/fatload with socfpga load
2. Script
3. EnvQuoted 5 lines
And how is that different from using a single fitImage with configuration node describing the parts of the bitstream that should
be
loaded ?Please correct me if my answer doesn't match your question.
In previous implementation, fpga-1 must be periph.rbf, and fpga-2 must
always be core.rbf. If altr,bitstream-core is not defined, then SPL would skip the core configuration. If user want to program core on U-
Boot, then user need to extract the fpga-2 and program it.Current proposal, altr,bitstream-core would be removed, and this would
replaced by the rule of describing sequence of the fpga strings set in
the fpga property in fitImage with configuration.For property "fpga" = 1st string is for periph.rbf or full rbf.> >
= 2nd string is for core.rbf. This is optional,
no> > string is found, the core configuration would be skipped.>Quoted 1 line
= 3rd string onwards would be ignored.> >
For example, if user want to program periph.rbf or full rbf, user can
describe the fpga sequence as belowconfigurations { default = "config-1"; config-1 { fpga = "fpga-1"; <=perih.rbf or full rbf };};
if user want to program periph.rbf and core.rbf in SPL
configurations { default = "config-1"; config-1 {fpga = "fpga-1", "fpga-2"; };};
if user want to program periph.rbf in spl, but core.rbf in U-Boot
configurations { default = "config-1"; config-1 { fpga = "fpga-1"; <=perih.rbf }; config-2 { fpga = "fpga-1", "fpga-2"; };Quoted 5 lines
};
So for core.rbf, user need to look the config-2, then extract the fpga-
2 from few ways described above.Or, store the core rbf outside of the fit image, no?
my preference for the fit image would be
...
images {fpga at 1 { description = "FPGA Periph"; ... type = "fpga_periph"; ... } fpga at 2 { description = "FPGA Core"; ... type = "fpga" or
Quoted 1 line
"
fpga_core";
I'm good with "fpga".
Quoted 13 lines
...}
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga at 1"; // periph only
};
config at 2 {
fpga = "fpga at 1", "fpga at 2";
};
};
Quoted 5 lines
with the expectation that the order of fpga at 1 and fpga at 2 in config at 2 is not relevant. the code should find the
fpga_periphtype and program
it first. just my comment, i dont like rellying on the order or name.
I can add support for above implementation although this adds more complexity to the driver.
Marek, are you OK with this implementation?
Quoted 257 lines
--dalon
Quoted 253 lines
Quoted 58 lines
Quoted 35 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
2. Allows core in different FIT file.
Is this really useful ?
Quoted 8 lines
Quoted 4 lines
Yes, for the use case which support different core image for
different
revision of board but using same periph image.Seems you an Dalon are discussing this and it's not a supported
flow
?Dalon has some concerns.
But, we can keep the more flexibility for users by adding support
of
configuration in fit image, then removing the altr,bitstream- core
properties in FPGA manager node. So, users are freely to use this
implementation in their own use cases.So, user need to add the default configuration for FPGA. For property "fpga" = 1st string is for periph.rbf or full rbf.
= 2nd string is for core.rbf. This is
optional, no
string is found, the core configuration would be skipped. = 3rd string onwards would be ignored.Quoted 10 lines
configurations { default = "config-1"; config-1 { description = "Boot with FPGA early IO release config"; fpga = "fpga-1", "fpga-2"; <= sequence for bitstream configuration }; };I want to be able to do something like
configuration { ... config-board1 { ... fpga = "fpga-core1"; }; config-board2 { ... fpga = "fpga-core2", "fpga-periph2"; }; };Quoted 1 line
Does this make sense ?
1. How user can tell the SPL which config if there is no default property described?
2. You want the code to recognize the string "fpga-core" for core.rbf
and "fpga-periph" for periph.rbf?3. What's your concern with the 1st and 2nd string represent periph.rbf
and core.rbf respectively?Quoted 16 lines
Dalon, is this mix-and-match approach to bitstreams something we want
to
support at all ? It seems a bit dangerous to me.Quoted 10 lines
Anyway, please bear in mind that multi fpga nodes in one fpga fit
image
is not good for performance. I have tried few ideas to fix the performance penalty caused by buffer alignment at reading cluster,
but
it didn't work.Quoted 7 lines
Quoted 1 line
What do you think?
I think if there is a performance penalty when loading file from VFAT,
it is VFAT code or SD/MMC driver that needs fixing. We definitely can
not hack it up by realigning fitImage to magically work around that.Please see my replied in patch 2/7
Quoted 68 lines
Quoted 68 lines
Quoted 68 lines
Quoted 49 lines
Quoted 26 lines
Quoted 26 lines
Quoted 12 lines
Quoted 2 lines
And where is this
file loaded from ?You need to set the default source in DTS, for example "firmware-
loader
=&fs_loader0", that's for power boot up purpose. After that,
generic
firmware loader would go to the dsignated storage as described
below to
find the FPGA FIT image according description from above.Quoted 8 lines
Quoted 5 lines
fs_loader0: fs-loader at 0 { u-boot,dm-pre-reloc; compatible = "u-boot,fs-loader"; phandlepart = <&mmc 1>; };How does the driver bound to fpga-mgr know which firmware loader
instance to use ? There's no phandle.Current firmware loader supports only one instance, that is default
instance described in chosen node. It is good enough to solve
our
problem where to define a default storage for FPGA images and
how
to
tell the SPL to load it from the default storage when the board
is
powered up. I don't see there is a need to support more than
oneQuoted 8 lines
instance for fpga-mgr during SPL runtime, at least for now. User
can
program the FPGA with core image from any storage with series
of
commands such as fatload and socfpga load on U-Boot console.Since you already have the label for the fs-loader _and_ you have
the
address for it (fs-loader at 0), you should supply the phandle. And
eventually, someone will try to use multiple loaders, so we should do
this correctly from the beginning -- by supplying the phandle to
the
loader node.Quoted 8 lines
Quoted 5 lines
Okay, i will improve firmware loader in separate patch set. Basically, the ideas are for
1. For majority HWs use default storage, defined in console node.
(Already supported)I'm not sure I understand this point, default storage in console node
?For example, we have 5 fpga manager nodes.
fpga_mgr1,fpga_mgr2,fpga_mgr3, andfpga_mgr4are using sdmmc as storage, so we can define sdmmc as default storage in console node instead of setting phandle to each offpga_mgrnodes.Let say
fpga_mgr5is using QSPI, then we can set "firmware-loader = <phandle>" tofpga_mgr5.Quoted 14 lines
Quoted 14 lines
2. For minority HWs use, other than default storage, users should
add
this property "firmware-loader = <phandle>" to their respective HW
nodes. This would enable overwritten of default storage, phandle
from
console node. (planning to enhance)
3. Enable sequencenumber(DM_FLAG_PRE_RELOC)support through hard
coding. (planning to enhance)Quoted 1 line
Why do we want to hard-code anything ?
The purpose here is to support the feature of
DM_FLAG_PRE_RELOC. One of
the use case i think of searching the file such as u-boot.img in every
storage supported in firmware loader. I have no strong opinion for item
3, we can support it in later when it is needed.Quoted 54 lines
Quoted 54 lines
So, the interface is still same for this patch set, using item 1,
default storage.What do you think?
Quoted 47 lines
Quoted 47 lines
It is good to improve the firmware loader to support the
DM_FLAG_PRE_RELOC, which allow user to choose different firmware
loader node through setting the right sequence number when creating
the
firmare loader instance in the parent driver such as fpga mgr,
but
i
don't see there is urgency need to be done now.Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
(quoted diff) +3
-0+ }; + +- Examples for booting with full release, enteruser
mode
with
full bitstream:
fpga_mgr: fpga-mgr atffd03000{
compatible = "altr,socfpga-a10-
fpga-
mgr";(quoted diff) +1
-0@@ -16,4 +47,5 @@ Example: 0xffcfe400 0x20>; clocks = <&l4_mp_clk>; resets = <&rst FPGAMGR_RESET>; + altr,bitstream = "fit_spl_fpga.itb";};
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
On 2/12/19 10:35 AM, Chee, Tien Fong wrote:
[...]
Quoted 29 lines
Quoted 14 lines
my preference for the fit image would be
...
images {fpga at 1 { description = "FPGA Periph"; ... type = "fpga_periph"; ... } fpga at 2 { description = "FPGA Core"; ... type = "fpga" orQuoted 1 line
"
fpga_core";I'm good with "fpga".
Quoted 13 lines
...}
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga at 1"; // periph only
};
config at 2 {
fpga = "fpga at 1", "fpga at 2";
};
};
Quoted 7 lines
Quoted 5 lines
with the expectation that the order of fpga at 1 and fpga at 2 in config at 2 is not relevant. the code should find the
fpga_periphtype and program
it first. just my comment, i dont like rellying on the order or name.I can add support for above implementation although this adds more complexity to the driver.
You can have fpga node and e.g. fpga-name node in the configurations section to discern which phandle there is the core and which is the peripheral RBF. Would that work ?
Quoted 1 line
Marek, are you OK with this implementation?
Looks OK to me. Dalon ?
[...]
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 41 lines · Marek Vasut
On 2/12/19 10:35 AM, Chee, Tien Fong wrote:
[...]Quoted 38 lines
Quoted 16 lines
my preference for the fit image would be
...
images {fpga at 1 { description = "FPGA Periph"; ... type = "fpga_periph"; ... } fpga at 2 { description = "FPGA Core"; ... type = "fpga" orQuoted 1 line
"
fpga_core";I'm good with "fpga".
Quoted 20 lines
...}
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga at 1"; // periph only
};
config at 2 {
fpga = "fpga at 1", "fpga at 2";
};
};with the expectation that the order of fpga at 1 and fpga at 2 in confi g at 2
is not relevant. the code should find thefpga_periphtype and program
it first. just my comment, i dont like rellying on the order or name.
Quoted 6 lines
Quoted 2 lines
I can add support for above implementation although this adds more complexity to the driver.
You can have fpga node and e.g. fpga-name node in the configurations section to discern which phandle there is the core and which is the peripheral RBF. Would that work ?
So something like that?
...
images {
fpga-periph at 1 {
description = "FPGA Periph";
...
type = "fpga_periph";
...
}
fpga-core at 2 {
description = "FPGA Core";
...
type = "fpga";
... }
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga-periph at 1"; // periph only };
config at 2 {
fpga = "fpga-periph at 1", "fpga-core at 2"; };
};
Quoted 5 lines
Quoted 2 lines
Marek, are you OK with this implementation?
Looks OK to me. Dalon ?
[...]
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 50 lines · Tien Fong
Quoted 41 lines · Marek Vasut
On 2/12/19 10:35 AM, Chee, Tien Fong wrote:
[...]Quoted 38 lines
Quoted 16 lines
my preference for the fit image would be
...
images {fpga at 1 { description = "FPGA Periph"; ... type = "fpga_periph"; ... } fpga at 2 { description = "FPGA Core"; ... type = "fpga" orQuoted 1 line
"
fpga_core";I'm good with "fpga".
Quoted 20 lines
...}
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga at 1"; // periph only
};
config at 2 {
fpga = "fpga at 1", "fpga at 2";
};
};with the expectation that the order of fpga at 1 and fpga at 2 in confi g at 2
is not relevant. the code should find thefpga_periphtype and program
it first. just my comment, i dont like rellying on the order or name.Quoted 6 lines
Quoted 2 lines
I can add support for above implementation although this adds more complexity to the driver.
You can have fpga node and e.g. fpga-name node in the configurations section to discern which phandle there is the core and which is the peripheral RBF. Would that work ?
So something like that?
Quoted 7 lines
...
images {
fpga-periph at 1 { description = "FPGA Periph"; ... type = "fpga_periph";
Do we need a new type for the periph/core distinction ?
Quoted 24 lines
... } fpga-core at 2 { description = "FPGA Core"; ... type = "fpga"; ...}
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga-periph at 1"; // periph only };
config at 2 {
fpga = "fpga-periph at 1", "fpga-core at 2"; };
};Quoted 5 lines
Quoted 2 lines
Marek, are you OK with this implementation?
Looks OK to me. Dalon ?
[...]
Signature · 2 lines
Best regards, Marek Vasut
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 50 lines · Marek Vasut
Quoted 49 lines · Tien Fong
Quoted 38 lines · Marek Vasut
On 2/12/19 10:35 AM, Chee, Tien Fong wrote:
[...]Quoted 35 lines
Quoted 14 lines
my preference for the fit image would be
...
images {fpga at 1 { description = "FPGA Periph"; ... type = "fpga_periph"; ... } fpga at 2 { description = "FPGA Core"; ... type = "fpga" orQuoted 1 line
"
fpga_core";I'm good with "fpga".
Quoted 19 lines
...}
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga at 1"; // periph only
};config at 2 { fpga = "fpga at 1", "fpga at 2";};
};with the expectation that the order of fpga at 1 and fpga at 2 in confi g at 2
is not relevant. the code should find thefpga_periphtype and program
it first. just my comment, i dont like rellying on the order or name.Quoted 6 lines
Quoted 2 lines
I can add support for above implementation although this adds more complexity to the driver.
You can have fpga node and e.g. fpga-name node in the configurations section to discern which phandle there is the core and which is the peripheral RBF. Would that work ?
So something like that?
...
Quoted 7 lines
Quoted 5 lines
images {
fpga-periph at 1 { description = "FPGA Periph"; ... type = "fpga_periph";Do we need a new type for the periph/core distinction ?
not really, using the node name is fine with me as is shown below. when i suggested that my intent was to allow the name to be independant of the node name still envisioning scenarios where the fit image has multiple fpga images.
Quoted 26 lines
Quoted 24 lines
... } fpga-core at 2 { description = "FPGA Core"; ... type = "fpga"; ...}
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga-periph at 1"; // periph only
};config at 2 { fpga = "fpga-periph at 1", "fpga-core at 2";};
};Quoted 4 lines
Quoted 1 line
Marek, are you OK with this implementation?
Looks OK to me. Dalon ?
[...]
Chee
PATCH v7 1/7 ARM: socfpga: Description on FPGA bitstream type and file name for Arria 10
Quoted 68 lines · Dalon L Westergreen
Quoted 67 lines · Marek Vasut
Quoted 65 lines · Tien Fong
Quoted 45 lines · Marek Vasut
On 2/12/19 10:35 AM, Chee, Tien Fong wrote:
[...]Quoted 41 lines
Quoted 16 lines
my preference for the fit image would be
...
images {fpga at 1 { description = "FPGA Periph"; ... type = "fpga_periph"; ... } fpga at 2 { description = "FPGA Core"; ... type = "fpga" orQuoted 1 line
"
fpga_core";I'm good with "fpga".
Quoted 23 lines
...}
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga at 1"; // periph only
};
config at 2 {
fpga = "fpga at 1", "fpga at 2";
};
};with the expectation that the order of fpga at 1 and fpga at 2 in confi
g at 2
is not relevant. the code should find thefpga_periphtype and
program
it first. just my comment, i dont like rellying on the order or
name.Quoted 9 lines
Quoted 3 lines
I can add support for above implementation although this adds more
complexity to the driver.You can have fpga node and e.g. fpga-name node in the configurations
section to discern which phandle there is the core and which is the
peripheral RBF. Would that work ?So something like that?
...
images {
fpga-periph at 1 { description = "FPGA Periph"; ... type = "fpga_periph";
Quoted 5 lines
Quoted 1 line
Do we need a new type for the periph/core distinction ?
not really, using the node name is fine with me as is shown below. when i suggested that my intent was to allow the name to be independant of the node name still envisioning scenarios where the fit image has multiple fpga images.
Great, then i will work out the codes which able to identify the bitstream type based on the node name "fpga-core" and "fpga-periph"
Thanks for finalizing the implementation.
Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
... } fpga-core at 2 { description = "FPGA Core"; ... type = "fpga"; ...}
};
configurations {
default = "config at 1"
config at 1 {
fpga = "fpga-periph at 1"; // periph only };
config at 2 {
fpga = "fpga-periph at 1", "fpga-core at 2"; };
};Quoted 6 lines
Quoted 3 lines
Marek, are you OK with this implementation?
Looks OK to me. Dalon ?
[...]
PATCH v7 2/7 ARM: socfpga: Add default FPGA bitstream fitImage for Arria10 SoCDK
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Add default fitImage file bundling FPGA bitstreams for Arria10.
--- board/altera/arria10-socdk/fit_spl_fpga.its | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 board/altera/arria10-socdk/fit_spl_fpga.its
board/altera/arria10-socdk/fit_spl_fpga.its new file +31 -0
@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 + /* + * Copyright (C) 2019 Intel Corporation <www.intel.com> + * + */ + +/dts-v1/; + +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>; + + images { + fpga-2 { + description = "FPGA core bitstream"; + data = /incbin/("../../../ghrd_10as066n2.core.rbf"); + type = "fpga"; + arch = "arm"; + compression = "none"; + load = <0x400>; + }; + + fpga-1 { + description = "FPGA peripheral bitstream"; + data = /incbin/("../../../ghrd_10as066n2.periph.rbf"); + type = "fpga"; + arch = "arm"; + compression = "none"; + }; + }; +};
Signature · 1 line
2.2.0
PATCH v7 2/7 ARM: socfpga: Add default FPGA bitstream fitImage for Arria10 SoCDK
Quoted 20 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add default fitImage file bundling FPGA bitstreams for Arria10.
Signed-off-by Tien Fong Chee <[email protected]>--- board/altera/arria10-socdk/fit_spl_fpga.its | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 board/altera/arria10-socdk/fit_spl_fpga.itsboard/altera/arria10-socdk/fit_spl_fpga.its new file +4
-0@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 + /* + * Copyright (C) 2019 Intel Corporation <www.intel.com> + *
board/altera/arria10-socdk/fit_spl_fpga.its line 14
Quoted 10 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +10
-0+ */ + +/dts-v1/; + +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>; + + images { + fpga-2 {
Why is fpga-2 before fpga-1 ?
Quoted 18 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +17
-0+ description = "FPGA core bitstream"; + data = /incbin/("../../../ghrd_10as066n2.core.rbf"); + type = "fpga"; + arch = "arm"; + compression = "none"; + load = <0x400>; + }; + + fpga-1 { + description = "FPGA peripheral bitstream"; + data = /incbin/("../../../ghrd_10as066n2.periph.rbf"); + type = "fpga"; + arch = "arm"; + compression = "none"; + }; + }; +};
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 2/7 ARM: socfpga: Add default FPGA bitstream fitImage for Arria10 SoCDK
Quoted 27 lines · Marek Vasut
Quoted 26 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add default fitImage file bundling FPGA bitstreams for Arria10.
Signed-off-by Tien Fong Chee <[email protected]>---
board/altera/arria10-socdk/fit_spl_fpga.its | 31
+++++++++++++++++++++++++++++1 file changed, 31 insertions(+)create mode 100644 board/altera/arria10-socdk/fit_spl_fpga.its
board/altera/arria10-socdk/fit_spl_fpga.its new file +7
-0@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 + /* + * Copyright (C) 2019 Intel Corporation <www.intel.com> + * + */ + +/dts-v1/;
Quoted 8 lines
board/altera/arria10-socdk/fit_spl_fpga.its line 14
Quoted 7 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +7
-0+ +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>; + + images { + fpga-2 {Why is fpga-2 before fpga-1 ?
1. The main purpose is for solving the performance issue as i described in cover letter. We can decide the absolute data position for core image, and ensure it is in allignment.
2. Users know where is the data position for core, so easy for them to program themself with series commands on U-Boot console.
Quoted 23 lines
Quoted 22 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +2
-0+ description = "FPGA core bitstream"; + data =/incbin/("../../../ghrd_10as066n2.core.rbf");
board/altera/arria10-socdk/fit_spl_fpga.its new file +9
-0+ type = "fpga"; + arch = "arm"; + compression = "none"; + load = <0x400>; + }; + + fpga-1 { + description = "FPGA peripheral bitstream"; + data =/incbin/("../../../ghrd_10as066n2.periph.rbf");
board/altera/arria10-socdk/fit_spl_fpga.its new file +6
-0+ type = "fpga"; + arch = "arm"; + compression = "none"; + }; + }; +};
PATCH v7 2/7 ARM: socfpga: Add default FPGA bitstream fitImage for Arria10 SoCDK
Quoted 36 lines · Tien Fong
Quoted 27 lines · Marek Vasut
Quoted 26 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add default fitImage file bundling FPGA bitstreams for Arria10.
Signed-off-by Tien Fong Chee <[email protected]>---
board/altera/arria10-socdk/fit_spl_fpga.its | 31
+++++++++++++++++++++++++++++1 file changed, 31 insertions(+)create mode 100644 board/altera/arria10-socdk/fit_spl_fpga.its
board/altera/arria10-socdk/fit_spl_fpga.its new file +7
-0@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 + /* + * Copyright (C) 2019 Intel Corporation <www.intel.com> + * + */ + +/dts-v1/;Quoted 8 lines
board/altera/arria10-socdk/fit_spl_fpga.its line 14
Quoted 7 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +7
-0+ +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>; + + images { + fpga-2 {Why is fpga-2 before fpga-1 ?
Quoted 3 lines
1. The main purpose is for solving the performance issue as i described in cover letter. We can decide the absolute data position for core image, and ensure it is in allignment.
Where does the alignment problem happen exactly ?
Anyway, you cannot rely on this, the alignment within the fitImage may be changed just by using different strings in the ITS file.
Quoted 2 lines
2. Users know where is the data position for core, so easy for them to program themself with series commands on U-Boot console.
You should use imxtract to pull out the file from fitImage and then program it. imxtract can refer to image name, so there's no need to access raw data within the fitImage by offset.
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +2
-0+ description = "FPGA core bitstream"; + data =/incbin/("../../../ghrd_10as066n2.core.rbf");
board/altera/arria10-socdk/fit_spl_fpga.its new file +9
-0+ type = "fpga"; + arch = "arm"; + compression = "none"; + load = <0x400>; + }; + + fpga-1 { + description = "FPGA peripheral bitstream"; + data =/incbin/("../../../ghrd_10as066n2.periph.rbf");
board/altera/arria10-socdk/fit_spl_fpga.its new file +6
-0+ type = "fpga"; + arch = "arm"; + compression = "none"; + }; + }; +};
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 2/7 ARM: socfpga: Add default FPGA bitstream fitImage for Arria10 SoCDK
Quoted 40 lines · Marek Vasut
Quoted 39 lines · Tien Fong
Quoted 37 lines · Marek Vasut
Quoted 24 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add default fitImage file bundling FPGA bitstreams for Arria10.
Signed-off-by Tien Fong Chee <[email protected]>---
board/altera/arria10-socdk/fit_spl_fpga.its | 31
+++++++++++++++++++++++++++++1 file changed, 31 insertions(+)create mode 100644 board/altera/arria10-socdk/fit_spl_fpga.its
board/altera/arria10-socdk/fit_spl_fpga.its new file +4
-0@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 + /* + * Copyright (C) 2019 Intel Corporation <www.intel.com> + *board/altera/arria10-socdk/fit_spl_fpga.its line 14
Quoted 10 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +10
-0+ */ + +/dts-v1/; + +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>; + + images { + fpga-2 {Why is fpga-2 before fpga-1 ?
Quoted 5 lines
Quoted 4 lines
1. The main purpose is for solving the performance issue as i described
in cover letter. We can decide the absolute data position for core image, and ensure it is in allignment.Where does the alignment problem happen exactly ?
The allignment problem happen in get_contents function, line 373, at fs/fat/fat.c . This happens only when reading offset from a file, that's why absolute position is very important to set the right offset for the core image. The performance penalty can be significantly incurred with large size core image.
filesize -= actsize; actsize -= pos; memcpy(buffer, tmp_buffer + pos, actsize); free(tmp_buffer); *gotsize += actsize; if (!filesize) return 0; buffer += actsize; <= buffer sometimes is altered to
unaligned
This function is basically finding the cluster where the pos resides in, adjusting the pos, actsize and file size accordingly when the base being changed from beginning of the file to the beginning of the cluster where the pos resides in.
Then copying the actsize size of content from pos to the end of the cluster to the buffer above, and updating buffer to the next write. The updated buffer can be unaligned especially the pos is not being set properly, hence we need the absolute position to fix that.
When the unaligned buffer is passed as argument to the get_cluster function, you would see the print out of "FAT: Misaligned buffer address"@line 264 in that function. A very slow disk_read would be implemented to transfer the sector by sector content to the unaligned buffer.
Quoted 4 lines
Anyway, you cannot rely on this, the alignment within the fitImage may
be changed just by using different strings in the ITS file.
No change for absolute position, it is always same offset based on the beginning of a FIT.
Quoted 8 lines
Quoted 5 lines
2. Users know where is the data position for core, so easy for them to
program themself with series commands on U-Boot console.You should use imxtract to pull out the file from fitImage and then program it. imxtract can refer to image name, so there's no need to access raw data within the fitImage by offset.
Yes, that's one of the most effective way. Another is using fatload with offset.
But the item 1 is the main reason why absolute position is important for large core image.
Eventually positive solution, it is good to improve the performance handling for both get_content and get_cluster functions.
Quoted 26 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +2
-0+ description = "FPGA core bitstream"; + data =/incbin/("../../../ghrd_10as066n2.core.rbf");
board/altera/arria10-socdk/fit_spl_fpga.its new file +8
-0+ type = "fpga"; + arch = "arm"; + compression = "none"; + load = <0x400>; + }; + + fpga-1 { + description = "FPGA peripheralbitstream";
board/altera/arria10-socdk/fit_spl_fpga.its new file +1
-0+ data =/incbin/("../../../ghrd_10as066n2.periph.rbf");
board/altera/arria10-socdk/fit_spl_fpga.its new file +6
-0+ type = "fpga"; + arch = "arm"; + compression = "none"; + }; + }; +};
PATCH v7 2/7 ARM: socfpga: Add default FPGA bitstream fitImage for Arria10 SoCDK
Quoted 41 lines · Tien Fong
Quoted 40 lines · Marek Vasut
Quoted 39 lines · Tien Fong
Quoted 37 lines · Marek Vasut
Quoted 24 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add default fitImage file bundling FPGA bitstreams for Arria10.
Signed-off-by Tien Fong Chee <[email protected]>---
board/altera/arria10-socdk/fit_spl_fpga.its | 31
+++++++++++++++++++++++++++++1 file changed, 31 insertions(+)create mode 100644 board/altera/arria10-socdk/fit_spl_fpga.its
board/altera/arria10-socdk/fit_spl_fpga.its new file +4
-0@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 + /* + * Copyright (C) 2019 Intel Corporation <www.intel.com> + *board/altera/arria10-socdk/fit_spl_fpga.its line 14
Quoted 10 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +10
-0+ */ + +/dts-v1/; + +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>; + + images { + fpga-2 {Why is fpga-2 before fpga-1 ?
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
1. The main purpose is for solving the performance issue as i described
in cover letter. We can decide the absolute data position for core image, and ensure it is in allignment.Where does the alignment problem happen exactly ?
The allignment problem happen in get_contents function, line 373, at
fs/fat/fat.c.
But then you're trying to work around a memcpy performance pentalty in VFAT code by frobbing with file position within a fitImage ? This can not work, since the file alignment within fitImage is not guaranteed.
Quoted 25 lines
This happens only when reading offset from a file,
that's why absolute position is very important to set the right offset for the core image. The performance penalty can be significantly incurred with large size core image.filesize -= actsize; actsize -= pos; memcpy(buffer, tmp_buffer + pos, actsize); free(tmp_buffer); *gotsize += actsize; if (!filesize) return 0; buffer += actsize; <= buffer sometimes is altered tounaligned
This function is basically finding the cluster where the pos resides in, adjusting the pos, actsize and file size accordingly when the base being changed from beginning of the file to the beginning of the cluster where the pos resides in.
Then copying the actsize size of content from pos to the end of the cluster to the buffer above, and updating buffer to the next write. The updated buffer can be unaligned especially the pos is not being set properly, hence we need the absolute position to fix that.
Quoted 5 lines
When the unaligned buffer is passed as argument to the
get_clusterfunction, you would see the print out of "FAT: Misaligned buffer address" at line 264 in that function. A very slow disk_read would be implemented to transfer the sector by sector content to the unaligned buffer.
Can this be fixed then ?
Quoted 6 lines
Quoted 4 lines
Anyway, you cannot rely on this, the alignment within the fitImage may
be changed just by using different strings in the ITS file.No change for absolute position, it is always same offset based on the beginning of a FIT.
Try adding a few properties here and there and/or changing the length of some of the strings, you'll see the file offset changes.
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
2. Users know where is the data position for core, so easy for them to
program themself with series commands on U-Boot console.You should use imxtract to pull out the file from fitImage and then program it. imxtract can refer to image name, so there's no need to access raw data within the fitImage by offset.
Yes, that's one of the most effective way. Another is using fatload with offset.
No, it is not, because you do not know the offset. imxtract parses the fitImage structure and computes the offset for you.
Quoted 30 lines
But the item 1 is the main reason why absolute position is important for large core image.
Eventually positive solution, it is good to improve the performance handling for both
get_contentandget_clusterfunctions.Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +2
-0+ description = "FPGA core bitstream"; + data =/incbin/("../../../ghrd_10as066n2.core.rbf");
board/altera/arria10-socdk/fit_spl_fpga.its new file +8
-0+ type = "fpga"; + arch = "arm"; + compression = "none"; + load = <0x400>; + }; + + fpga-1 { + description = "FPGA peripheralbitstream";
board/altera/arria10-socdk/fit_spl_fpga.its new file +1
-0+ data =/incbin/("../../../ghrd_10as066n2.periph.rbf");
board/altera/arria10-socdk/fit_spl_fpga.its new file +6
-0+ type = "fpga"; + arch = "arm"; + compression = "none"; + }; + }; +};
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 2/7 ARM: socfpga: Add default FPGA bitstream fitImage for Arria10 SoCDK
Quoted 54 lines · Marek Vasut
Quoted 53 lines · Tien Fong
Quoted 51 lines · Marek Vasut
Quoted 49 lines · Tien Fong
Quoted 33 lines · Marek Vasut
Quoted 30 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add default fitImage file bundling FPGA bitstreams for Arria10.
Signed-off-by Tien Fong Chee <[email protected]>---
board/altera/arria10-socdk/fit_spl_fpga.its | 31
+++++++++++++++++++++++++++++1 file changed, 31 insertions(+)create mode 100644 board/altera/arria10-
socdk/fit_spl_fpga.itsboard/altera/arria10-socdk/fit_spl_fpga.its new file +7
-0@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 + /* + * Copyright (C) 2019 Intel Corporation <www.intel.com> + * + */ + +/dts-v1/;Quoted 8 lines
board/altera/arria10-socdk/fit_spl_fpga.its line 14
Quoted 7 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +7
-0+ +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>; + + images { + fpga-2 {Why is fpga-2 before fpga-1 ?
1. The main purpose is for solving the performance issue as i described
in cover letter. We can decide the absolute data position for core
image, and ensure it is in allignment.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Where does the alignment problem happen exactly ?
The allignment problem happen in get_contents function, line 373, at
fs/fat/fat.c.But then you're trying to work around a memcpy performance pentalty in
VFAT code by frobbing with file position within a fitImage ? This can not work, since the file alignment within fitImage is not guaranteed
Yes, setting the absolute data position for the large core rbf file in fitImage.
so, when generating the fitImage through mkimage, you need to set the absolute position as argument to -p. Absolute data position is always fixed offset based on fitImage base.
Quoted 31 lines
Quoted 31 lines
This happens only when reading offset from a file, that's why absolute position is very important to set the right offset
for the core image. The performance penalty can be significantly incurred with large size core image.filesize -= actsize; actsize -= pos; memcpy(buffer, tmp_buffer + pos, actsize); free(tmp_buffer); *gotsize += actsize; if (!filesize) return 0; buffer += actsize; <= buffer sometimes is altered tounaligned
This function is basically finding the cluster where the pos resides
in, adjusting the pos, actsize and file size accordingly when the base
being changed from beginning of the file to the beginning of the cluster where the pos resides in.Then copying the actsize size of content from pos to the end of the cluster to the buffer above, and updating buffer to the next write. The
updated buffer can be unaligned especially the pos is not being set properly, hence we need the absolute position to fix that.
Quoted 8 lines
Quoted 7 lines
When the unaligned buffer is passed as argument to the
get_clusterfunction, you would see the print out of "FAT: Misaligned buffer address" at line 264 in that function. A very slow disk_read would be
implemented to transfer the sector by sector content to the unaligned
buffer.Can this be fixed then ?
I have tried few ideas, no one of them work.
Could you help to take a look?
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Anyway, you cannot rely on this, the alignment within the fitImage
may
be changed just by using different strings in the ITS file.
Quoted 6 lines
Quoted 3 lines
No change for absolute position, it is always same offset based on the
beginning of a FIT.Try adding a few properties here and there and/or changing the length of
some of the strings, you'll see the file offset changes.
Absolute data position is always fixed offset from base of fitImage regardless how many properties are added or changing. But, there is potential the overlapping would be happended if data position is too close with fit.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
2. Users know where is the data position for core, so easy for them
to
program themself with series commands on U-Boot console.You should use imxtract to pull out the file from fitImage and then
program it. imxtract can refer to image name, so there's no need to
access raw data within the fitImage by offset.
Quoted 5 lines
Quoted 2 lines
Yes, that's one of the most effective way. Another is using fatload with offset.
No, it is not, because you do not know the offset. imxtract parses the
fitImage structure and computes the offset for you.
You know the offset, this is absolute offset from the base of fitImage, you set it as argument to -p when running mkimage such as "-p 400"
tools/mkimage -E -p 400 -f board/altera/arria10-socdk/fit_spl_fpga.its fit_spl_fpga.itb
Quoted 39 lines
Quoted 38 lines
But the item 1 is the main reason why absolute position is important
for large core image.Eventually positive solution, it is good to improve the performance handling for both
get_contentandget_clusterfunctions.Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +1
-0+ description = "FPGA corebitstream";
board/altera/arria10-socdk/fit_spl_fpga.its new file +1
-0+ data =/incbin/("../../../ghrd_10as066n2.core.rbf");
board/altera/arria10-socdk/fit_spl_fpga.its new file +8
-0+ type = "fpga"; + arch = "arm"; + compression = "none"; + load = <0x400>; + }; + + fpga-1 { + description = "FPGA peripheralbitstream";
board/altera/arria10-socdk/fit_spl_fpga.its new file +1
-0+ data =/incbin/("../../../ghrd_10as066n2.periph.rbf");
board/altera/arria10-socdk/fit_spl_fpga.its new file +6
-0+ type = "fpga"; + arch = "arm"; + compression = "none"; + }; + }; +};
PATCH v7 2/7 ARM: socfpga: Add default FPGA bitstream fitImage for Arria10 SoCDK
Quoted 63 lines · Tien Fong
Quoted 54 lines · Marek Vasut
Quoted 53 lines · Tien Fong
Quoted 51 lines · Marek Vasut
Quoted 49 lines · Tien Fong
Quoted 33 lines · Marek Vasut
Quoted 30 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add default fitImage file bundling FPGA bitstreams for Arria10.
Signed-off-by Tien Fong Chee <[email protected]>---
board/altera/arria10-socdk/fit_spl_fpga.its | 31
+++++++++++++++++++++++++++++1 file changed, 31 insertions(+)create mode 100644 board/altera/arria10-
socdk/fit_spl_fpga.itsboard/altera/arria10-socdk/fit_spl_fpga.its new file +7
-0@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 + /* + * Copyright (C) 2019 Intel Corporation <www.intel.com> + * + */ + +/dts-v1/;Quoted 8 lines
board/altera/arria10-socdk/fit_spl_fpga.its line 14
Quoted 7 lines
board/altera/arria10-socdk/fit_spl_fpga.its new file +7
-0+ +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>; + + images { + fpga-2 {Why is fpga-2 before fpga-1 ?
1. The main purpose is for solving the performance issue as i described
in cover letter. We can decide the absolute data position for core
image, and ensure it is in allignment.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Where does the alignment problem happen exactly ?
The allignment problem happen in get_contents function, line 373, at
fs/fat/fat.c.But then you're trying to work around a memcpy performance pentalty in
VFAT code by frobbing with file position within a fitImage ? This can not work, since the file alignment within fitImage is not guaranteed
Quoted 6 lines
Yes, setting the absolute data position for the large core rbf file in fitImage.
so, when generating the fitImage through mkimage, you need to set the absolute position as argument to -p. Absolute data position is always fixed offset based on fitImage base.
This can not work, consider the different filesystems the fitImage can be stored on. It's not just VFAT with one cluster size, it can be any configuration of VFAT U-Boot supports, or any filesystem U-Boot supports. And then the performance penalty could be back.
The proper fix is to optimize what VFAT does, if that is a problem. Maybe the block cache can help here ?
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
This happens only when reading offset from a file, that's why absolute position is very important to set the right offset
for the core image. The performance penalty can be significantly incurred with large size core image.filesize -= actsize; actsize -= pos; memcpy(buffer, tmp_buffer + pos, actsize); free(tmp_buffer); *gotsize += actsize; if (!filesize) return 0; buffer += actsize; <= buffer sometimes is altered tounaligned
This function is basically finding the cluster where the pos resides
in, adjusting the pos, actsize and file size accordingly when the base
being changed from beginning of the file to the beginning of the cluster where the pos resides in.Then copying the actsize size of content from pos to the end of the cluster to the buffer above, and updating buffer to the next write. The
updated buffer can be unaligned especially the pos is not being set properly, hence we need the absolute position to fix that.When the unaligned buffer is passed as argument to the
get_clusterfunction, you would see the print out of "FAT: Misaligned buffer address" at line 264 in that function. A very slow disk_read would be
implemented to transfer the sector by sector content to the unaligned
buffer.
Quoted 4 lines
Quoted 1 line
Can this be fixed then ?
I have tried few ideas, no one of them work.
Could you help to take a look?
I am tremendously overloaded, sorry. Try taking a look at the block cache , drivers/block/blkcache.c , maybe this can help ?
Quoted 35 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Anyway, you cannot rely on this, the alignment within the fitImage
may
be changed just by using different strings in the ITS file.Quoted 6 lines
Quoted 3 lines
No change for absolute position, it is always same offset based on the
beginning of a FIT.Try adding a few properties here and there and/or changing the length of
some of the strings, you'll see the file offset changes.Absolute data position is always fixed offset from base of fitImage regardless how many properties are added or changing. But, there is potential the overlapping would be happended if data position is too close with fit.
Quoted 17 lines
Quoted 17 lines
Quoted 10 lines
Quoted 10 lines
2. Users know where is the data position for core, so easy for them
to
program themself with series commands on U-Boot console.Quoted 5 lines
You should use imxtract to pull out the file from fitImage and then
program it. imxtract can refer to image name, so there's no need to
access raw data within the fitImage by offset.Yes, that's one of the most effective way. Another is using fatload with offset.
Quoted 8 lines
Quoted 3 lines
No, it is not, because you do not know the offset. imxtract parses the
fitImage structure and computes the offset for you.You know the offset, this is absolute offset from the base of fitImage, you set it as argument to -p when running mkimage such as "-p 400"
tools/mkimage-E -p 400 -f board/altera/arria10-socdk/fit_spl_fpga.its fit_spl_fpga.itb
You're just working around the alignment problem for one specific configuration of the VFAT, this does not scale.
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 2/7 ARM: socfpga: Add default FPGA bitstream fitImage for Arria10 SoCDK
Quoted 89 lines · Marek Vasut
Quoted 83 lines · Tien Fong
Quoted 70 lines · Marek Vasut
Quoted 63 lines · Tien Fong
Quoted 60 lines · Marek Vasut
Quoted 57 lines · Tien Fong
Quoted 34 lines · Marek Vasut
Quoted 30 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add default fitImage file bundling FPGA bitstreams for Arria10.
Signed-off-by Tien Fong Chee <[email protected]Quoted 1 line
---
board/altera/arria10-socdk/fit_spl_fpga.its | 31
+++++++++++++++++++++++++++++1 file changed, 31 insertions(+)create mode 100644 board/altera/arria10-
socdk/fit_spl_fpga.its(quoted diff) +0
-0socdk/fit_spl_fpga.its
b/board/altera/arria10-socdk/fit_spl_fpga.its
new file mode 100644
index 0000000..46b125cboard/altera/arria10-socdk/fit_spl_fpga.its new file +3
-0@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 + /* + * Copyright (C) 2019 Intel Corporation <www.intel.comQuoted 1 line
Quoted 12 lines
board/altera/arria10-socdk/fit_spl_fpga.its
Quoted 11 lines
+ *
+ */board/altera/arria10-socdk/fit_spl_fpga.its new file +9
-0+ +/dts-v1/; + +/ { + description = "FIT image with FPGA bistream"; + #address-cells = <1>; + + images { + fpga-2 {Why is fpga-2 before fpga-1 ?
1. The main purpose is for solving the performance issue as i
described
in cover letter. We can decide the absolute data position for
core
image, and ensure it is in allignment.Quoted 5 lines
Quoted 1 line
Where does the alignment problem happen exactly ?
The allignment problem happen in get_contents function, line 373,
atfs/fat/fat.c.Quoted 7 lines
But then you're trying to work around a memcpy performance pentalty
in
VFAT code by frobbing with file position within a fitImage ? This can
not work, since the file alignment within fitImage is not guaranteedYes, setting the absolute data position for the large core rbf file in
fitImage.Quoted 5 lines
so, when generating the fitImage through mkimage, you need to set the
absolute position as argument to -p. Absolute data position is always
fixed offset based on fitImage base.
Quoted 5 lines
This can not work, consider the different filesystems the fitImage can
be stored on. It's not just VFAT with one cluster size, it can be any configuration of VFAT U-Boot supports, or any filesystem U-Boot supports. And then the performance penalty could be back.
Yes, i agree with you.
This is temporary workaround i can think of until the issue is getting solved, but i will keep trying.
If there is a solution, i will submit in separate patch set.
Quoted 3 lines
The proper fix is to optimize what VFAT does, if that is a problem. Maybe the block cache can help here ?
I tried that before, but it didn't help in this use case. The block cache only help in condition which repetitive reading at the same/adjacent locations.(no cache miss)
Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
This happens only when reading offset from a file, that's why absolute position is very important to set the right offset
for the core image. The performance penalty can be significantly
incurred with large size core image.filesize -= actsize; actsize -= pos; memcpy(buffer, tmp_buffer + pos, actsize); free(tmp_buffer); *gotsize += actsize; if (!filesize) return 0; buffer += actsize; <= buffer sometimes isaltered to
unalignedThis function is basically finding the cluster where the pos resides
in, adjusting the pos, actsize and file size accordingly when the
base
being changed from beginning of the file to the beginning of the
cluster where the pos resides in.Then copying the actsize size of content from pos to the end of the
cluster to the buffer above, and updating buffer to the next write.
The
updated buffer can be unaligned especially the pos is not being set
properly, hence we need the absolute position to fix that.When the unaligned buffer is passed as argument to the
get_cluster
function, you would see the print out of "FAT: Misaligned buffer
address" at line 264 in that function. A very slow disk_read would
be
implemented to transfer the sector by sector content to the unaligned
buffer.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Can this be fixed then ?
I have tried few ideas, no one of them work.
Could you help to take a look?
I am tremendously overloaded, sorry. Try taking a look at the block cache ,
drivers/block/blkcache.c, maybe this can help ?
Replied in above.
Quoted 59 lines
Quoted 59 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Anyway, you cannot rely on this, the alignment within the fitImage
may
be changed just by using different strings in the ITS file.Quoted 8 lines
Quoted 4 lines
No change for absolute position, it is always same offset based on
the
beginning of a FIT.Try adding a few properties here and there and/or changing the length
of
some of the strings, you'll see the file offset changes.Absolute data position is always fixed offset from base of fitImage regardless how many properties are added or changing. But, there is potential the overlapping would be happended if data position is too
close with fit.Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 10 lines
Quoted 5 lines
2. Users know where is the data position for core, so easy for
them
to
program themself with series commands on U-Boot console.You should use imxtract to pull out the file from fitImage and
then
program it. imxtract can refer to image name, so there's no need
to
access raw data within the fitImage by offset.Quoted 7 lines
Quoted 3 lines
Yes, that's one of the most effective way. Another is using fatload
with offset.No, it is not, because you do not know the offset. imxtract parses
the
fitImage structure and computes the offset for you.You know the offset, this is absolute offset from the base of fitImage,
you set it as argument to -p when running mkimage such as "-p 400"
Quoted 5 lines
Quoted 3 lines
tools/mkimage-E -p 400 -f board/altera/arria10-
socdk/fit_spl_fpga.its
fit_spl_fpga.itbYou're just working around the alignment problem for one specific configuration of the VFAT, this does not scale.
Replied in above.
Quoted 1 line
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading from filesystem. The driver are designed based on generic firmware loader framework. The driver can handle FPGA program operation from loading FPGA bitstream in flash to memory and then to program FPGA.
---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream and core bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable in DDR for better performance. This loading would be done in one large chunk instead of chunk by chunk loading with small memory buffer.
--- arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417 ++++++++++++++++++++- 3 files changed, 457 insertions(+), 17 deletions(-)
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +18 -0
@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi" +/ { + chosen { + firmware-loader = &fs_loader0; + }; + + fs_loader0: fs-loader at 0 { + u-boot,dm-pre-reloc; + compatible = "u-boot,fs-loader"; + phandlepart = <&mmc 1>; + }; +}; + +&fpga_mgr { + u-boot,dm-pre-reloc; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb"; +}; + &mmc { u-boot,dm-pre-reloc; status = "okay";
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +37 -2
@@ -1,9 +1,13 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2017 Intel Corporation <www.intel.com> +* Copyright (C) 2017-2019 Intel Corporation <www.intel.com> * All rights reserved. */ +#include <asm/cache.h> +#include <altera.h> +#include <image.h> +#ifndef _FPGA_MANAGER_ARRIA10_H_#define _FPGA_MANAGER_ARRIA10_H_
@@ -51,6 +55,10 @@#define ALT_FPGAMGR_IMGCFG_CTL_02_CFGWIDTH_SET_MSK BIT(24)#define ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_LSB 16 +#define FPGA_SOCFPGA_A10_RBF_UNENCRYPTED 0xa65c +#define FPGA_SOCFPGA_A10_RBF_ENCRYPTED 0xa65d +#define FPGA_SOCFPGA_A10_RBF_PERIPH 0x0001 +#define FPGA_SOCFPGA_A10_RBF_CORE 0x8001#ifndef __ASSEMBLY__ struct socfpga_fpga_manager {
@@ -88,12 +96,39 @@ struct socfpga_fpga_manager {u32 imgcfg_fifo_status; }; +enum rbf_type { + unknown, + periph_section, + core_section +}; + +enum rbf_security { + invalid, + unencrypted, + encrypted +}; + +struct rbf_info { +enum rbf_type section; +enum rbf_security security; +}; + +struct fpga_loadfs_info { +fpga_fs_info *fpga_fsinfo; +u32 remaining; +u32 offset; +struct rbf_info rbfinfo; +}; +/* Functions */ int fpgamgr_program_init (u32 * rbf_data,size_t rbf_size);int fpgamgr_program_finish (void );int is_fpgamgr_user_mode (void );int fpgamgr_wait_early_user_mode (void ); - +int is_fpgamgr_early_user_mode (void ); +char *get_fpga_filename (const void *fdt,int *len,u32 rbf_type); +int socfpga_loadfs (fpga_fs_info *fpga_fsinfo,const void *buf,size_t bsize, +u32 offset);#endif /* __ASSEMBLY__ */ #endif /* _FPGA_MANAGER_ARRIA10_H_ */
drivers/fpga/socfpga_arria10.c +402 -15
450 lines not on this page · raw message
Signature · 1 line
2.2.0
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
Quoted 28 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading from filesystem. The driver are designed based on generic firmware loader framework. The driver can handle FPGA program operation from loading FPGA bitstream in flash to memory and then to program FPGA.
Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream and core bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable in DDR for better performance. This loading would be done in one large chunk instead of chunk by chunk loading with small memory buffer.--- arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417 ++++++++++++++++++++- 3 files changed, 457 insertions(+), 17 deletions(-)arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts line 23
Quoted 6 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +3
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi" +/ { + chosen { + firmware-loader = &fs_loader0;
Shouldn't this be <&fs_loader0>; ?
How did this even pass the DTC ?
Quoted 57 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +15
-0+ }; + + fs_loader0: fs-loader at 0 { + u-boot,dm-pre-reloc; + compatible = "u-boot,fs-loader"; + phandlepart = <&mmc 1>; + }; +}; + +&fpga_mgr { + u-boot,dm-pre-reloc; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb"; +}; + &mmc { u-boot,dm-pre-reloc; status = "okay";arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +14
-1@@ -1,9 +1,13 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2017 Intel Corporation <www.intel.com> +* Copyright (C) 2017-2019 Intel Corporation <www.intel.com> * All rights reserved. */ +#include <asm/cache.h> +#include <altera.h> +#include <image.h> +#ifndef _FPGA_MANAGER_ARRIA10_H_#define _FPGA_MANAGER_ARRIA10_H_@@ -51,6 +55,10 @@#define ALT_FPGAMGR_IMGCFG_CTL_02_CFGWIDTH_SET_MSK BIT(24)#define ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_LSB 16 +#define FPGA_SOCFPGA_A10_RBF_UNENCRYPTED 0xa65c +#define FPGA_SOCFPGA_A10_RBF_ENCRYPTED 0xa65d +#define FPGA_SOCFPGA_A10_RBF_PERIPH 0x0001 +#define FPGA_SOCFPGA_A10_RBF_CORE 0x8001#ifndef __ASSEMBLY__ struct socfpga_fpga_manager {@@ -88,12 +96,39 @@ struct socfpga_fpga_manager {u32 imgcfg_fifo_status; }; +enum rbf_type { + unknown, + periph_section, + core_section +};
[...]
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
Quoted 32 lines · Marek Vasut
Quoted 31 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading from
filesystem. The driver are designed based on generic firmware loader
framework. The driver can handle FPGA program operation from loading FPGA
bitstream in flash to memory and then to program FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream and core
bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable
in DDR for better performance. This loading would be done in one large
chunk instead of chunk by chunk loading with small memory buffer.
---
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417
++++++++++++++++++++-3 files changed, 457 insertions(+), 17 deletions(-)
Quoted 14 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts line 23
Quoted 12 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi"arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +3
-0+/ { + chosen { + firmware-loader = &fs_loader0;Shouldn't this be <
&fs_loader0>; ?
How did this even pass the DTC ?
So <> is compulsory required for phandle? No error complaint from DTC.
Quoted 66 lines
Quoted 63 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +15
-0+ }; + + fs_loader0: fs-loader at 0 { + u-boot,dm-pre-reloc; + compatible = "u-boot,fs-loader"; + phandlepart = <&mmc 1>; + }; +}; + +&fpga_mgr { + u-boot,dm-pre-reloc; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb"; +}; +&mmc {
u-boot,dm-pre-reloc;
status = "okay";(quoted diff) +0
-0
socfpga/include/mach/fpga_manager_arria10.hb/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
index 09d13f6..683c84c 100644arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-1@@ -1,9 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2017 Intel Corporation <www.intel.com> +* Copyright (C) 2017-2019 Intel Corporation <www.intel.com> * All rights reserved. */ arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+#include <asm/cache.h> +#include <altera.h> +#include <image.h> +#ifndef _FPGA_MANAGER_ARRIA10_H_
#define _FPGA_MANAGER_ARRIA10_H_arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +0
-0@@ -51,6 +55,10 @@ #define ALT_FPGAMGR_IMGCFG_CTL_02_CFGWIDTH_SET_MSK BIT(24) #define ALT_FPGAMGR_IMGCFG_CTL_02_CDRATIO_LSB16
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+#define FPGA_SOCFPGA_A10_RBF_UNENCRYPTED 0xa65c +#define FPGA_SOCFPGA_A10_RBF_ENCRYPTED 0xa65d +#define FPGA_SOCFPGA_A10_RBF_PERIPH 0x0001 +#define FPGA_SOCFPGA_A10_RBF_CORE 0x8001#ifndef
__ASSEMBLY__
structsocfpga_fpga_manager{arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +0
-0@@ -88,12 +96,39 @@ struct socfpga_fpga_manager { u32 imgcfg_fifo_status; };arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+enum rbf_type { + unknown, + periph_section, + core_section +};[...]
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
Quoted 47 lines · Tien Fong
Quoted 32 lines · Marek Vasut
Quoted 31 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading from
filesystem. The driver are designed based on generic firmware loader
framework. The driver can handle FPGA program operation from loading FPGA
bitstream in flash to memory and then to program FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream and core
bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable
in DDR for better performance. This loading would be done in one large
chunk instead of chunk by chunk loading with small memory buffer.
---
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417
++++++++++++++++++++-3 files changed, 457 insertions(+), 17 deletions(-)Quoted 14 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts line 23
Quoted 12 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi"arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +3
-0+/ { + chosen { + firmware-loader = &fs_loader0;Shouldn't this be <
&fs_loader0>; ?
How did this even pass the DTC ?
Quoted 1 line
So <> is compulsory required for phandle? No error complaint from DTC.
Yes
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
Quoted 55 lines · Marek Vasut
Quoted 54 lines · Tien Fong
Quoted 52 lines · Marek Vasut
Quoted 45 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading
from
filesystem. The driver are designed based on generic firmware loader
framework. The driver can handle FPGA program operation from loading FPGA
bitstream in flash to memory and then to program FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream
and core
bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable
in DDR for better performance. This loading would be done in one
large
chunk instead of chunk by chunk loading with small memory buffer.
---
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417
++++++++++++++++++++-3 files changed, 457 insertions(+), 17 deletions(-)arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi"arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts line 23
Quoted 3 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +3
-0+/ { + chosen { + firmware-loader = &fs_loader0;Shouldn't this be <
&fs_loader0>; ?
How did this even pass the DTC ?
Quoted 3 lines
Quoted 2 lines
So <> is compulsory required for phandle? No error complaint from DTC.
Yes
Okay, i will fix it.
Quoted 1 line
Chee
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
In reply to Marek VasutQuoted 55 lines · Marek Vasut
Quoted 54 lines · Tien Fong
Quoted 52 lines · Marek Vasut
Quoted 45 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading
from
filesystem. The driver are designed based on generic firmware loader
framework. The driver can handle FPGA program operation from loading FPGA
bitstream in flash to memory and then to program FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream
and core
bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable
in DDR for better performance. This loading would be done in one
large
chunk instead of chunk by chunk loading with small memory buffer.
---
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417
++++++++++++++++++++-3 files changed, 457 insertions(+), 17 deletions(-)arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi"arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts line 23
Quoted 3 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +3
-0+/ { + chosen { + firmware-loader = &fs_loader0;Shouldn't this be <
&fs_loader0>; ?
How did this even pass the DTC ?
Quoted 3 lines
Quoted 2 lines
So <> is compulsory required for phandle? No error complaint from DTC.
Yes
I just checked the codes, this &fs_loader0 without <> is valid, because this is not a phandle, instead it is a label which will be expanded to the node's full path.
Quoted 1 line
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
Quoted 56 lines · Tien Fong
Quoted 55 lines · Marek Vasut
Quoted 54 lines · Tien Fong
Quoted 52 lines · Marek Vasut
Quoted 45 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading
from
filesystem. The driver are designed based on generic firmware loader
framework. The driver can handle FPGA program operation from loading FPGA
bitstream in flash to memory and then to program FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream
and core
bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable
in DDR for better performance. This loading would be done in one
large
chunk instead of chunk by chunk loading with small memory buffer.
---
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417
++++++++++++++++++++-3 files changed, 457 insertions(+), 17 deletions(-)arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi"arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts line 23
Quoted 3 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +3
-0+/ { + chosen { + firmware-loader = &fs_loader0;Shouldn't this be <
&fs_loader0>; ?
How did this even pass the DTC ?
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
So <> is compulsory required for phandle? No error complaint from DTC.
Yes
I just checked the codes, this
&fs_loader0without <> is valid, because this is not a phandle, instead it is a label which will be expanded to the node's full path.
Shouldn't it be a phandle ?
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
Quoted 70 lines · Marek Vasut
Quoted 69 lines · Tien Fong
Quoted 67 lines · Marek Vasut
Quoted 65 lines · Tien Fong
Quoted 45 lines · Marek Vasut
Quoted 42 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading
from
filesystem. The driver are designed based on generic firmware
loader
framework. The driver can handle FPGA program operation from
loading FPGA
bitstream in flash to memory and then to program FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream
and core
bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set
loadable
in DDR for better performance. This loading would be done in
one
large
chunk instead of chunk by chunk loading with small memory buffer.
---
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39+- drivers/fpga/socfpga_arria10.c | 417 ++++++++++++++++++++- 3 files changed, 457 insertions(+), 17 deletions(-)Quoted 14 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts line 23
Quoted 12 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi"arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +3
-0+/ { + chosen { + firmware-loader = &fs_loader0;Shouldn't this be <
&fs_loader0>; ?
How did this even pass the DTC ?So <> is compulsory required for phandle? No error complaint from
DTC.
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Yes
I just checked the codes, this
&fs_loader0without <> is valid, because
this is not a phandle, instead it is a label which will be expanded to
the node's full path.Shouldn't it be a phandle ?
If my memory is correct, i choose label because there is already has API support to read the property from chosen node.
Both phandle and label i believe they serving the same purpose.
Any concern with that?
Quoted 1 line
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
Quoted 77 lines · Tien Fong
Quoted 76 lines · Marek Vasut
Quoted 75 lines · Tien Fong
Quoted 64 lines · Marek Vasut
Quoted 62 lines · Tien Fong
Quoted 59 lines · Marek Vasut
Quoted 51 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading
from
filesystem. The driver are designed based on generic firmware
loader
framework. The driver can handle FPGA program operation from
loading FPGA
bitstream in flash to memory and then to program FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream
and core
bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set
loadable
in DDR for better performance. This loading would be done in
one
large
chunk instead of chunk by chunk loading with small memory buffer.
---
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39+- drivers/fpga/socfpga_arria10.c | 417 ++++++++++++++++++++- 3 files changed, 457 insertions(+), 17 deletions(-)arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi"arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts
Quoted 3 lines
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +3
-0+/ { + chosen { + firmware-loader = &fs_loader0;Shouldn't this be <
&fs_loader0>; ?
How did this even pass the DTC ?Quoted 4 lines
Quoted 3 lines
So <> is compulsory required for phandle? No error complaint from
DTC.Yes
I just checked the codes, this
&fs_loader0without <> is valid, because
this is not a phandle, instead it is a label which will be expanded to
the node's full path.
Quoted 7 lines
Quoted 1 line
Shouldn't it be a phandle ?
If my memory is correct, i choose label because there is already has API support to read the property from chosen node.
Both phandle and label i believe they serving the same purpose.
Any concern with that?
It seems DTs today use phandles, I haven't seen labels much.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
In reply to tien.fong.chee at intel.comQuoted 60 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading from filesystem. The driver are designed based on generic firmware loader framework. The driver can handle FPGA program operation from loading FPGA bitstream in flash to memory and then to program FPGA.
Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream and core bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable in DDR for better performance. This loading would be done in one large chunk instead of chunk by chunk loading with small memory buffer.--- arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417 ++++++++++++++++++++- 3 files changed, 457 insertions(+), 17 deletions(-)arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +18
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi" +/ { + chosen { + firmware-loader = &fs_loader0; + }; + + fs_loader0: fs-loader at 0 { + u-boot,dm-pre-reloc; + compatible = "u-boot,fs-loader"; + phandlepart = <&mmc 1>; + }; +}; + +&fpga_mgr { + u-boot,dm-pre-reloc; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb"; +}; + &mmc { u-boot,dm-pre-reloc; status = "okay";arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +0
-0
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h line 7
Quoted 8 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-1@@ -1,9 +1,13 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2017 Intel Corporation <www.intel.com> +* Copyright (C) 2017-2019 Intel Corporation <www.intel.com> * All rights reserved. */
[...] }
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
Quoted 8 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +8
-0+ +if (!is_fpgamgr_early_user_mode () ||is_fpgamgr_user_mode ()) { + fpga_node_name ="fpga-1" ; +printf ("FPGA: Start to program peripheral bitstream ...\n" ); + }else if (!is_fpgamgr_user_mode ()) { + fpga_node_name ="fpga-2" ; +printf ("FPGA: Start to program core bitstream ...\n" ); + }
Why are you relying on the node name to define the core / periph RBF? Would it not be better to define this in a property? how would one have multiple core and periph rbfs in a single fit image?
--dalon
Quoted 281 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +261
-9+ + node_offset =fit_image_get_node (buffer_p, fpga_node_name); +if (node_offset <0 ) { +debug ("FPGA: Could not find node '%s' in FIT\n" , + fpga_node_name); +return -ENOENT ; + } + +const char *uname =fit_get_name (buffer_p, node_offset,NULL ); + +if (uname) +debug ("FPGA: %s\n" , uname); + + ret =fit_image_get_data_position (buffer_p, node_offset, &rbf_offset); +if (ret <0 ) { +debug ("FPGA: Could not find data position (err=%d)\n" , ret); +return -ENOENT ; + } + + ret =fit_image_get_data_size (buffer_p, node_offset, &rbf_size); +if (ret <0 ) { +debug ("FPGA: Could not find data size (err=%d)\n" , ret); +return -ENOENT ; + } + + ret =fit_image_get_load (buffer_p, node_offset, (ulong *)loadable); +if (ret <0 ) { +debug ("FPGA: Could not find loadable (err=%d)\n" , ret); +debug ("FPGA: Using default buffer and size\n" ); + }else { + buffer_p = (u32 *)*loadable; + buffer_size = rbf_size; +debug ("FPGA: Found loadable address = 0x%x\n" , *loadable); + } + +debug ("FPGA: External data: offset = 0x%x, size = 0x%x\n" , + rbf_offset, rbf_size); + + fpga_loadfs->remaining = rbf_size; + +/* +* Determine buffer size vs bitstream size, and calculating number of +* chunk by chunk transfer is required due to smaller buffer size +* compare to bitstream +*/ +if (rbf_size <= buffer_size) { +/* Loading whole bitstream into buffer */ + buffer_size = rbf_size; + fpga_loadfs->remaining =0 ; + }else { + fpga_loadfs->remaining -= buffer_size; + } + + fpga_loadfs->offset = rbf_offset; +/* Loading bitstream into buffer */ + ret =request_firmware_into_buf (dev, + fpga_loadfs->fpga_fsinfo->filename, + buffer_p, + buffer_size, + fpga_loadfs->offset); +if (ret <0 ) { +debug ("FPGA: Failed to read bitstream from flash.\n" ); +return -ENOENT ; + } + +/* Update next reading bitstream offset */ + fpga_loadfs->offset += buffer_size; + +/* Getting info about bitstream types */ +get_rbf_image_info (&fpga_loadfs->rbfinfo, (u16 *)buffer_p); + +/* Update the final addr for bitstream */ + *buffer = (u32 )buffer_p; + +/* Update the size of bitstream to be programmed into FPGA */ + *buffer_bsize = buffer_size; + +return 0 ; +} + +static int subsequent_loading_rbf_to_buffer (struct udevice *dev, +struct fpga_loadfs_info *fpga_loadfs, +u32 *buffer,size_t *buffer_bsize) +{ +int ret =0 ; +u32 *buffer_p = (u32 *)*buffer; + +/* Read the bitstream chunk by chunk. */ +if (fpga_loadfs->remaining > *buffer_bsize) { + fpga_loadfs->remaining -= *buffer_bsize; + }else { + *buffer_bsize = fpga_loadfs->remaining; + fpga_loadfs->remaining =0 ; + } + + ret =request_firmware_into_buf (dev, + fpga_loadfs->fpga_fsinfo->filename, + buffer_p, + *buffer_bsize, + fpga_loadfs->offset); +if (ret <0 ) { +debug ("FPGA: Failed to read bitstream from flash.\n" ); +return -ENOENT ; + } + +/* Update next reading bitstream offset */ + fpga_loadfs->offset += *buffer_bsize; + +return 0 ; +} + +int socfpga_loadfs (fpga_fs_info *fpga_fsinfo,const void *buf,size_t bsize, +u32 offset) +{ +struct fpga_loadfs_info fpga_loadfs; +int status =0 ; +int ret =0 ; +u32 buffer = (u32 )buf; +size_t buffer_sizebytes = bsize; +size_t buffer_sizebytes_ori = bsize; +size_t total_sizeof_image =0 ; +struct udevice *dev; + + ret =uclass_get_device (UCLASS_FS_FIRMWARE_LOADER ,0 , &dev); +if (ret) +return ret; + +memset (&fpga_loadfs,0 ,sizeof (fpga_loadfs)); + +WATCHDOG_RESET (); + + fpga_loadfs.fpga_fsinfo = fpga_fsinfo; + fpga_loadfs.offset = offset; + +printf ("FPGA: Start to program ...\n" ); + +/* +* Note: Both buffer and buffer_sizebytes values can be altered by +* function below. +*/ + ret =first_loading_rbf_to_buffer (dev, &fpga_loadfs, &buffer, + &buffer_sizebytes); +if (ret) +return ret; + +if (fpga_loadfs.rbfinfo.section == core_section && + !(is_fpgamgr_early_user_mode () && !is_fpgamgr_user_mode ())) { +debug ("FPGA : Must be in Early Release mode to program " ); +debug ("core bitstream.\n" ); +return 0 ; + } + +/* Disable all signals from HPS peripheral controller to FPGA */ +writel (0 , &system_manager_base->fpgaintf_en_global); + +/* Disable all axi bridges (hps2fpga, lwhps2fpga & fpga2hps) */ +socfpga_bridges_reset (); + +if (fpga_loadfs.rbfinfo.section == periph_section) { +/* Initialize the FPGA Manager */ + status =fpgamgr_program_init ((u32 *)buffer, buffer_sizebytes); +if (status) { +debug ("FPGA: Init with peripheral bitstream failed.\n" ); +return -EPERM ; + } + } + +WATCHDOG_RESET (); + +/* Transfer bitstream to FPGA Manager */ +fpgamgr_program_write ((void *)buffer, buffer_sizebytes); + + total_sizeof_image += buffer_sizebytes; + +WATCHDOG_RESET (); + +while (fpga_loadfs.remaining) { + ret =subsequent_loading_rbf_to_buffer (dev, + &fpga_loadfs, + &buffer, + &buffer_sizebytes_ori); + +if (ret) +return ret; + +/* Transfer data to FPGA Manager */ +fpgamgr_program_write ((void *)buffer, + buffer_sizebytes_ori); + + total_sizeof_image += buffer_sizebytes_ori; + +WATCHDOG_RESET (); + } + +if (fpga_loadfs.rbfinfo.section == periph_section) { +if (fpgamgr_wait_early_user_mode () != -ETIMEDOUT ) { +config_pins (gd->fdt_blob,"shared" ); +puts ("FPGA: Early Release Succeeded.\n" ); + }else { +debug ("FPGA: Failed to see Early Release.\n" ); +return -EIO ; + } + +/* For monolithic bitstream */ +if (is_fpgamgr_user_mode ()) { +/* Ensure the FPGA entering config done */ + status =fpgamgr_program_finish (); +if (status) +return status; + +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + } + }else if (fpga_loadfs.rbfinfo.section == core_section) { +/* Ensure the FPGA entering config done */ + status =fpgamgr_program_finish (); +if (status) +return status; + +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + }else { +debug ("FPGA: Config Error: Unsupported bitstream type.\n" ); +return -ENOEXEC ; + } + +return (int )total_sizeof_image; +} +#endif + +/* This function is used to load the core bitstream from the OCRAM. */ int socfpga_load (Altera_desc *desc,const void *rbf_data,size_t rbf_size) { -int status; +unsigned long status; +struct rbf_info rbfinfo; -/* disable all signals from hps peripheral controller to fpga */ +memset (&rbfinfo,0 ,sizeof (rbfinfo)); + +/* Disable all signals from hps peripheral controller to fpga */ writel (0 , &system_manager_base->fpgaintf_en_global); -/* disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */ +/* Disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */ socfpga_bridges_reset (); -/* Initialize the FPGA Manager */ - status =fpgamgr_program_init ((u32 *)rbf_data, rbf_size); -if (status) -return status; +/* Getting info about bitstream types */ +get_rbf_image_info (&rbfinfo, (u16 *)rbf_data); + +if (rbfinfo.section == periph_section) { +/* Initialize the FPGA Manager */ + status =fpgamgr_program_init ((u32 *)rbf_data, rbf_size); +if (status) +return status; + } + +if (rbfinfo.section == core_section && + !(is_fpgamgr_early_user_mode () && !is_fpgamgr_user_mode ())) { +debug ("FPGA : Must be in early release mode to program " ); +debug ("core bitstream.\n" ); +return 0 ; + } -/* Write the RBF data to FPGA Manager */ +/* Write the bitstream to FPGA Manager */ fpgamgr_program_write (rbf_data, rbf_size); -return fpgamgr_program_finish (); + status =fpgamgr_program_finish (); +if (status) { +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + } + +return status; }
Chee
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
Quoted 79 lines · Dalon L Westergreen
Quoted 74 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading from
filesystem. The driver are designed based on generic firmware loader
framework. The driver can handle FPGA program operation from loading FPGA
bitstream in flash to memory and then to program FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream and core
bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable
in DDR for better performance. This loading would be done in one large
chunk instead of chunk by chunk loading with small memory buffer.
---
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417
++++++++++++++++++++-3 files changed, 457 insertions(+), 17 deletions(-)arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi"arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +18
-0+/ { + chosen { + firmware-loader = &fs_loader0; + }; + + fs_loader0: fs-loader at 0 { + u-boot,dm-pre-reloc; + compatible = "u-boot,fs-loader"; + phandlepart = <&mmc 1>; + }; +}; + +&fpga_mgr { + u-boot,dm-pre-reloc; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb"; +}; +&mmc {
u-boot,dm-pre-reloc;
status = "okay";(quoted diff) +0
-0
socfpga/include/mach/fpga_manager_arria10.hb/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.hindex 09d13f6..683c84c 100644arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-1@@ -1,9 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2017 Intel Corporation <www.intel.com> +* Copyright (C) 2017-2019 Intel Corporation <www.intel.com> * All rights reserved. */ Quoted 2 lines
[...] }
Quoted 1 line
Quoted 14 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
Quoted 11 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ + if (!is_fpgamgr_early_user_mode() ||
is_fpgamgr_user_mode()) {arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ fpga_node_name ="fpga-1" ; + printf("FPGA: Start to program peripheralbitstream ...\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+ }else if (!is_fpgamgr_user_mode ()) { + fpga_node_name ="fpga-2" ; + printf("FPGA: Start to program core bitstream...\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ }Why are you relying on the node name to define the core / periph RBF? Would
it not be better to define this in a property?
I need to ensure correct sequence of programming the rbf images at different FPGA mode. fpga with index 1 always means the 1st to program.
Quoted 2 lines
how would one have multiple
core and periph rbfs in a single fit image?
I want strict control to avoid the performance penalty, when this happen, performance is almost same as programming full image.
So, in a single FIT image, only have one core rbf and periph rbf, and core rbf must always be the 1st and with the right absolute data position to avoid the buffer unaligned. Strict sequence control is also one of the reason having one core rbf and one periph rbf in a single FIT image.
You can create multiple FIT image for multiple core and periph rbfs. There are properties such as "altr,bitstream" and "altr,bitstream-core" for supporting different FIT image.
You can change those properties in U-Boot env(for runtime), or using different DTS for differnt configuration.
Quoted 328 lines
--dalon
Quoted 325 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ + node_offset = fit_image_get_node(buffer_p,
fpga_node_name);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +7
-0+if (node_offset <0 ) { +debug ("FPGA: Could not find node '%s' in FIT\n" , + fpga_node_name); +return -ENOENT ; + } + + const char *uname = fit_get_name(buffer_p, node_offset,NULL);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ +if (uname) +debug ("FPGA: %s\n" , uname); + + ret = fit_image_get_data_position(buffer_p, node_offset,
&rbf_offset);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (ret <0 ) { + debug("FPGA: Could not find data position(err=%d)\n", ret);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+return -ENOENT ; + } + + ret = fit_image_get_data_size(buffer_p, node_offset,
&rbf_size);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (ret <0 ) { + debug("FPGA: Could not find data size (err=%d)\n",ret);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+return -ENOENT ; + } + + ret = fit_image_get_load(buffer_p, node_offset, (ulong*)loadable);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (ret <0 ) { + debug("FPGA: Could not find loadable (err=%d)\n",ret);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+debug ("FPGA: Using default buffer and size\n" ); + }else { + buffer_p = (u32 *)*loadable; + buffer_size = rbf_size; + debug("FPGA: Found loadable address = 0x%x\n",*loadable);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +9
-0+ } + +debug ("FPGA: External data: offset = 0x%x, size = 0x%x\n" , + rbf_offset, rbf_size); + + fpga_loadfs->remaining = rbf_size; + +/* +* Determine buffer size vs bitstream size, and calculating number of
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ * chunk by chunk transfer is required due to smallerbuffer size
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +14
-0+* compare to bitstream +*/ +if (rbf_size <= buffer_size) { +/* Loading whole bitstream into buffer */ + buffer_size = rbf_size; + fpga_loadfs->remaining =0 ; + }else { + fpga_loadfs->remaining -= buffer_size; + } + + fpga_loadfs->offset = rbf_offset; +/* Loading bitstream into buffer */ + ret = request_firmware_into_buf(dev, + fpga_loadfs->fpga_fsinfo-Quoted 1 line
filename,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ buffer_p, + buffer_size, + fpga_loadfs->offset); +if (ret <0 ) { + debug("FPGA: Failed to read bitstream fromflash.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +8
-0+return -ENOENT ; + } + +/* Update next reading bitstream offset */ + fpga_loadfs->offset += buffer_size; + +/* Getting info about bitstream types */ + get_rbf_image_info(&fpga_loadfs->rbfinfo, (u16*)buffer_p);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ +/* Update the final addr for bitstream */ + *buffer = (u32 )buffer_p; + +/* Update the size of bitstream to be programmed into FPGA */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +7
-0+ *buffer_bsize = buffer_size; + +return 0 ; +} + +static int subsequent_loading_rbf_to_buffer (struct udevice *dev, + struct fpga_loadfs_info
*fpga_loadfs,arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+u32 *buffer, size_t
*buffer_bsize)arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +14
-0+{ +int ret =0 ; +u32 *buffer_p = (u32 *)*buffer; + +/* Read the bitstream chunk by chunk. */ +if (fpga_loadfs->remaining > *buffer_bsize) { + fpga_loadfs->remaining -= *buffer_bsize; + }else { + *buffer_bsize = fpga_loadfs->remaining; + fpga_loadfs->remaining =0 ; + } + + ret = request_firmware_into_buf(dev, + fpga_loadfs->fpga_fsinfo-Quoted 1 line
filename,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ buffer_p, + *buffer_bsize, + fpga_loadfs->offset); +if (ret <0 ) { + debug("FPGA: Failed to read bitstream fromflash.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +10
-0+return -ENOENT ; + } + +/* Update next reading bitstream offset */ + fpga_loadfs->offset += *buffer_bsize; + +return 0 ; +} + +int socfpga_loadfs(fpga_fs_info *fpga_fsinfo, const void *buf,
size_tbsize,arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +12
-0+ u32 offset) +{ +struct fpga_loadfs_info fpga_loadfs; +int status =0 ; +int ret =0 ; +u32 buffer = (u32 )buf; +size_t buffer_sizebytes = bsize; +size_t buffer_sizebytes_ori = bsize; +size_t total_sizeof_image =0 ; +struct udevice *dev; + + ret = uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0,&dev);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +14
-0+if (ret) +return ret; + +memset (&fpga_loadfs,0 ,sizeof (fpga_loadfs)); + +WATCHDOG_RESET (); + + fpga_loadfs.fpga_fsinfo = fpga_fsinfo; + fpga_loadfs.offset = offset; + +printf ("FPGA: Start to program ...\n" ); + +/* +* Note: Both buffer and buffer_sizebytes values can be altered by
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+* function below. +*/ + ret = first_loading_rbf_to_buffer(dev, &fpga_loadfs,&buffer,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-0+ &buffer_sizebytes); +if (ret) +return ret; + + if (fpga_loadfs.rbfinfo.section == core_section && + !(is_fpgamgr_early_user_mode() &&!is_fpgamgr_user_mode())) {
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ debug("FPGA : Must be in Early Release mode toprogram ");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+debug ("core bitstream.\n" ); +return 0 ; + } + +/* Disable all signals from HPS peripheral controller to FPGA */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+writel (0 , &system_manager_base->fpgaintf_en_global); + +/* Disable all axi bridges (hps2fpga, lwhps2fpga & fpga2hps) */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+socfpga_bridges_reset (); + +if (fpga_loadfs.rbfinfo.section == periph_section) { +/* Initialize the FPGA Manager */ + status = fpgamgr_program_init((u32 *)buffer,
buffer_sizebytes);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (status) { + debug("FPGA: Init with peripheralbitstream failed.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +16
-0+return -EPERM ; + } + } + +WATCHDOG_RESET (); + +/* Transfer bitstream to FPGA Manager */ +fpgamgr_program_write ((void *)buffer, buffer_sizebytes); + + total_sizeof_image += buffer_sizebytes; + +WATCHDOG_RESET (); + +while (fpga_loadfs.remaining) { + ret =subsequent_loading_rbf_to_buffer (dev, + &fpga_loadfs,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ &buffer, + &buffer_si
zebytes_ori);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +15
-0+ +if (ret) +return ret; + +/* Transfer data to FPGA Manager */ +fpgamgr_program_write ((void *)buffer, + buffer_sizebytes_ori); + + total_sizeof_image += buffer_sizebytes_ori; + +WATCHDOG_RESET (); + } + +if (fpga_loadfs.rbfinfo.section == periph_section) { +if (fpgamgr_wait_early_user_mode () != -ETIMEDOUT ){
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+config_pins (gd->fdt_blob,"shared" ); +puts ("FPGA: Early Release Succeeded.\n" ); + }else { + debug("FPGA: Failed to see EarlyRelease.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +23
-0+return -EIO ; + } + +/* For monolithic bitstream */ +if (is_fpgamgr_user_mode ()) { +/* Ensure the FPGA entering config done */ + status =fpgamgr_program_finish (); +if (status) +return status; + +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + } + }else if (fpga_loadfs.rbfinfo.section == core_section) { +/* Ensure the FPGA entering config done */ + status =fpgamgr_program_finish (); +if (status) +return status; + +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + }else { + debug("FPGA: Config Error: Unsupported bitstreamtype.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +8
-0+ return -ENOEXEC; + } + +return (int )total_sizeof_image; +} +#endif + +/* This function is used to load the core bitstream from the OCRAM. */
intsocfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size)
{arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-1-int status; +unsigned long status; +struct rbf_info rbfinfo;arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +0
-1-/* disable all signals from hps peripheral controller to fpga */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+memset (&rbfinfo,0 ,sizeof (rbfinfo)); + +/* Disable all signals from hps peripheral controller to fpga */
writel(0, &system_manager_base->fpgaintf_en_global);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +0
-1-/* disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+/* Disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */
socfpga_bridges_reset();arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-4-/* Initialize the FPGA Manager */ - status =fpgamgr_program_init ((u32 *)rbf_data, rbf_size); -if (status) -return status; +/* Getting info about bitstream types */ +get_rbf_image_info (&rbfinfo, (u16 *)rbf_data); + +if (rbfinfo.section == periph_section) { +/* Initialize the FPGA Manager */ + status = fpgamgr_program_init((u32 *)rbf_data,
rbf_size);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-0+if (status) +return status; + } + + if (rbfinfo.section == core_section && + !(is_fpgamgr_early_user_mode() &&!is_fpgamgr_user_mode())) {
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ debug("FPGA : Must be in early release mode toprogram ");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+debug ("core bitstream.\n" ); +return 0 ; + }arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-1-/* Write the RBF data to FPGA Manager */ +/* Write the bitstream to FPGA Manager */
fpgamgr_program_write(rbf_data, rbf_size);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +7
-1-return fpgamgr_program_finish (); + status =fpgamgr_program_finish (); +if (status) { +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + } + +return status;}
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
Quoted 99 lines · Tien Fong
Quoted 79 lines · Dalon L Westergreen
Quoted 74 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading from
filesystem. The driver are designed based on generic firmware loader
framework. The driver can handle FPGA program operation from loading FPGA
bitstream in flash to memory and then to program FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream and core
bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable
in DDR for better performance. This loading would be done in one large
chunk instead of chunk by chunk loading with small memory buffer.
---
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417
++++++++++++++++++++-3 files changed, 457 insertions(+), 17 deletions(-)arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi"arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +18
-0+/ { + chosen { + firmware-loader = &fs_loader0; + }; + + fs_loader0: fs-loader at 0 { + u-boot,dm-pre-reloc; + compatible = "u-boot,fs-loader"; + phandlepart = <&mmc 1>; + }; +}; + +&fpga_mgr { + u-boot,dm-pre-reloc; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb"; +}; +&mmc {
u-boot,dm-pre-reloc;
status = "okay";(quoted diff) +0
-0
socfpga/include/mach/fpga_manager_arria10.hb/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.hindex 09d13f6..683c84c 100644arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-1@@ -1,9 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2017 Intel Corporation <www.intel.com> +* Copyright (C) 2017-2019 Intel Corporation <www.intel.com> * All rights reserved. */ Quoted 2 lines
[...] }
Quoted 1 line
Quoted 14 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
Quoted 11 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ + if (!is_fpgamgr_early_user_mode() ||
is_fpgamgr_user_mode()) {arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ fpga_node_name ="fpga-1" ; + printf("FPGA: Start to program peripheralbitstream ...\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+ }else if (!is_fpgamgr_user_mode ()) { + fpga_node_name ="fpga-2" ; + printf("FPGA: Start to program core bitstream...\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ }Why are you relying on the node name to define the core / periph RBF? Would
it not be better to define this in a property?I need to ensure correct sequence of programming the rbf images at different FPGA mode. fpga with index 1 always means the 1st to program.
Quoted 2 lines
how would one have multiple
core and periph rbfs in a single fit image?
Quoted 8 lines
I want strict control to avoid the performance penalty, when this happen, performance is almost same as programming full image.
So, in a single FIT image, only have one core rbf and periph rbf, and core rbf must always be the 1st and with the right absolute data position to avoid the buffer unaligned. Strict sequence control is also one of the reason having one core rbf and one periph rbf in a single FIT image.
I thought we established that you cannot depend on the placement and alignment of files within fitImage ?
Also, you should be able to use fitImage configurations to select from multiple core and periph RBFs, there's no point in limiting ourselves to 1 core and 1 periph RBF with flexible format such as the fitImage.
Quoted 335 lines
You can create multiple FIT image for multiple core and periph rbfs. There are properties such as "altr,bitstream" and "altr,bitstream-core" for supporting different FIT image.
You can change those properties in U-Boot env(for runtime), or using different DTS for differnt configuration.
Quoted 328 lines
--dalon
Quoted 325 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ + node_offset = fit_image_get_node(buffer_p,
fpga_node_name);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +7
-0+if (node_offset <0 ) { +debug ("FPGA: Could not find node '%s' in FIT\n" , + fpga_node_name); +return -ENOENT ; + } + + const char *uname = fit_get_name(buffer_p, node_offset,NULL);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ +if (uname) +debug ("FPGA: %s\n" , uname); + + ret = fit_image_get_data_position(buffer_p, node_offset,
&rbf_offset);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (ret <0 ) { + debug("FPGA: Could not find data position(err=%d)\n", ret);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+return -ENOENT ; + } + + ret = fit_image_get_data_size(buffer_p, node_offset,
&rbf_size);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (ret <0 ) { + debug("FPGA: Could not find data size (err=%d)\n",ret);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+return -ENOENT ; + } + + ret = fit_image_get_load(buffer_p, node_offset, (ulong*)loadable);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (ret <0 ) { + debug("FPGA: Could not find loadable (err=%d)\n",ret);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+debug ("FPGA: Using default buffer and size\n" ); + }else { + buffer_p = (u32 *)*loadable; + buffer_size = rbf_size; + debug("FPGA: Found loadable address = 0x%x\n",*loadable);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +9
-0+ } + +debug ("FPGA: External data: offset = 0x%x, size = 0x%x\n" , + rbf_offset, rbf_size); + + fpga_loadfs->remaining = rbf_size; + +/* +* Determine buffer size vs bitstream size, and calculating number of
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ * chunk by chunk transfer is required due to smallerbuffer size
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +14
-0+* compare to bitstream +*/ +if (rbf_size <= buffer_size) { +/* Loading whole bitstream into buffer */ + buffer_size = rbf_size; + fpga_loadfs->remaining =0 ; + }else { + fpga_loadfs->remaining -= buffer_size; + } + + fpga_loadfs->offset = rbf_offset; +/* Loading bitstream into buffer */ + ret = request_firmware_into_buf(dev, + fpga_loadfs->fpga_fsinfo-Quoted 1 line
filename,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ buffer_p, + buffer_size, + fpga_loadfs->offset); +if (ret <0 ) { + debug("FPGA: Failed to read bitstream fromflash.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +8
-0+return -ENOENT ; + } + +/* Update next reading bitstream offset */ + fpga_loadfs->offset += buffer_size; + +/* Getting info about bitstream types */ + get_rbf_image_info(&fpga_loadfs->rbfinfo, (u16*)buffer_p);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ +/* Update the final addr for bitstream */ + *buffer = (u32 )buffer_p; + +/* Update the size of bitstream to be programmed into FPGA */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +7
-0+ *buffer_bsize = buffer_size; + +return 0 ; +} + +static int subsequent_loading_rbf_to_buffer (struct udevice *dev, + struct fpga_loadfs_info
*fpga_loadfs,arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+u32 *buffer, size_t
*buffer_bsize)arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +14
-0+{ +int ret =0 ; +u32 *buffer_p = (u32 *)*buffer; + +/* Read the bitstream chunk by chunk. */ +if (fpga_loadfs->remaining > *buffer_bsize) { + fpga_loadfs->remaining -= *buffer_bsize; + }else { + *buffer_bsize = fpga_loadfs->remaining; + fpga_loadfs->remaining =0 ; + } + + ret = request_firmware_into_buf(dev, + fpga_loadfs->fpga_fsinfo-Quoted 1 line
filename,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ buffer_p, + *buffer_bsize, + fpga_loadfs->offset); +if (ret <0 ) { + debug("FPGA: Failed to read bitstream fromflash.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +10
-0+return -ENOENT ; + } + +/* Update next reading bitstream offset */ + fpga_loadfs->offset += *buffer_bsize; + +return 0 ; +} + +int socfpga_loadfs(fpga_fs_info *fpga_fsinfo, const void *buf,
size_tbsize,arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +12
-0+ u32 offset) +{ +struct fpga_loadfs_info fpga_loadfs; +int status =0 ; +int ret =0 ; +u32 buffer = (u32 )buf; +size_t buffer_sizebytes = bsize; +size_t buffer_sizebytes_ori = bsize; +size_t total_sizeof_image =0 ; +struct udevice *dev; + + ret = uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0,&dev);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +14
-0+if (ret) +return ret; + +memset (&fpga_loadfs,0 ,sizeof (fpga_loadfs)); + +WATCHDOG_RESET (); + + fpga_loadfs.fpga_fsinfo = fpga_fsinfo; + fpga_loadfs.offset = offset; + +printf ("FPGA: Start to program ...\n" ); + +/* +* Note: Both buffer and buffer_sizebytes values can be altered by
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+* function below. +*/ + ret = first_loading_rbf_to_buffer(dev, &fpga_loadfs,&buffer,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-0+ &buffer_sizebytes); +if (ret) +return ret; + + if (fpga_loadfs.rbfinfo.section == core_section && + !(is_fpgamgr_early_user_mode() &&!is_fpgamgr_user_mode())) {
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ debug("FPGA : Must be in Early Release mode toprogram ");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+debug ("core bitstream.\n" ); +return 0 ; + } + +/* Disable all signals from HPS peripheral controller to FPGA */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+writel (0 , &system_manager_base->fpgaintf_en_global); + +/* Disable all axi bridges (hps2fpga, lwhps2fpga & fpga2hps) */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+socfpga_bridges_reset (); + +if (fpga_loadfs.rbfinfo.section == periph_section) { +/* Initialize the FPGA Manager */ + status = fpgamgr_program_init((u32 *)buffer,
buffer_sizebytes);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (status) { + debug("FPGA: Init with peripheralbitstream failed.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +16
-0+return -EPERM ; + } + } + +WATCHDOG_RESET (); + +/* Transfer bitstream to FPGA Manager */ +fpgamgr_program_write ((void *)buffer, buffer_sizebytes); + + total_sizeof_image += buffer_sizebytes; + +WATCHDOG_RESET (); + +while (fpga_loadfs.remaining) { + ret =subsequent_loading_rbf_to_buffer (dev, + &fpga_loadfs,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ &buffer, + &buffer_si
zebytes_ori);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +15
-0+ +if (ret) +return ret; + +/* Transfer data to FPGA Manager */ +fpgamgr_program_write ((void *)buffer, + buffer_sizebytes_ori); + + total_sizeof_image += buffer_sizebytes_ori; + +WATCHDOG_RESET (); + } + +if (fpga_loadfs.rbfinfo.section == periph_section) { +if (fpgamgr_wait_early_user_mode () != -ETIMEDOUT ){
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+config_pins (gd->fdt_blob,"shared" ); +puts ("FPGA: Early Release Succeeded.\n" ); + }else { + debug("FPGA: Failed to see EarlyRelease.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +23
-0+return -EIO ; + } + +/* For monolithic bitstream */ +if (is_fpgamgr_user_mode ()) { +/* Ensure the FPGA entering config done */ + status =fpgamgr_program_finish (); +if (status) +return status; + +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + } + }else if (fpga_loadfs.rbfinfo.section == core_section) { +/* Ensure the FPGA entering config done */ + status =fpgamgr_program_finish (); +if (status) +return status; + +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + }else { + debug("FPGA: Config Error: Unsupported bitstreamtype.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +8
-0+ return -ENOEXEC; + } + +return (int )total_sizeof_image; +} +#endif + +/* This function is used to load the core bitstream from the OCRAM. */
intsocfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size)
{arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-1-int status; +unsigned long status; +struct rbf_info rbfinfo;arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +0
-1-/* disable all signals from hps peripheral controller to fpga */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+memset (&rbfinfo,0 ,sizeof (rbfinfo)); + +/* Disable all signals from hps peripheral controller to fpga */
writel(0, &system_manager_base->fpgaintf_en_global);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +0
-1-/* disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+/* Disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */
socfpga_bridges_reset();arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-4-/* Initialize the FPGA Manager */ - status =fpgamgr_program_init ((u32 *)rbf_data, rbf_size); -if (status) -return status; +/* Getting info about bitstream types */ +get_rbf_image_info (&rbfinfo, (u16 *)rbf_data); + +if (rbfinfo.section == periph_section) { +/* Initialize the FPGA Manager */ + status = fpgamgr_program_init((u32 *)rbf_data,
rbf_size);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-0+if (status) +return status; + } + + if (rbfinfo.section == core_section && + !(is_fpgamgr_early_user_mode() &&!is_fpgamgr_user_mode())) {
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ debug("FPGA : Must be in early release mode toprogram ");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+debug ("core bitstream.\n" ); +return 0 ; + }arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-1-/* Write the RBF data to FPGA Manager */ +/* Write the bitstream to FPGA Manager */
fpgamgr_program_write(rbf_data, rbf_size);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +7
-1-return fpgamgr_program_finish (); + status =fpgamgr_program_finish (); +if (status) { +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + } + +return status;}
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 3/7 ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading
Quoted 123 lines · Marek Vasut
Quoted 114 lines · Tien Fong
Quoted 87 lines · Dalon L Westergreen
Quoted 79 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Add FPGA driver to support program FPGA with FPGA bitstream loading
from
filesystem. The driver are designed based on generic firmware loader
framework. The driver can handle FPGA program operation from loading FPGA
bitstream in flash to memory and then to program FPGA.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Restructure the FPGA driver to support both peripheral bitstream
and core
bitstream bundled into FIT image.
- Support loadable property for core bitstream. User can set loadable
in DDR for better performance. This loading would be done in one
large
chunk instead of chunk by chunk loading with small memory buffer.
---
arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts | 18 + .../include/mach/fpga_manager_arria10.h | 39 +- drivers/fpga/socfpga_arria10.c | 417
++++++++++++++++++++-3 files changed, 457 insertions(+), 17 deletions(-)arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +0
-0@@ -18,6 +18,24 @@ /dts-v1/; #include "socfpga_arria10_socdk.dtsi"arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts +18
-0+/ { + chosen { + firmware-loader = &fs_loader0; + }; + + fs_loader0: fs-loader at 0 { + u-boot,dm-pre-reloc; + compatible = "u-boot,fs-loader"; + phandlepart = <&mmc 1>; + }; +}; + +&fpga_mgr { + u-boot,dm-pre-reloc; + altr,bitstream = "fit_spl_fpga.itb"; + altr,bitstream-core = "fit_spl_fpga.itb"; +}; +&mmc {
u-boot,dm-pre-reloc;
status = "okay";(quoted diff) +0
-0
socfpga/include/mach/fpga_manager_arria10.hb/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.hindex 09d13f6..683c84c 100644arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-1@@ -1,9 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2017 Intel Corporation <www.intel.com> +* Copyright (C) 2017-2019 Intel Corporation <www.intel.com> * All rights reserved. */ Quoted 2 lines
[...] }
Quoted 2 lines
Quoted 15 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
Quoted 11 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ + if (!is_fpgamgr_early_user_mode() ||
is_fpgamgr_user_mode()) {arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ fpga_node_name ="fpga-1" ; + printf("FPGA: Start to program peripheralbitstream ...\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+ }else if (!is_fpgamgr_user_mode ()) { + fpga_node_name ="fpga-2" ; + printf("FPGA: Start to program core bitstream...\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ }Why are you relying on the node name to define the core / periph RBF?
Would
it not be better to define this in a property?I need to ensure correct sequence of programming the rbf images at different FPGA mode. fpga with index 1 always means the 1st to program.
Quoted 3 lines
how would one have multiple
core and periph rbfs in a single fit image?I want strict control to avoid the performance penalty, when this happen, performance is almost same as programming full image.
Quoted 8 lines
So, in a single FIT image, only have one core rbf and periph rbf, and
core rbf must always be the 1st and with the right absolute data position to avoid the buffer unaligned. Strict sequence control is also
one of the reason having one core rbf and one periph rbf in a single
FIT image.
Quoted 2 lines
I thought we established that you cannot depend on the placement and alignment of files within fitImage ?
This is just workaround, until performance penalty issue at reading cluster is solved. See the details of explanation at patch 2/7.
Quoted 6 lines
Also, you should be able to use fitImage configurations to select from
multiple core and periph RBFs, there's no point in limiting ourselves to
1 core and 1 periph RBF with flexible format such as the fitImage.
See the details of explanation/proposal at patch 1/7.
Quoted 372 lines
Quoted 371 lines
You can create multiple FIT image for multiple core and periph rbfs.
There are properties such as "altr,bitstream" and "altr,bitstream- core"
for supporting different FIT image.You can change those properties in U-Boot env(for runtime), or using
different DTS for differnt configuration.Quoted 359 lines
--dalon
Quoted 355 lines
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ + node_offset = fit_image_get_node(buffer_p,
fpga_node_name);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (node_offset <0 ) { + debug("FPGA: Could not find node '%s' inFIT\n",
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ fpga_node_name); +return -ENOENT ; + } + + const char *uname = fit_get_name(buffer_p,
node_offset,
NULL);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ +if (uname) +debug ("FPGA: %s\n" , uname); + + ret = fit_image_get_data_position(buffer_p,
node_offset,&rbf_offset);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (ret <0 ) { + debug("FPGA: Could not find data position(err=%d)\n", ret);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+return -ENOENT ; + } + + ret = fit_image_get_data_size(buffer_p, node_offset,
&rbf_size);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (ret <0 ) { + debug("FPGA: Could not find data size(err=%d)\n",
ret);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+return -ENOENT ; + } + + ret = fit_image_get_load(buffer_p, node_offset, (ulong*)loadable);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (ret <0 ) { + debug("FPGA: Could not find loadable(err=%d)\n",
ret);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ debug("FPGA: Using default buffer andsize\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +4
-0+ }else { + buffer_p = (u32 *)*loadable; + buffer_size = rbf_size; + debug("FPGA: Found loadable address = 0x%x\n",*loadable);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+ } + + debug("FPGA: External data: offset = 0x%x, size =0x%x\n",
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-0+ rbf_offset, rbf_size); + + fpga_loadfs->remaining = rbf_size; + +/* +* Determine buffer size vs bitstream size, and calculating number of
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ * chunk by chunk transfer is required due to smallerbuffer size
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +14
-0+* compare to bitstream +*/ +if (rbf_size <= buffer_size) { +/* Loading whole bitstream into buffer */ + buffer_size = rbf_size; + fpga_loadfs->remaining =0 ; + }else { + fpga_loadfs->remaining -= buffer_size; + } + + fpga_loadfs->offset = rbf_offset; +/* Loading bitstream into buffer */ + ret = request_firmware_into_buf(dev, + fpga_loadfs-Quoted 3 lines
fpga_fsinfo-
filename,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ buffer_p, + buffer_size, + fpga_loadfs->offset); +if (ret <0 ) { + debug("FPGA: Failed to read bitstream fromflash.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +8
-0+return -ENOENT ; + } + +/* Update next reading bitstream offset */ + fpga_loadfs->offset += buffer_size; + +/* Getting info about bitstream types */ + get_rbf_image_info(&fpga_loadfs->rbfinfo, (u16*)buffer_p);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ +/* Update the final addr for bitstream */ + *buffer = (u32 )buffer_p; + +/* Update the size of bitstream to be programmed into FPGA
*/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-0+ *buffer_bsize = buffer_size; + +return 0 ; +} + +static int subsequent_loading_rbf_to_buffer(struct udevice*dev,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ struct
fpga_loadfs_info*fpga_loadfs,arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+u32 *buffer, size_t
*buffer_bsize)arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +14
-0+{ +int ret =0 ; +u32 *buffer_p = (u32 *)*buffer; + +/* Read the bitstream chunk by chunk. */ +if (fpga_loadfs->remaining > *buffer_bsize) { + fpga_loadfs->remaining -= *buffer_bsize; + }else { + *buffer_bsize = fpga_loadfs->remaining; + fpga_loadfs->remaining =0 ; + } + + ret = request_firmware_into_buf(dev, + fpga_loadfs-Quoted 3 lines
fpga_fsinfo-
filename,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+ buffer_p, + *buffer_bsize, + fpga_loadfs->offset); +if (ret <0 ) { + debug("FPGA: Failed to read bitstream fromflash.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +10
-0+return -ENOENT ; + } + +/* Update next reading bitstream offset */ + fpga_loadfs->offset += *buffer_bsize; + +return 0 ; +} + +int socfpga_loadfs(fpga_fs_info *fpga_fsinfo, const void *buf,
size_tbsize,arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +12
-0+ u32 offset) +{ +struct fpga_loadfs_info fpga_loadfs; +int status =0 ; +int ret =0 ; +u32 buffer = (u32 )buf; +size_t buffer_sizebytes = bsize; +size_t buffer_sizebytes_ori = bsize; +size_t total_sizeof_image =0 ; +struct udevice *dev; + + ret = uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0,&dev);
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +14
-0+if (ret) +return ret; + +memset (&fpga_loadfs,0 ,sizeof (fpga_loadfs)); + +WATCHDOG_RESET (); + + fpga_loadfs.fpga_fsinfo = fpga_fsinfo; + fpga_loadfs.offset = offset; + +printf ("FPGA: Start to program ...\n" ); + +/* +* Note: Both buffer and buffer_sizebytes values can be
altered byarch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+* function below. +*/ + ret = first_loading_rbf_to_buffer(dev, &fpga_loadfs,&buffer,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-0+ &buffer_sizebytes); +if (ret) +return ret; + + if (fpga_loadfs.rbfinfo.section == core_section && + !(is_fpgamgr_early_user_mode() &&!is_fpgamgr_user_mode())) {
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ debug("FPGA : Must be in Early Release mode toprogram ");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+debug ("core bitstream.\n" ); +return 0 ; + } + +/* Disable all signals from HPS peripheral controller to
FPGA */arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+writel (0 , &system_manager_base->fpgaintf_en_global); + +/* Disable all axi bridges (hps2fpga, lwhps2fpga & fpga2hps) */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +5
-0+socfpga_bridges_reset (); + +if (fpga_loadfs.rbfinfo.section == periph_section) { +/* Initialize the FPGA Manager */ + status = fpgamgr_program_init((u32 *)buffer,
buffer_sizebytes);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+if (status) { + debug("FPGA: Init with peripheralbitstream failed.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +8
-0+return -EPERM ; + } + } + +WATCHDOG_RESET (); + +/* Transfer bitstream to FPGA Manager */ + fpgamgr_program_write((void *)buffer,
buffer_sizebytes);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +8
-0+ + total_sizeof_image += buffer_sizebytes; + +WATCHDOG_RESET (); + +while (fpga_loadfs.remaining) { + ret =subsequent_loading_rbf_to_buffer (dev, + &fpga_load
fs,arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ &buffer,
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ &buffe
r_sizebytes_ori);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +15
-1+ +if (ret) +return ret; + +/* Transfer data to FPGA Manager */ +fpgamgr_program_write ((void *)buffer, + buffer_sizebytes_ori); + + total_sizeof_image += buffer_sizebytes_ori; + +WATCHDOG_RESET (); + } + +if (fpga_loadfs.rbfinfo.section == periph_section) { + if (fpgamgr_wait_early_user_mode() != -ETIMEDOUT){
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+config_pins (gd->fdt_blob,"shared" ); + puts("FPGA: Early ReleaseSucceeded.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-0+ }else { + debug("FPGA: Failed to see EarlyRelease.\n");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-0+return -EIO ; + } + +/* For monolithic bitstream */ +if (is_fpgamgr_user_mode ()) { +/* Ensure the FPGA entering config done */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +8
-0+ status =fpgamgr_program_finish (); +if (status) +return status; + +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + } + } else if (fpga_loadfs.rbfinfo.section ==
core_section) {arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +9
-0+/* Ensure the FPGA entering config done */ + status =fpgamgr_program_finish (); +if (status) +return status; + +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + }else { + debug("FPGA: Config Error: Unsupportedbitstream
type.\n");arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +8
-0+ return -ENOEXEC; + } + +return (int )total_sizeof_image; +} +#endif + +/* This function is used to load the core bitstream from the OCRAM. */
int socfpga_load(Altera_desc *desc, const void*rbf_data,size_trbf_size)
{arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +2
-1-int status; +unsigned long status; +struct rbf_info rbfinfo;arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +0
-1-/* disable all signals from hps peripheral controller to
fpga */arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+memset (&rbfinfo,0 ,sizeof (rbfinfo)); + +/* Disable all signals from hps peripheral controller to
fpga */
writel(0, &system_manager_base->fpgaintf_en_global);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +0
-1-/* disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+/* Disable all axi bridge (hps2fpga, lwhps2fpga & fpga2hps) */
socfpga_bridges_reset();arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +0
-2-/* Initialize the FPGA Manager */ - status = fpgamgr_program_init((u32 *)rbf_data,
rbf_size);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-2-if (status) -return status; +/* Getting info about bitstream types */ +get_rbf_image_info (&rbfinfo, (u16 *)rbf_data); + +if (rbfinfo.section == periph_section) { +/* Initialize the FPGA Manager */ + status = fpgamgr_program_init((u32 *)rbf_data,
rbf_size);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +6
-0+if (status) +return status; + } + + if (rbfinfo.section == core_section && + !(is_fpgamgr_early_user_mode() &&!is_fpgamgr_user_mode())) {
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-0+ debug("FPGA : Must be in early release mode toprogram ");
arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +3
-0+debug ("core bitstream.\n" ); +return 0 ; + }arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +1
-1-/* Write the RBF data to FPGA Manager */ +/* Write the bitstream to FPGA Manager */
fpgamgr_program_write(rbf_data, rbf_size);arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h +7
-1-return fpgamgr_program_finish (); + status =fpgamgr_program_finish (); +if (status) { +config_pins (gd->fdt_blob,"fpga" ); +puts ("FPGA: Enter user mode.\n" ); + } + +return status;}
PATCH v7 4/7 ARM: socfpga: Add the configuration for FPGA SoCFPGA A10 SoCDK
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Update the default configuration file to enable the necessary functionality to get the SoCFPGA loadfs driver support. This would enable the implementation of programming bitstream into FPGA from MMC.
---
changes for v7
- Removed limit set for CONFIG_FS_FAT_MAX_CLUSTSIZE
--- configs/socfpga_arria10_defconfig | 6 ++++++ 1 file changed, 6 insertions(+)
configs/socfpga_arria10_defconfig +6 -0
@@ -27,9 +27,15 @@ CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" # CONFIG_EFI_PARTITION is not set CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc" CONFIG_ENV_IS_IN_MMC=y +CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_SPL_DM_MMC=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_EXT_SUPPORT=y CONFIG_SPL_FS_FAT=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y +CONFIG_FS_LOADER=y CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y
Signature · 1 line
2.2.0
PATCH v7 4/7 ARM: socfpga: Add the configuration for FPGA SoCFPGA A10 SoCDK
Quoted 21 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Update the default configuration file to enable the necessary functionality to get the SoCFPGA loadfs driver support. This would enable the implementation of programming bitstream into FPGA from MMC.
Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Removed limit set forCONFIG_FS_FAT_MAX_CLUSTSIZE--- configs/socfpga_arria10_defconfig | 6 ++++++ 1 file changed, 6 insertions(+)configs/socfpga_arria10_defconfig +0
-0
configs/socfpga_arria10_defconfig CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" · line 33
Quoted 7 lines
configs/socfpga_arria10_defconfig +2
-0@@ -27,9 +27,15 @@ CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" # CONFIG_EFI_PARTITION is not set CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc" CONFIG_ENV_IS_IN_MMC=y +CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_SPL_DM_MMC=y
Oddly enough, only 6/7 enables CONFIG_DW_MMC=y, so unless you apply also 6/7, this patch cannot work as intended.
Quoted 9 lines
configs/socfpga_arria10_defconfig +4
-0+CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_EXT_SUPPORT=y CONFIG_SPL_FS_FAT=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y +CONFIG_FS_LOADER=y CONFIG_FPGA_SOCFPGA=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 4/7 ARM: socfpga: Add the configuration for FPGA SoCFPGA A10 SoCDK
Quoted 19 lines · Marek Vasut
Quoted 18 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Update the default configuration file to enable the necessary functionality
to get the SoCFPGA loadfs driver support. This would enable the implementation of programming bitstream into FPGA from MMC.Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Removed limit set forCONFIG_FS_FAT_MAX_CLUSTSIZE
---
configs/socfpga_arria10_defconfig | 6 ++++++1 file changed, 6 insertions(+)
Quoted 16 lines
Quoted 7 lines
configs/socfpga_arria10_defconfig +0
-0@@ -27,9 +27,15 @@ CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" # CONFIG_EFI_PARTITION is not setQuoted 6 lines
CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc"
CONFIG_ENV_IS_IN_MMC=y+CONFIG_SPL_ENV_SUPPORT=y
CONFIG_SPL_DM=y
CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_SPL_DM_MMC=yOddly enough, only 6/7 enables
CONFIG_DW_MMC=y, so unless you apply also
6/7, this patch cannot work as intended.
Good catch!! I think all FIT related configs from 6/7 should be moved to here because the FPGA driver now is FPGA FIT image implementation.
Quoted 12 lines
Quoted 11 lines
configs/socfpga_arria10_defconfig +2
-0+CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_EXT_SUPPORT=yCONFIG_SPL_FS_FAT=y
configs/socfpga_arria10_defconfig +2
-0+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y +CONFIG_FS_LOADER=yCONFIG_FPGA_SOCFPGA=y
CONFIG_DM_GPIO=y
CONFIG_DWAPB_GPIO=y
PATCH v7 5/7 spl : socfpga: Implement fpga bitstream loading with socfpga loadfs
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Add support for loading FPGA bitstream to get DDR up running before U-Boot is loaded into DDR. Boot device initialization, generic firmware loader and SPL FAT support are required for this whole mechanism to work.
---
changes for v7
- Removed casting for get_fpga_filename
- Removed hard coding DDR address for loading core bistream, using loadable property from FIT.
- Added checking for config_pins, return if error.
--- arch/arm/mach-socfpga/spl_a10.c | 46 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-)
arch/arm/mach-socfpga/spl_a10.c +45 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2019 Altera Corporation <www.altera.com> */ #include <common.h>
@@ -23,6 +23,8 @@#include <fdtdec.h> #include <watchdog.h> #include <asm/arch/pinmux.h> +#include <asm/arch/fpga_manager.h> +#include <mmc.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -68,11 +70,53 @@ u32 spl_boot_mode(const u32 boot_device)void spl_board_init (void ) { +char buf[16 *1024 ]__aligned(ARCH_DMA_MINALIGN) ; +/* enable console uart printing */ preloader_console_init ();WATCHDOG_RESET ();arch_early_init_r (); + +/* If the full FPGA is already loaded, ie.from EPCQ, config fpga pins */ +if (is_fpgamgr_user_mode ()) { +int ret =config_pins (gd->fdt_blob,"shared" ); +if (ret) +return ; + + ret =config_pins (gd->fdt_blob,"fpga" ); +if (ret) +return ; + }else if (!is_fpgamgr_early_user_mode ()) { +/* Program IOSSM(early IO release) or full FPGA */ +fpga_fs_info fpga_fsinfo; +int len; + + fpga_fsinfo.filename =get_fpga_filename ( + gd->fdt_blob, + &len, +FPGA_SOCFPGA_A10_RBF_PERIPH ); + +if (fpga_fsinfo.filename) +socfpga_loadfs (&fpga_fsinfo, buf,sizeof (buf),0 ); + } + +/* If the IOSSM/full FPGA is already loaded, start DDR */ +if (is_fpgamgr_early_user_mode () ||is_fpgamgr_user_mode ()) +ddr_calibration_sequence (); + +if (!is_fpgamgr_user_mode ()) { +fpga_fs_info fpga_fsinfo; +int len; + + fpga_fsinfo.filename =get_fpga_filename ( + gd->fdt_blob, + &len, +FPGA_SOCFPGA_A10_RBF_CORE ); + +if (fpga_fsinfo.filename) +socfpga_loadfs (&fpga_fsinfo, buf,sizeof (buf),0 ); + } }void board_init_f (ulong dummy)
Signature · 1 line
2.2.0
PATCH v7 6/7 ARM: socfpga: Synchronize the configuration for A10 SoCDK
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
Update the default configuration file to enable the necessary functionality the get the kit working.
---
changes for v7
- Keep minimal configs
--- configs/socfpga_arria10_defconfig | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
configs/socfpga_arria10_defconfig +11 -6
@@ -10,10 +10,13 @@ CONFIG_NR_DRAM_BANKS=1 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200" # CONFIG_USE_BOOTCOMMAND is not set +CONFIG_SYS_CONSOLE_IS_IN_ENV=y +CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y +CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y CONFIG_DEFAULT_FDT_FILE="socfpga_arria10_socdk_sdmmc.dtb" +CONFIG_VERSION_VARIABLE=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_FPGA_SUPPORT=y -CONFIG_SPL_SPI_LOAD=y CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y # CONFIG_CMD_FLASH is not set
@@ -22,9 +25,7 @@ CONFIG_CMD_MMC=y CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0" -# CONFIG_SPL_DOS_PARTITION is not set -# CONFIG_ISO_PARTITION is not set -# CONFIG_EFI_PARTITION is not set +CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dmas dma-names" CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc" CONFIG_ENV_IS_IN_MMC=y CONFIG_SPL_ENV_SUPPORT=y
@@ -32,20 +33,24 @@ CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_DM_MMC=y CONFIG_SPL_MMC_SUPPORT=y -CONFIG_SPL_EXT_SUPPORT=y CONFIG_SPL_FS_FAT=y CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_FS_LOADER=y CONFIG_FPGA_SOCFPGA=y +CONFIG_SPL_FIT=y +CONFIG_FIT=y CONFIG_DM_GPIO=y CONFIG_DWAPB_GPIO=y CONFIG_DM_MMC=y CONFIG_MTD_DEVICE=y +CONFIG_MMC_DW=y +CONFIG_PHY_MICREL=y +CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y CONFIG_MII=y +CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_DESIGNWARE_APB_TIMER=y -CONFIG_USE_TINY_PRINTF=y
Signature · 1 line
2.2.0
PATCH v7 7/7 ARM: socfpga: Increase Malloc pool size to support FAT filesystem in SPL
In reply to tien.fong.chee at intel.comFrom: Tien Fong Chee <[email protected]>
After some series of patches to maximise reusable of memory pool, here come to result of reasonable size required for whole SDMMC boot working on A10 SoCDK. Size required come from default max cluster(0x100000) + others(0x2000) + additional memory for headroom(0x3000).
---
changes for v7
- Added 0x3000 for memory headroom.
--- include/configs/socfpga_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/configs/socfpga_common.h +2 -2
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2019 Altera Corporation <www.altera.com> */ #ifndef __CONFIG_SOCFPGA_COMMON_H__#define __CONFIG_SOCFPGA_COMMON_H__
@@ -258,7 +258,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )/* SPL memory allocation configuration, this is for FAT implementation */ #ifndef CONFIG_SYS_SPL_MALLOC_START -#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00010000 +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00015000#define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_INIT_RAM_SIZE - \ CONFIG_SYS_SPL_MALLOC_SIZE + \ CONFIG_SYS_INIT_RAM_ADDR)
Signature · 1 line
2.2.0
PATCH v7 7/7 ARM: socfpga: Increase Malloc pool size to support FAT filesystem in SPL
Quoted 5 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
After some series of patches to maximise reusable of memory pool, here come to result of reasonable size required for whole SDMMC boot working on A10 SoCDK. Size required come from default max cluster(0x100000) +
The max cluster size is 0x10000 , one zero too many in the description.
Quoted 34 lines
others(0x2000) + additional memory for headroom(0x3000).
Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Added0x3000for memory headroom.--- include/configs/socfpga_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/configs/socfpga_common.h +2
-2@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* -* Copyright (C) 2012 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2019 Altera Corporation <www.altera.com> */ #ifndef __CONFIG_SOCFPGA_COMMON_H__#define __CONFIG_SOCFPGA_COMMON_H__@@ -258,7 +258,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )/* SPL memory allocation configuration, this is for FAT implementation */ #ifndef CONFIG_SYS_SPL_MALLOC_START -#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00010000 +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00015000#define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_INIT_RAM_SIZE - \ CONFIG_SYS_SPL_MALLOC_SIZE + \ CONFIG_SYS_INIT_RAM_ADDR)
Signature · 2 lines
Best regards, Marek Vasut
Chee
PATCH v7 7/7 ARM: socfpga: Increase Malloc pool size to support FAT filesystem in SPL
Quoted 11 lines · Marek Vasut
Quoted 8 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
After some series of patches to maximise reusable of memory pool, here come
to result of reasonable size required for whole SDMMC boot working on A10
SoCDK. Size required come from default max cluster(0x100000) +The max cluster size is
0x10000, one zero too many in the description.
Good catch!! Blurry vision on my eyes when i was working too late :).
Quoted 42 lines
Quoted 41 lines
others(0x2000) + additional memory for headroom(0x3000).
Signed-off-by Tien Fong Chee <[email protected]>---
changes for v7
- Added0x3000for memory headroom.
---
include/configs/socfpga_common.h | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)include/configs/socfpga_common.h +1
-1@@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Copyright (C) 2012 Altera Corporation <www.altera.com> + * Copyright (C) 2012-2019 Altera Corporation <www.altera.com> */ #ifndef __CONFIG_SOCFPGA_COMMON_H__ #define __CONFIG_SOCFPGA_COMMON_H__@@ -258,7 +258,7 @@ unsigned intcm_get_qspi_controller_clk_hz (void); #if defined(CONFIG_TARGET_SOCFPGA_ARRIA10) /* SPL memory allocation configuration, this is for FATimplementation */
#ifndefCONFIG_SYS_SPL_MALLOC_STARTinclude/configs/socfpga_common.h +1
-1-#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00010000 +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00015000#define
CONFIG_SYS_SPL_MALLOC_START(CONFIG_SYS_INIT_RAM_SI
ZE - \
CONFIG_SYS_SPL_MALLOC_SIZ E + \
CONFIG_SYS_INIT_RAM_ADDR)