[PATCH 1/2] cmd: boot: add brom cmd to reboot to brom dnl mode

Michal Suchanek msuchanek at suse.de
Sun Jul 3 21:20:21 CEST 2022


From: Andy Yan <andy.yan at rock-chips.com>

Change-Id: I797491ebe25af1013732aeee87e61e3ba4bc1689
Signed-off-by: Andy Yan <andy.yan at rock-chips.com>
Signed-off-by: Michal Suchanek <msuchanek at suse.de>
---
 .../arm/include/asm/arch-rockchip/boot_mode.h |  1 +
 cmd/boot.c                                    | 20 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/arm/include/asm/arch-rockchip/boot_mode.h b/arch/arm/include/asm/arch-rockchip/boot_mode.h
index 6b2a610cf4..bcdf4420cf 100644
--- a/arch/arm/include/asm/arch-rockchip/boot_mode.h
+++ b/arch/arm/include/asm/arch-rockchip/boot_mode.h
@@ -19,6 +19,7 @@
 #define BOOT_BROM_DOWNLOAD	0xEF08A53C
 
 #ifndef __ASSEMBLY__
+void set_back_to_bootrom_dnl_flag(void);
 int setup_boot_mode(void);
 #endif
 
diff --git a/cmd/boot.c b/cmd/boot.c
index be67a5980d..d48c0bf1b3 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -43,16 +43,36 @@ static int do_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	printf ("## Application terminated, rc = 0x%lX\n", rc);
 	return rcode;
 }
+#endif
+
+#if defined(CONFIG_ROCKCHIP_BOOT_MODE_REG) && CONFIG_ROCKCHIP_BOOT_MODE_REG
+#include <asm/arch-rockchip/boot_mode.h>
+static int do_reboot_brom(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
+{
+	set_back_to_bootrom_dnl_flag();
+	do_reset(NULL, 0, 0, NULL);
+
+	return 0;
+}
+#endif
 
 /* -------------------------------------------------------------------- */
 
+#ifdef CONFIG_CMD_GO
 U_BOOT_CMD(
 	go, CONFIG_SYS_MAXARGS, 1,	do_go,
 	"start application at address 'addr'",
 	"addr [arg ...]\n    - start application at address 'addr'\n"
 	"      passing 'arg' as arguments"
 );
+#endif
 
+#if defined(CONFIG_ROCKCHIP_BOOT_MODE_REG) && CONFIG_ROCKCHIP_BOOT_MODE_REG
+U_BOOT_CMD(
+	rbrom, 1, 0,	do_reboot_brom,
+	"Perform RESET of the CPU and enter boot rom",
+	""
+);
 #endif
 
 U_BOOT_CMD(
-- 
2.36.1



More information about the U-Boot mailing list