[U-Boot] [PATCH 1/2] spl: fpga: Implement fpga bistream loading with fpga_load

This patch partially reverts: "spl: fit: Add support for loading FPGA bitstream" (sha1: 26a642238bdecc53527142dc043b29e21c5cc94c)
There shouldn't be a need to call private spl_load_fpga_image function because the whole sequence should be already handled by fpga framework. If there is missing loading bistream by chunks it should be done via fpga framework instead of having private hooks. Also spl_load_fpga_image() weak function is not used anywhere and opening a way for not reviewed hacks out of mainline U-Boot is not the right way to go.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
common/spl/spl_fit.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index dbf5ac33a845..a7aec5e36932 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -6,6 +6,7 @@
#include <common.h> #include <errno.h> +#include <fpga.h> #include <image.h> #include <linux/libfdt.h> #include <spl.h> @@ -140,14 +141,6 @@ static int get_aligned_image_size(struct spl_load_info *info, int data_size, return (data_size + info->bl_len - 1) / info->bl_len; }
-#ifdef CONFIG_SPL_FPGA_SUPPORT -__weak int spl_load_fpga_image(struct spl_load_info *info, size_t length, - int nr_sectors, int sector_offset) -{ - return 0; -} -#endif - /** * spl_load_fit_image(): load the image described in a certain FIT node * @info: points to information about the device to load data from @@ -169,7 +162,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, void *fit, ulong base_offset, int node, struct spl_image_info *image_info) { - int offset, sector_offset; + int offset; size_t length; int len; ulong size; @@ -217,16 +210,9 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
overhead = get_aligned_image_overhead(info, offset); nr_sectors = get_aligned_image_size(info, length, offset); - sector_offset = sector + get_aligned_image_offset(info, offset); - -#ifdef CONFIG_SPL_FPGA_SUPPORT - if (type == IH_TYPE_FPGA) { - return spl_load_fpga_image(info, length, nr_sectors, - sector_offset); - } -#endif
- if (info->read(info, sector_offset, + if (info->read(info, + sector + get_aligned_image_offset(info, offset), nr_sectors, (void *)load_ptr) != nr_sectors) return -EIO;
@@ -409,6 +395,18 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, printf("%s: Cannot load the FPGA: %i\n", __func__, ret); return ret; } + + debug("FPGA bitstream at: %x, size: %x\n", + (u32)spl_image->load_addr, spl_image->size); + + ret = fpga_load(0, (const void *)spl_image->load_addr, + spl_image->size, BIT_FULL); + if (ret) { + printf("%s: Cannot load the image to the FPGA\n", + __func__); + return ret; + } + puts("FPGA image loaded from FIT\n"); node = -1; }

Enable loading FPGA from FIT image in SPL.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
configs/zynq_zc706_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/configs/zynq_zc706_defconfig b/configs/zynq_zc706_defconfig index 619190062f08..bcbfa65e41b1 100644 --- a/configs/zynq_zc706_defconfig +++ b/configs/zynq_zc706_defconfig @@ -12,9 +12,12 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y +CONFIG_SPL_FIT_PRINT=y +CONFIG_SPL_LOAD_FIT=y CONFIG_IMAGE_FORMAT_LEGACY=y CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd" CONFIG_SPL_STACK_R=y +CONFIG_SPL_FPGA_SUPPORT=y CONFIG_SPL_OS_BOOT=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_PROMPT="Zynq> " @@ -78,3 +81,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_FUNCTION_THOR=y CONFIG_WDT=y CONFIG_WDT_CDNS=y +CONFIG_SPL_GZIP=y

st 26. 9. 2018 v 10:56 odesÃlatel Michal Simek michal.simek@xilinx.com napsal:
Enable loading FPGA from FIT image in SPL.
Signed-off-by: Michal Simek michal.simek@xilinx.com
configs/zynq_zc706_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/configs/zynq_zc706_defconfig b/configs/zynq_zc706_defconfig index 619190062f08..bcbfa65e41b1 100644 --- a/configs/zynq_zc706_defconfig +++ b/configs/zynq_zc706_defconfig @@ -12,9 +12,12 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y +CONFIG_SPL_FIT_PRINT=y +CONFIG_SPL_LOAD_FIT=y CONFIG_IMAGE_FORMAT_LEGACY=y CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd" CONFIG_SPL_STACK_R=y +CONFIG_SPL_FPGA_SUPPORT=y CONFIG_SPL_OS_BOOT=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_PROMPT="Zynq> " @@ -78,3 +81,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_FUNCTION_THOR=y CONFIG_WDT=y CONFIG_WDT_CDNS=y
+CONFIG_SPL_GZIP=y
1.9.1
Applied both.
Thanks, Michal
participants (2)
-
Michal Simek
-
Michal Simek