summaryrefslogtreecommitdiff
path: root/chip/stm32
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2012-06-22 18:18:17 +0800
committerGerrit <chrome-bot@google.com>2012-09-05 16:00:28 -0700
commit8a9471e5ef305a2aea81e6cb62a17d6966865b6b (patch)
tree73f9deda68cd4e76d646a6c2ba15aa0bd8913622 /chip/stm32
parent696b908f53a9d33bc9ce1a676ee646f45d489ee5 (diff)
downloadchrome-ec-8a9471e5ef305a2aea81e6cb62a17d6966865b6b.tar.gz
stm32: Store VbNvContext in backup registers
This would improve boot speed when compared to storing in eMMC because initialing eMMC is slow. So far other platforms do not have this need because CMOS is quite efficient; thus it is left unimplemented in lm4. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BRANCH=snow BUG=chrome-os-partner:10660,13094 TEST=On Snow, see VbNvContext is preserved across power cycles (you have to patch U-Boot to test this) Change-Id: If5072c678b87bc47a3a82a1dff2afa3896304f36 Reviewed-on: https://gerrit.chromium.org/gerrit/31832 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Diffstat (limited to 'chip/stm32')
-rw-r--r--chip/stm32/system.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/chip/stm32/system.c b/chip/stm32/system.c
index f5f7dff73d..df10f6810a 100644
--- a/chip/stm32/system.c
+++ b/chip/stm32/system.c
@@ -19,6 +19,14 @@
enum bkpdata_index {
BKPDATA_INDEX_SCRATCHPAD, /* General-purpose scratchpad */
BKPDATA_INDEX_SAVED_RESET_FLAGS,/* Saved reset flags */
+ BKPDATA_INDEX_VBNV_CONTEXT0,
+ BKPDATA_INDEX_VBNV_CONTEXT1,
+ BKPDATA_INDEX_VBNV_CONTEXT2,
+ BKPDATA_INDEX_VBNV_CONTEXT3,
+ BKPDATA_INDEX_VBNV_CONTEXT4,
+ BKPDATA_INDEX_VBNV_CONTEXT5,
+ BKPDATA_INDEX_VBNV_CONTEXT6,
+ BKPDATA_INDEX_VBNV_CONTEXT7,
};
@@ -217,6 +225,41 @@ const char *system_get_chip_revision(void)
}
+int system_get_vbnvcontext(uint8_t *block)
+{
+ enum bkpdata_index i;
+ uint16_t value;
+
+ for (i = BKPDATA_INDEX_VBNV_CONTEXT0;
+ i <= BKPDATA_INDEX_VBNV_CONTEXT7; i++) {
+ value = bkpdata_read(i);
+ *block++ = (uint8_t)(value & 0xff);
+ *block++ = (uint8_t)(value >> 8);
+ }
+
+ return EC_SUCCESS;
+}
+
+
+int system_set_vbnvcontext(const uint8_t *block)
+{
+ enum bkpdata_index i;
+ uint16_t value;
+ int err;
+
+ for (i = BKPDATA_INDEX_VBNV_CONTEXT0;
+ i <= BKPDATA_INDEX_VBNV_CONTEXT7; i++) {
+ value = *block++;
+ value |= ((uint16_t)*block++) << 8;
+ err = bkpdata_write(i, value);
+ if (err)
+ return err;
+ }
+
+ return EC_SUCCESS;
+}
+
+
/* TODO: crosbug.com/p/12036 */
int system_set_fake_wp(int val)
{