SG2002 uses the same RTC system reset registers as CV1800B, but
LicheeRV Nano does not bind the existing CV1800B sysreset driver.

Enable board-specific initialization and bind the sysreset driver in
board_init(), following the approach used by Milk-V Duo.

Signed-off-by: Zhuxu Ran <[email protected]>
---
 board/sophgo/licheerv_nano/board.c     | 9 +++++++++
 configs/sipeed_licheerv_nano_defconfig | 1 -
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/board/sophgo/licheerv_nano/board.c 
b/board/sophgo/licheerv_nano/board.c
index e6099d35dbf..c0685c44662 100644
--- a/board/sophgo/licheerv_nano/board.c
+++ b/board/sophgo/licheerv_nano/board.c
@@ -3,3 +3,12 @@
  * Copyright (c) 2024, Kongyang Liu <[email protected]>
  */
 
+#include <dm/lists.h>
+
+int board_init(void)
+{
+       if (IS_ENABLED(CONFIG_SYSRESET_CV1800B))
+               device_bind_driver(gd->dm_root, "cv1800b_sysreset", "sysreset", 
NULL);
+
+       return 0;
+}
diff --git a/configs/sipeed_licheerv_nano_defconfig 
b/configs/sipeed_licheerv_nano_defconfig
index 9aa3ede10c5..ab29f327d7a 100644
--- a/configs/sipeed_licheerv_nano_defconfig
+++ b/configs/sipeed_licheerv_nano_defconfig
@@ -17,7 +17,6 @@ CONFIG_SD_BOOT=y
 CONFIG_BOOTCOMMAND="run distro_bootcmd"
 CONFIG_SYS_CBSIZE=512
 CONFIG_SYS_PBSIZE=544
-# CONFIG_BOARD_INIT is not set
 CONFIG_SYS_PROMPT="licheerv_nano# "
 # CONFIG_CMD_BOOTDEV is not set
 CONFIG_CMD_MBR=y

-- 
2.55.0

Reply via email to