summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShamile Khan <shamile.khan@intel.com>2017-01-06 15:44:48 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-01-10 21:35:24 -0800
commitd87ad06a6d44bd68e22417115d0a53f5f9d3fb20 (patch)
treed45095cab0d8be3e18f585f9fb528a4e22be5d0c
parent67c708142564ca23ee303472b4c50f8928da0eb4 (diff)
downloadchrome-ec-d87ad06a6d44bd68e22417115d0a53f5f9d3fb20.tar.gz
npcx: flash: Do not delay flash access requests.
When depthcharge invokes a Host command that needs EC to access flash, the response is delayed by approx 150 ms because EC is busy with another flash operation to determine size of RW image for computing hash. We can eliminate this delay and also speed up the flash operation by using the same mechanism that is used for mec1322 based designs which also use external SPI flash. The changes are: a) We access 4 bytes from SPI flash at a time instead of a single byte b) We split flash accesses into smaller parts which means that mutex lock is acquired for a short duration. BUG=chrome-os-partner:59875 BRANCH=none TEST=make buildall -j After sysjump to RW, in EC Log the "hash start" is printed approx 120 ms earlier. Change-Id: Icb633379c992e795ba40eaf54fe9ec31747d4be6 Signed-off-by: Shamile Khan <shamile.khan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/426016 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--common/system.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/system.c b/common/system.c
index 5baea57c95..ddabe3aa3c 100644
--- a/common/system.c
+++ b/common/system.c
@@ -370,7 +370,7 @@ test_mockable enum system_image_copy_t system_get_image_copy(void)
*/
int system_get_image_used(enum system_image_copy_t copy)
{
-#ifndef CONFIG_MAPPED_STORAGE
+#ifdef CONFIG_EXTERNAL_STORAGE
static uint8_t buf[SPI_FLASH_MAX_WRITE_SIZE];
#endif
int image_offset;
@@ -388,7 +388,7 @@ int system_get_image_used(enum system_image_copy_t copy)
image_offset = (copy == SYSTEM_IMAGE_RW) ?
CONFIG_EC_WRITABLE_STORAGE_OFF + CONFIG_RW_STORAGE_OFF :
CONFIG_EC_PROTECTED_STORAGE_OFF + CONFIG_RO_STORAGE_OFF;
-#ifndef CONFIG_MAPPED_STORAGE
+#ifdef CONFIG_EXTERNAL_STORAGE
image = buf;
do {