diff mbox series

[07/18] mips: Add a reset_cpu() function

Message ID 20231203172622.7.I2c0bbce52ecf7ce9458c481fbd12b6029e5ebd27@changeid
State Superseded
Delegated to: Tom Rini
Headers show
Series Complete decoupling of bootm logic from commands | expand

Commit Message

Simon Glass Dec. 4, 2023, 12:26 a.m. UTC
The current do_reset() is called from a command context. Add a function
which can be used from anywhere, as is done on ARM.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/mips/cpu/cpu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Tom Rini Dec. 9, 2023, 3:59 p.m. UTC | #1
On Sun, Dec 03, 2023 at 05:26:23PM -0700, Simon Glass wrote:

> The current do_reset() is called from a command context. Add a function
> which can be used from anywhere, as is done on ARM.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---

A consistent API here for all architectures is good, thanks for doing
this cleanup.
diff mbox series

Patch

diff --git a/arch/mips/cpu/cpu.c b/arch/mips/cpu/cpu.c
index acfc9dc43f17..443465047715 100644
--- a/arch/mips/cpu/cpu.c
+++ b/arch/mips/cpu/cpu.c
@@ -4,6 +4,7 @@ 
  * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
  */
 
+#include <cpu_func.h>
 #include <command.h>
 #include <init.h>
 #include <linux/compiler.h>
@@ -20,9 +21,14 @@  void __weak _machine_restart(void)
 		/* NOP */;
 }
 
-int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+void reset_cpu(void)
 {
 	_machine_restart();
+}
+
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+	reset_cpu();
 
 	return 0;
 }