소스 검색

riscv: Move do_reset() to a common place

We don't have a reset method on any RISC-V board yet. Instead of
adding the same 'unsupported' message for each CPU variant it might
make more sense to add a generic do_reset function for all CPU
variants to lib/, similar to the one for ARM (arch/arm/lib/reset.c).

Suggested-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Bin Meng 6 년 전
부모
커밋
b984ddc2dd
4개의 변경된 파일18개의 추가작업 그리고 17개의 파일을 삭제
  1. 0 9
      arch/riscv/cpu/ax25/cpu.c
  2. 0 8
      arch/riscv/cpu/qemu/cpu.c
  3. 1 0
      arch/riscv/lib/Makefile
  4. 17 0
      arch/riscv/lib/reset.c

+ 0 - 9
arch/riscv/cpu/ax25/cpu.c

@@ -6,9 +6,6 @@
 
 /* CPU specific code */
 #include <common.h>
-#include <command.h>
-#include <watchdog.h>
-#include <asm/cache.h>
 
 /*
  * cleanup_before_linux() is called just before we call linux
@@ -24,9 +21,3 @@ int cleanup_before_linux(void)
 
 	return 0;
 }
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	disable_interrupts();
-	panic("ax25-ae350 wdt not support yet.\n");
-}

+ 0 - 8
arch/riscv/cpu/qemu/cpu.c

@@ -4,7 +4,6 @@
  */
 
 #include <common.h>
-#include <command.h>
 
 /*
  * cleanup_before_linux() is called just before we call linux
@@ -20,10 +19,3 @@ int cleanup_before_linux(void)
 
 	return 0;
 }
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	printf("reset unsupported yet\n");
-
-	return 0;
-}

+ 1 - 0
arch/riscv/lib/Makefile

@@ -10,6 +10,7 @@ obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-$(CONFIG_CMD_GO) += boot.o
 obj-y	+= cache.o
 obj-y	+= interrupts.o
+obj-y	+= reset.o
 obj-y   += setjmp.o
 
 # For building EFI apps

+ 17 - 0
arch/riscv/lib/reset.c

@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
+ */
+
+#include <common.h>
+#include <command.h>
+
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	printf("resetting ...\n");
+
+	printf("reset unsupported yet\n");
+	hang();
+
+	return 0;
+}