Without the proper aligned image size we may encounter host load errors like: | found i.MX8MP USB device [1fc9:0146] | No dcd table in this ivt | dl_command err=-1, last_trans=-1 | 4 in err=-4, last_trans=0 00 00 00 00 The reason for this is that we asked only for the required bytes while the host tries to send the complete image which may contain alignment bytes at the end. Fix this by request always 4K aligned sizes. Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> --- arch/arm/mach-imx/romapi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/mach-imx/romapi.c b/arch/arm/mach-imx/romapi.c index 1b1800f1e000..b4c63e4d7274 100644 --- a/arch/arm/mach-imx/romapi.c +++ b/arch/arm/mach-imx/romapi.c @@ -6,6 +6,7 @@ #include <linux/bitfield.h> #include <soc/imx9/flash_header.h> #include <asm/sections.h> +#include <linux/sizes.h> #include <mach/imx/romapi.h> #include <mach/imx/atf.h> #include <mach/imx/imx8m-regs.h> @@ -50,6 +51,12 @@ static int imx_bootrom_query(struct rom_api *rom_api, uint32_t type, uint32_t *_ static int imx_romapi_load_stream(struct rom_api *rom_api, void *adr, size_t size) { + /* + * The imx-image tool align the final image size to 4K so we need to + * take this into account. + */ + size = ALIGN(size, SZ_4K); + while (size) { size_t chunksize = min(size, (size_t)1024); int ret; -- 2.39.2