diff --git a/chip/mec1322/lfw/ec_lfw.c b/chip/mec1322/lfw/ec_lfw.c index 997e41aa0b..cb690fb3e1 100644 --- a/chip/mec1322/lfw/ec_lfw.c +++ b/chip/mec1322/lfw/ec_lfw.c @@ -202,16 +202,23 @@ void uart_init(void) void system_init(void) { - uint32_t status = MEC1322_VBAT_STS; uint32_t wdt_cnt = MEC1322_EC_WDT_CNT; + uint32_t rst_sts = MEC1322_PCR_CHIP_PWR_RST & + (MEC1322_PWR_RST_STS_VCC1 | + MEC1322_PWR_RST_STS_VBAT); - /* Reset the image type if reset cause is power-on */ - if (status & (1 << 7) || (wdt_cnt == 0)) + /* + * BIT[6:5] determine VCC1 reset and VBAT reset status. + * when Poweron watchdog is reset and both VCC1 and VBAT + * are set + */ + if ((rst_sts == (MEC1322_PWR_RST_STS_VCC1 | + MEC1322_PWR_RST_STS_VBAT)) + && (wdt_cnt == 0)) MEC1322_VBAT_RAM(MEC1322_IMAGETYPE_IDX) = SYSTEM_IMAGE_UNKNOWN; } - enum system_image_copy_t system_get_image_copy(void) { return MEC1322_VBAT_RAM(MEC1322_IMAGETYPE_IDX);