summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-08-26 13:54:44 -0500
committerchrome-bot <chrome-bot@chromium.org>2015-08-26 21:50:28 -0700
commit12cee554230f39f1066f9a37c720f30d7c34b426 (patch)
treede2e97ed379d90ee9e4df7a2301338f4a65fe29e
parent73338cc9861aabb9656bc81decb254f274b1121f (diff)
downloadchrome-ec-12cee554230f39f1066f9a37c720f30d7c34b426.tar.gz
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 <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/295115 Reviewed-by: Robbie Zhang <robbie.zhang@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--chip/mec1322/system.c7
-rw-r--r--include/system.h3
2 files changed, 9 insertions, 1 deletions
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,