From e4f2da5004cc2a8bb27521401bbb258749b5ef67 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Tue, 17 Jan 2017 23:25:55 -0800 Subject: [PATCH] chip/npcx: Add support for chip_save_reset_flags Add and export chip_save_reset_flags to allow boards to use this function when required. BUG=chrome-os-partner:61883 BRANCH=None TEST=Compiles successfully for poppy. Change-Id: I6f96bc61135fc4e3abb62a01d47c2cba8eb45b60 Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/431191 Reviewed-by: Aaron Durbin Reviewed-by: Nicolas Boichat --- chip/npcx/system.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/chip/npcx/system.c b/chip/npcx/system.c index fb310eea4e..d17a200015 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -156,6 +156,11 @@ void system_set_rtc(uint32_t seconds) udelay(MTC_TTC_LOAD_DELAY_US); } +void chip_save_reset_flags(int flags) +{ + bbram_data_write(BBRM_DATA_INDEX_SAVED_RESET_FLAGS, flags); +} + /* Check reset cause */ void system_check_reset_cause(void) { @@ -163,7 +168,7 @@ void system_check_reset_cause(void) uint32_t flags = bbram_data_read(BBRM_DATA_INDEX_SAVED_RESET_FLAGS); /* Clear saved reset flags in bbram */ - bbram_data_write(BBRM_DATA_INDEX_SAVED_RESET_FLAGS, 0); + chip_save_reset_flags(0); /* Clear saved hibernate wake flag in bbram , too */ bbram_data_write(BBRM_DATA_INDEX_WAKE, 0); @@ -601,7 +606,7 @@ void system_reset(int flags) save_flags |= RESET_FLAG_SOFT; /* Store flags to battery backed RAM. */ - bbram_data_write(BBRM_DATA_INDEX_SAVED_RESET_FLAGS, save_flags); + chip_save_reset_flags(save_flags); /* Ask the watchdog to trigger a hard reboot */ system_watchdog_reset();