rom_version = ROM_V1;
}
break;
-
}
}
static int generate_ivt_for_fit(int fd, int fit_offset, uint32_t ep,
uint32_t *fit_load_addr)
{
- image_header_t image_header;
+ struct legacy_img_hdr image_header;
int ret;
uint32_t fit_size, load_addr;
exit(EXIT_FAILURE);
}
- if (read(fd, (char *)&image_header, sizeof(image_header_t)) !=
- sizeof(image_header_t)) {
+ if (read(fd, (char *)&image_header, sizeof(struct legacy_img_hdr)) !=
+ sizeof(struct legacy_img_hdr)) {
fprintf(stderr, "generate_ivt_for_fit read failed: %s\n",
strerror(errno));
exit(EXIT_FAILURE);
imx_header[index].boot_data.plugin);
}
+#ifdef CONFIG_FSPI_CONF_HEADER
+static int generate_fspi_header (int ifd)
+{
+ int ret, i = 0;
+ char *val;
+ char lut_str[] = CONFIG_LUT_SEQUENCE;
+
+ fspi_conf fspi_conf_data = {
+ .tag = {0x46, 0x43, 0x46, 0x42},
+ .version = {0x00, 0x00, 0x01, 0x56},
+ .reserved_1 = {0x00, 0x00, 0x00, 0x00},
+ .read_sample = CONFIG_READ_CLK_SOURCE,
+ .datahold = 0x03,
+ .datasetup = 0x03,
+ .coladdrwidth = 0x00,
+ .devcfgenable = 0x00,
+ .reserved_2 = {0x00, 0x00, 0x00},
+ .devmodeseq = {0x00, 0x00, 0x00, 0x00},
+ .devmodearg = {0x00, 0x00, 0x00, 0x00},
+ .cmd_enable = 0x00,
+ .reserved_3 = {0x00},
+ .cmd_seq = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ .cmd_arg = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ .controllermisc = {0x00, 0x00, 0x00, 0x00},
+ .dev_type = CONFIG_DEVICE_TYPE,
+ .sflash_pad = CONFIG_FLASH_PAD_TYPE,
+ .serial_clk = CONFIG_SERIAL_CLK_FREQUENCY,
+ .lut_custom = CONFIG_LUT_CUSTOM_SEQUENCE,
+ .reserved_4 = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ .sflashA1 = {0x00, 0x00, 0x00, 0x10},
+ .sflashA2 = {0x00, 0x00, 0x00, 0x00},
+ .sflashB1 = {0x00, 0x00, 0x00, 0x00},
+ .sflashB2 = {0x00, 0x00, 0x00, 0x00},
+ .cspadover = {0x00, 0x00, 0x00, 0x00},
+ .sclkpadover = {0x00, 0x00, 0x00, 0x00},
+ .datapadover = {0x00, 0x00, 0x00, 0x00},
+ .dqspadover = {0x00, 0x00, 0x00, 0x00},
+ .timeout = {0x00, 0x00, 0x00, 0x00},
+ .commandInt = {0x00, 0x00, 0x00, 0x00},
+ .datavalid = {0x00, 0x00, 0x00, 0x00},
+ .busyoffset = {0x00, 0x00},
+ .busybitpolarity = {0x00, 0x00},
+ };
+
+ for (val = strtok(lut_str, ","); val; val = strtok(NULL, ",")) {
+ fspi_conf_data.lut[i++] = strtoul(val, NULL, 16);
+ }
+
+ ret = lseek(ifd, 0, SEEK_CUR);
+ if (write(ifd, &fspi_conf_data, sizeof(fspi_conf_data)) == -1)
+ exit(EXIT_FAILURE);
+
+ ret = lseek(ifd, sizeof(fspi_conf_data), SEEK_CUR);
+
+ return ret;
+}
+#endif
+
void build_image(int ofd)
{
int file_off, header_hdmi_off = 0, header_image_off;
+
+#ifdef CONFIG_FSPI_CONF_HEADER
+ int fspi_off, fspi_fd;
+ char *fspi;
+#endif
+
int hdmi_fd, ap_fd, sld_fd;
uint32_t sld_load_addr = 0;
uint32_t csf_off, sld_csf_off = 0;
header_image_off = file_off + ivt_offset;
+#ifdef CONFIG_FSPI_CONF_HEADER
+ fspi = CONFIG_FSPI_CONF_FILE;
+ fspi_fd = open(fspi, O_RDWR | O_CREAT, S_IRWXU);
+ if (fspi_fd < 0) {
+ fprintf(stderr, "Can't open %s: %s\n",
+ fspi, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ fspi_off = generate_fspi_header(fspi_fd);
+ file_off = header_image_off + fspi_off;
+ close(fspi_fd);
+
+#endif
ap_fd = open(ap_img, O_RDONLY | O_BINARY);
if (ap_fd < 0) {
fprintf(stderr, "%s: Can't open: %s\n",
close(sld_fd);
file_off = sld_header_off;
- file_off += sbuf.st_size + sizeof(image_header_t);
+ file_off += sbuf.st_size + sizeof(struct legacy_img_hdr);
}
}