
-----Original Message----- From: Simon Glass sjg@chromium.org Sent: Friday, December 15, 2023 1:50 AM To: U-Boot Mailing List u-boot@lists.denx.de Cc: Tom Rini trini@konsulko.com; Simon Glass sjg@chromium.org; Chanho Park chanho61.park@samsung.com; Heinrich Schuchardt
Leo ycliang@andestech.com; Nikita Shubin n.shubin@yadro.com; Rick Chen rick@andestech.com Subject: [PATCH v2 05/21] riscv: Add a reset_cpu() function
The current do_reset() is called from a command context. Add a function which can be used from anywhere, as is done on ARM. Adjust do_reset() to call it.
Note that reset_cpu() is normally provided by SYSRESET so make this declaration conditional on that being disabled.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Chanho Park chanho61.park@samsung.com Tested-by: Chanho Park chanho61.park@samsung.com
(no changes since v1)
arch/riscv/cpu/cpu.c | 13 +++++++++++++ arch/riscv/lib/reset.c | 7 ++----- 2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c index ebd39cb41a60..8445c5823e17 100644 --- a/arch/riscv/cpu/cpu.c +++ b/arch/riscv/cpu/cpu.c @@ -3,10 +3,13 @@
- Copyright (C) 2018, Bin Meng bmeng.cn@gmail.com
*/
+#include <command.h> #include <cpu.h> +#include <cpu_func.h> #include <dm.h> #include <dm/lists.h> #include <event.h> +#include <hang.h> #include <init.h> #include <log.h> #include <asm/encoding.h> @@ -162,3 +165,13 @@ int arch_early_init_r(void) __weak void harts_early_init(void) { }
+#if !CONFIG_IS_ENABLED(SYSRESET) +void reset_cpu(void) +{
- printf("resetting ...\n");
- printf("reset not supported yet\n");
- hang();
+} +#endif diff --git a/arch/riscv/lib/reset.c b/arch/riscv/lib/reset.c index 712e1bdb8e1d..c4153c9e6e02 100644 --- a/arch/riscv/lib/reset.c +++ b/arch/riscv/lib/reset.c @@ -4,14 +4,11 @@ */
#include <command.h> -#include <hang.h> +#include <cpu_func.h>
int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) {
- printf("resetting ...\n");
- printf("reset not supported yet\n");
- hang();
reset_cpu();
return 0;
}
2.43.0.472.g3155946c3a-goog