[PATCH v2 18/23] ARM: i.MX: bbu: add filetype offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make it possible to have a different filetype offset which is used
during the filetype check. This is required for the upcoming i.MX8MM/N/P
QSPI bbu support.

Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
---
 arch/arm/mach-imx/imx-bbu-internal.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 8eca0783eb..7c13437b61 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -26,6 +26,7 @@ struct imx_internal_bbu_handler {
 	int (*write_device)(struct imx_internal_bbu_handler *,
 			    struct bbu_data *);
 	unsigned long flash_header_offset;
+	unsigned long filetype_offset;
 	size_t device_size;
 	enum filetype expected_type;
 };
@@ -161,8 +162,8 @@ static int imx_bbu_check_prereq(struct imx_internal_bbu_handler *imx_handler,
 		if (expected_type == filetype_unknown)
 			break;
 
-		blob = data->image + imx_handler->flash_header_offset;
-		len  = data->len   - imx_handler->flash_header_offset;
+		blob = data->image + imx_handler->filetype_offset;
+		len  = data->len   - imx_handler->filetype_offset;
 		type = file_detect_type(blob, len);
 
 		if (type != expected_type) {
@@ -470,6 +471,7 @@ imx_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
 	imx_handler = __init_handler(name, devicefile, flags |
 				     IMX_BBU_FLAG_KEEP_HEAD);
 	imx_handler->flash_header_offset = imx_bbu_flash_header_offset_mmc();
+	imx_handler->filetype_offset = imx_handler->flash_header_offset;
 
 	return __register_handler(imx_handler);
 }
@@ -484,6 +486,7 @@ imx_bbu_internal_spi_i2c_register_handler(const char *name,
 	imx_handler = __init_handler(name, devicefile, flags |
 				     IMX_BBU_FLAG_ERASE);
 	imx_handler->flash_header_offset = imx_bbu_flash_header_offset_mmc();
+	imx_handler->filetype_offset = imx_handler->flash_header_offset;
 
 	return __register_handler(imx_handler);
 }
@@ -529,6 +532,7 @@ int imx53_bbu_internal_nand_register_handler(const char *name,
 
 	imx_handler = __init_handler(name, "/dev/nand0", flags);
 	imx_handler->flash_header_offset = imx_bbu_flash_header_offset_mmc();
+	imx_handler->filetype_offset = imx_handler->flash_header_offset;
 
 	imx_handler->device_size = partition_size;
 	imx_handler->write_device = imx_bbu_internal_v2_write_nand_dbbt;
@@ -580,6 +584,7 @@ static int imx_bbu_internal_mmcboot_register_handler(const char *name,
 
 	imx_handler = __init_handler(name, devicefile, flags);
 	imx_handler->flash_header_offset = flash_header_offset;
+	imx_handler->filetype_offset = flash_header_offset;
 
 	imx_handler->handler.handler = imx_bbu_internal_mmcboot_update;
 

-- 
2.30.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux