--- a/common/spl/spl.c 2022-12-06 11:26:57.000000000 +0900 +++ b/common/spl/spl.c 2023-09-12 11:03:56.491393473 +0900 @@ -42,6 +42,16 @@ #define CONFIG_SYS_MONITOR_LEN (200 * 1024) #endif +#define COLD_BOOT 0 +#define MCU_CTRL_MMR0_BASE 0x04500000 +#define CTRL_MMR0_BASE 0x43000000 +#define CTRLMMR_MCU_RST_CTRL 0x04518170 +#define CTRLMMR_RST_CTRL_PHY0 0x43018170 +#define CTRLMMR_RST_CTRL_PHY1 0x4301A170 +#define CTRLMMR_MCU_RST_SRC (MCU_CTRL_MMR0_BASE + 0x18178) +#define CTRLMMR_RST_SRC_PHY0 (CTRL_MMR0_BASE + 0x18178) +#define CTRLMMR_RST_SRC_PHY1 (CTRL_MMR0_BASE + 0x1A178) + u32 *boot_params_ptr = NULL; /* See spl.h for information about this */ @@ -803,10 +813,26 @@ #ifdef CONFIG_SPL_STACK_R gd_t *new_gd; ulong ptr = CONFIG_SPL_STACK_R_ADDR; + u32 stat_test, statphy0_test, statphy1_test; + int rst_src; if (CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE)) spl_relocate_stack_check(); + rst_src = readl(CTRLMMR_MCU_RST_SRC); + printf("For second reset read rst_src = %x\n", rst_src); + if (rst_src == COLD_BOOT || !(rst_src & 0x1000000)) { + stat_test = readl(CTRLMMR_MCU_RST_CTRL); + stat_test &= 0xFFFFF666; +/* statphy0_test = readl(CTRLMMR_RST_CTRL_PHY0); /* */ +/* statphy0_test &= 0xFFFFFF66; /* */ +/* statphy1_test = readl(CTRLMMR_RST_CTRL_PHY1); /* */ +/* statphy1_test &= 0xFFFFFF66; /* */ +/* writel(statphy0_test, CTRLMMR_RST_CTRL_PHY0); /* */ +/* writel(statphy1_test, CTRLMMR_RST_CTRL_PHY1); /* */ + writel(stat_test, CTRLMMR_MCU_RST_CTRL); + } + #if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE) && CONFIG_VAL(SYS_MALLOC_F_LEN) if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) { debug("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n",