mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 01:50:53 +00:00
mec1322: Add support for VBAT backed RAM
This will be used for saving data across reboots. BUG=chrome-os-partner:24107 TEST=Enable scratchpad command and check value is preserved across watchdog reboot. BRANCH=None Change-Id: Ifd68541a3f842c466b6ff49bcc654c92df48aac6 Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/178276 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
8d2fc77326
commit
0e0bc8bbbd
@@ -121,6 +121,7 @@ static inline uintptr_t gpio_port_base(int port_id)
|
||||
#define MEC1322_VBAT_BASE 0x4000a400
|
||||
#define MEC1322_VBAT_STS REG32(MEC1322_VBAT_BASE + 0x0)
|
||||
#define MEC1322_VBAT_CE REG32(MEC1322_VBAT_BASE + 0x8)
|
||||
#define MEC1322_VBAT_RAM(x) REG32(MEC1322_VBAT_BASE + 0x400 + 4 * (x))
|
||||
|
||||
|
||||
/* LPC */
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
#include "timer.h"
|
||||
#include "util.h"
|
||||
|
||||
/* Indices for hibernate data registers (RAM backed by VBAT) */
|
||||
enum hibdata_index {
|
||||
HIBDATA_INDEX_SCRATCHPAD = 0, /* General-purpose scratchpad */
|
||||
HIBDATA_INDEX_SAVED_RESET_FLAGS /* Saved reset flags */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -78,6 +83,17 @@ int system_set_vbnvcontext(const uint8_t *block)
|
||||
return EC_ERROR_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
int system_set_scratchpad(uint32_t value)
|
||||
{
|
||||
MEC1322_VBAT_RAM(HIBDATA_INDEX_SCRATCHPAD) = value;
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t system_get_scratchpad(void)
|
||||
{
|
||||
return MEC1322_VBAT_RAM(HIBDATA_INDEX_SCRATCHPAD);
|
||||
}
|
||||
|
||||
void system_hibernate(uint32_t seconds, uint32_t microseconds)
|
||||
{
|
||||
/* TODO(crosbug.com/p/24107): Implement this */
|
||||
|
||||
Reference in New Issue
Block a user