aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-12-15 20:14:24 -0700
committerTom Rini <trini@konsulko.com>2023-12-21 16:07:52 -0500
commite4cee649b9628ee17c40d12097e2c122e8a5a803 (patch)
tree1da6d19d0af4290374ba91b05579e6fdf591d277
parent3405c9b6a592585db80405d960ec219590689159 (diff)
downloadu-boot-e4cee649b9628ee17c40d12097e2c122e8a5a803.zip
u-boot-e4cee649b9628ee17c40d12097e2c122e8a5a803.tar.gz
u-boot-e4cee649b9628ee17c40d12097e2c122e8a5a803.tar.bz2
stm32: Use bootm_run() and bootz_run()
Use the new bootm/z_run() functions to avoid having to create an argument list for the stm32prog code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
index 8670535..adee6e0 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <bootm.h>
#include <command.h>
#include <dfu.h>
#include <image.h>
@@ -125,12 +126,10 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
char dtb_addr[20];
char initrd_addr[40];
char *fdt_arg, *initrd_arg;
- char *bootm_argv[5] = {
- "bootm", boot_addr_start,
- };
const void *uimage = (void *)data->uimage;
const void *dtb = (void *)data->dtb;
const void *initrd = (void *)data->initrd;
+ struct bootm_info bmi;
fdt_arg = dtb_addr;
if (!dtb)
@@ -141,7 +140,7 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
snprintf(boot_addr_start, sizeof(boot_addr_start) - 1,
"0x%p", uimage);
- initrd_arg = "-";
+ initrd_arg = NULL;
if (initrd) {
snprintf(initrd_addr, sizeof(initrd_addr) - 1,
"0x%p:0x%zx", initrd, data->initrd_size);
@@ -149,15 +148,18 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
}
printf("Booting kernel at %s %s %s...\n\n\n", boot_addr_start,
- initrd_arg, fdt_arg);
- bootm_argv[2] = initrd_arg;
- bootm_argv[3] = fdt_arg;
+ initrd_arg ?: "-", fdt_arg);
+
+ bootm_init(&bmi);
+ bmi.addr_img = boot_addr_start;
+ bmi.conf_ramdisk = initrd_arg;
+ bmi.conf_fdt = fdt_arg;
/* Try bootm for legacy and FIT format image */
if (genimg_get_format(uimage) != IMAGE_FORMAT_INVALID)
- do_bootm(cmdtp, 0, 4, bootm_argv);
+ bootm_run(&bmi);
else if (IS_ENABLED(CONFIG_CMD_BOOTZ))
- do_bootz(cmdtp, 0, 4, bootm_argv);
+ bootz_run(&bmi);
}
if (data->script)
cmd_source_script(data->script, NULL, NULL);