[PATCH 15/21] filetype: add NXP FlexSPI filetype
Marco Felsch
m.felsch at pengutronix.de
Thu Mar 9 02:40:47 PST 2023
This adds the NXP FlexSPI FCFB header check to the file_detect_type() so
update handlers can verify the correct type.
Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
common/filetype.c | 5 +++++
include/filetype.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/common/filetype.c b/common/filetype.c
index 68ea45861d..820bc89ea6 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -69,6 +69,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_imx_image_v2] = { "i.MX image (v2)", "imx-image-v2" },
[filetype_layerscape_image] = { "Layerscape image", "layerscape-PBL" },
[filetype_layerscape_qspi_image] = { "Layerscape QSPI image", "layerscape-qspi-PBL" },
+ [filetype_nxp_fspi_image] = { "NXP FlexSPI image", "nxp-fspi-image" },
[filetype_ubootvar] = { "U-Boot environmemnt variable data",
"ubootvar" },
[filetype_stm32_image_fsbl_v1] = { "STM32MP FSBL image (v1)", "stm32-fsbl-v1" },
@@ -409,6 +410,10 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (is_imx_flash_header_v2(_buf))
return filetype_imx_image_v2;
+ if (buf[0] == cpu_to_be32(FCFB_HEAD_TAG) &&
+ buf[1] == cpu_to_le32(FCFB_VERSION))
+ return filetype_nxp_fspi_image;
+
if (buf[8] == 0xAA995566 && buf[9] == 0x584C4E58)
return filetype_zynq_image;
diff --git a/include/filetype.h b/include/filetype.h
index 1a7d145555..783418c652 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -59,6 +59,7 @@ enum filetype {
filetype_rockchip_rkns_image,
filetype_fip,
filetype_qemu_fw_cfg,
+ filetype_nxp_fspi_image,
filetype_max,
};
--
2.30.2
More information about the barebox
mailing list