From 12cee554230f39f1066f9a37c720f30d7c34b426 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Wed, 26 Aug 2015 13:54:44 -0500 Subject: system: provide optional chip_save_reset_flags() Certain boards may need to handle fixing up the RESET_FLAG_s because of the boards' designs. Provide an optional per-chip implementation to save the reset flags. Note that this function is not protected by a CONFIG_ option as it can just be implemented by the chip if a board requires it. Lastly, implement chip_save_reset_flags() for mec1322 for future use. BUG=chrome-os-partner:44527 BRANCH=None TEST=Built and booted on glados. Change-Id: I604fe4e6a069f31727bab52288595a349e3dbe72 Signed-off-by: Aaron Durbin Reviewed-on: https://chromium-review.googlesource.com/295115 Reviewed-by: Robbie Zhang Reviewed-by: Shawn N --- chip/mec1322/system.c | 7 ++++++- include/system.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/chip/mec1322/system.c b/chip/mec1322/system.c index d68456777e..398b5262eb 100644 --- a/chip/mec1322/system.c +++ b/chip/mec1322/system.c @@ -91,6 +91,11 @@ void system_pre_init(void) spi_enable(CONFIG_SPI_FLASH_PORT, 1); } +void chip_save_reset_flags(int flags) +{ + MEC1322_VBAT_RAM(HIBDATA_INDEX_SAVED_RESET_FLAGS) = flags; +} + void _system_reset(int flags, int wake_from_hibernate) { uint32_t save_flags = 0; @@ -112,7 +117,7 @@ void _system_reset(int flags, int wake_from_hibernate) else save_flags |= RESET_FLAG_SOFT; - MEC1322_VBAT_RAM(HIBDATA_INDEX_SAVED_RESET_FLAGS) = save_flags; + chip_save_reset_flags(save_flags); /* Trigger watchdog in 1ms */ MEC1322_WDG_LOAD = 1; diff --git a/include/system.h b/include/system.h index 320410b160..e1bb43da93 100644 --- a/include/system.h +++ b/include/system.h @@ -29,6 +29,9 @@ #define RESET_FLAG_PRESERVED (1 << 13) /* Some reset flags preserved from * previous boot */ +/* Per chip implementation to save raw RESET_FLAG_ flags. */ +void chip_save_reset_flags(int flags); + /* System images */ enum system_image_copy_t { SYSTEM_IMAGE_UNKNOWN = 0, -- cgit v1.2.1