static ulong spi_load_read(struct spl_load_info *load, ulong sector, ulong count, void *buf) { spi0_read_data(buf, sector, count); return count; }
static int spl_spi_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { int err; struct image_header *header; header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); spi0_init(); spi0_read_data((void *)header, CONFIG_SYS_SPI_U_BOOT_OFFS, 0x40); err = spl_parse_image_header(spl_image, header); if (err) return err; spi0_read_data((void *)spl_image->load_addr, CONFIG_SYS_SPI_U_BOOT_OFFS, spl_image->size); spi0_deinit(); return 0; }
static int spl_spi_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { int ret = 0; struct image_header *header; header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); spi0_init(); spi0_read_data((void *)header, CONFIG_SYS_SPI_U_BOOT_OFFS, 0x40); if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && image_get_magic(header) == FDT_MAGIC) { struct spl_load_info load; debug("Found FIT image\n"); load.dev = NULL; load.priv = NULL; load.filename = NULL; load.bl_len = 1; load.read = spi_load_read; ret = spl_load_simple_fit(spl_image, &load, CONFIG_SYS_SPI_U_BOOT_OFFS, header); } else { ret = spl_parse_image_header(spl_image, header); if (ret) return ret; spi0_read_data((void *)spl_image->load_addr, CONFIG_SYS_SPI_U_BOOT_OFFS, spl_image->size); } spi0_deinit(); return ret; }