summaryrefslogtreecommitdiff
path: root/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@foss.st.com>2022-03-28 19:25:32 +0200
committerPatrice Chotard <patrice.chotard@foss.st.com>2022-05-10 10:56:39 +0200
commit152576a598cad749c80c589a51ea5bd342d6f2cc (patch)
tree7872243323fa40f30d4c4fb47867d24f418ceacd /arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
parent7f1121a85a5c68a0df137d0b161184a39a583ad2 (diff)
stm32mp: stm32prog: handle U-Boot script in flashlayout alternate
Update the stm32prog command to allow the reception of U-Boot script in the FlashLayout alternate during the first USB enumeration. This patch is aligned with the last TF-A behavior: the Flashlayout is now loaded by U-Boot; it is no more present at STM32_DDR_BASE when the stm32prog is launched after a serial boot, on UART or on USB. The received script must be a U-Boot legacy image, no more need to add a stm32image header. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Diffstat (limited to 'arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c')
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
index d3b3e1ed72..65655e25ca 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
@@ -6,6 +6,7 @@
#include <command.h>
#include <console.h>
#include <dfu.h>
+#include <image.h>
#include <malloc.h>
#include <misc.h>
#include <mmc.h>
@@ -1697,6 +1698,14 @@ error:
static void stm32prog_end_phase(struct stm32prog_data *data, u64 offset)
{
if (data->phase == PHASE_FLASHLAYOUT) {
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
+ if (genimg_get_format((void *)STM32_DDR_BASE) == IMAGE_FORMAT_LEGACY) {
+ data->script = STM32_DDR_BASE;
+ data->phase = PHASE_END;
+ log_notice("U-Boot script received\n");
+ return;
+ }
+#endif
if (parse_flash_layout(data, STM32_DDR_BASE, 0))
stm32prog_err("Layout: invalid FlashLayout");
return;