Files
OpenBMC/meta-luxshare/meta-common/recipes-bsp/u-boot/files/0002-u-boot-Update-system-reset-event.patch
T
2026-04-23 17:07:55 +08:00

111 lines
3.2 KiB
Diff
Executable File

From 119df9b1a20361b1721dd72803caa9986af5e582 Mon Sep 17 00:00:00 2001
From: "Wang.Bin" <Bin-B.Wang@luxshare-ict.com>
Date: Fri, 25 Oct 2024 14:28:46 +0800
Subject: [PATCH 2/2] u boot Update system reset event Test:
/usr/sbin/fw_printenv system_reset_event=0xff31
---
arch/arm/mach-aspeed/ast2600/scu_info.c | 5 ++++-
board/aspeed/evb_ast2600/evb_ast2600.c | 11 +++++++++++
common/board_r.c | 3 +++
include/asm-generic/global_data.h | 3 +++
include/init.h | 4 ++++
5 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-aspeed/ast2600/scu_info.c b/arch/arm/mach-aspeed/ast2600/scu_info.c
index a2277eec58..cf5cea3b12 100644
--- a/arch/arm/mach-aspeed/ast2600/scu_info.c
+++ b/arch/arm/mach-aspeed/ast2600/scu_info.c
@@ -9,6 +9,8 @@
#include <asm/io.h>
#include <asm/arch/aspeed_scu_info.h>
+DECLARE_GLOBAL_DATA_PTR;
+
/* SoC mapping Table */
#define SOC_ID(str, rev) { .name = str, .rev_id = rev, }
@@ -217,7 +219,8 @@ void aspeed_print_sysrst_info(void)
{
u32 rest = readl(ASPEED_SYS_RESET_CTRL);
u32 rest3 = readl(ASPEED_SYS_RESET_CTRL3);
-
+
+ gd->reset_reason = rest;
if (rest & SYS_PWR_RESET_FLAG) {
printf("RST: Power On \n");
writel(rest, ASPEED_SYS_RESET_CTRL);
diff --git a/board/aspeed/evb_ast2600/evb_ast2600.c b/board/aspeed/evb_ast2600/evb_ast2600.c
index 7244686bb1..668ae5c855 100644
--- a/board/aspeed/evb_ast2600/evb_ast2600.c
+++ b/board/aspeed/evb_ast2600/evb_ast2600.c
@@ -30,6 +30,8 @@
/* HICRB Bits */
#define HICRB_EN80HSGIO (1 << 13) /* Enable 80hSGIO */
+DECLARE_GLOBAL_DATA_PTR;
+
static void __maybe_unused port80h_snoop_init(void)
{
u32 value;
@@ -210,3 +212,12 @@ int mac_read_from_eeprom(void)
}
#endif
+int update_system_reset_event(void)
+{
+ char str_value[20];
+ memset(str_value, 0, sizeof(str_value));
+ snprintf(str_value, sizeof(str_value), "0x%x", gd->reset_reason);
+ env_set("system_reset_event", str_value);
+ env_save();
+ return 0;
+}
\ No newline at end of file
diff --git a/common/board_r.c b/common/board_r.c
index f1c98362ac..3ad64b881a 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -747,6 +747,9 @@ static init_fnc_t init_sequence_r[] = {
#if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET) \
|| defined(CONFIG_MAC_ADDR_IN_EEPROM)
mac_read_from_eeprom,
+#endif
+#ifdef CONFIG_ASPEED_AST2600
+ update_system_reset_event,
#endif
INIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 78dcf40bff..e81adabf1e 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -133,6 +133,9 @@ typedef struct global_data {
struct spl_handoff *spl_handoff;
# endif
#endif
+#ifdef CONFIG_ASPEED_AST2600
+ u32 reset_reason;
+#endif
} gd_t;
#endif
diff --git a/include/init.h b/include/init.h
index afc953d51e..009f591ea2 100644
--- a/include/init.h
+++ b/include/init.h
@@ -177,6 +177,10 @@ int misc_init_r(void);
int init_func_vid(void);
#endif
+#ifdef CONFIG_ASPEED_AST2600
+int update_system_reset_event(void);
+#endif
+
/* common/board_info.c */
int checkboard(void);
int show_board_info(void);
--
2.25.1