summaryrefslogtreecommitdiff
path: root/chip/g/flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/g/flash.c')
-rw-r--r--chip/g/flash.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/chip/g/flash.c b/chip/g/flash.c
index 22376d5fbe..04074cc3b5 100644
--- a/chip/g/flash.c
+++ b/chip/g/flash.c
@@ -45,6 +45,16 @@
int flash_pre_init(void)
{
+ /* Enable access to the upper half of the flash */
+ uint32_t half = CONFIG_FLASH_SIZE / 2;
+
+ GWRITE(GLOBALSEC, FLASH_REGION2_BASE_ADDR,
+ CONFIG_MAPPED_STORAGE_BASE + half);
+ GWRITE(GLOBALSEC, FLASH_REGION2_SIZE, half - 1);
+ GWRITE_FIELD(GLOBALSEC, FLASH_REGION2_CTRL, WR_EN, 1);
+ GWRITE_FIELD(GLOBALSEC, FLASH_REGION2_CTRL, RD_EN, 1);
+ GWRITE_FIELD(GLOBALSEC, FLASH_REGION2_CTRL, EN, 1);
+
return EC_SUCCESS;
}