* [PATCH master] ARM: i.MX8M: bootrom: fix load image size
@ 2023-11-13 11:17 Marco Felsch
2023-11-13 11:22 ` Marco Felsch
0 siblings, 1 reply; 2+ messages in thread
From: Marco Felsch @ 2023-11-13 11:17 UTC (permalink / raw)
To: barebox
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@pengutronix.de>
---
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 aef0ff0534c9..972a1bf427de 100644
--- a/arch/arm/mach-imx/romapi.c
+++ b/arch/arm/mach-imx/romapi.c
@@ -4,6 +4,7 @@
#include <common.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>
@@ -16,6 +17,12 @@
static int imx8m_bootrom_load(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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH master] ARM: i.MX8M: bootrom: fix load image size
2023-11-13 11:17 [PATCH master] ARM: i.MX8M: bootrom: fix load image size Marco Felsch
@ 2023-11-13 11:22 ` Marco Felsch
0 siblings, 0 replies; 2+ messages in thread
From: Marco Felsch @ 2023-11-13 11:22 UTC (permalink / raw)
To: barebox
Hi all,
On 23-11-13, Marco Felsch wrote:
> 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@pengutronix.de>
please ignore patch [1] in favour of this patch.
[1] https://lore.barebox.org/barebox/20231113090438.1890680-1-m.felsch@pengutronix.de/T/#u
Regards,
Marco
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-13 11:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 11:17 [PATCH master] ARM: i.MX8M: bootrom: fix load image size Marco Felsch
2023-11-13 11:22 ` Marco Felsch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox