#include <common.h>
#include <errno.h>
+#include <fpga.h>
#include <image.h>
#include <linux/libfdt.h>
#include <spl.h>
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
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;
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;
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;
}