diff mbox series

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

Message ID 14bf79fda73ffa43556d933d0c329afd9f1fd276.1656875482.git.msuchanek@suse.de
State Deferred
Delegated to: Tom Rini
Headers show
Series Command for entering mask rom USB download mode | expand

Commit Message

Michal Suchánek July 3, 2022, 7:20 p.m. UTC
From: Andy Yan <andy.yan@rock-chips.com>

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

Patch

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(