diff options
author | Andrew McRae <amcrae@google.com> | 2022-02-11 21:16:08 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-12 07:41:21 +0000 |
commit | 1cb5b8449d147c989bd0ea628a6783785a20f866 (patch) | |
tree | 8c4b2aa38dfac8ca5f8140323900bf35680dae7e | |
parent | 0778437b0ca332c6fc36310cd85fc19d4f3f331b (diff) | |
download | chrome-ec-1cb5b8449d147c989bd0ea628a6783785a20f866.tar.gz |
zephyr: Cache the f/w boot control bits.
Cache the f/w boot control bits so that they
are not read multiple times.
It has been observed on lazor that the bits get
reset (i.e set to FF) sometime after at least one read.
BUG=b:218820985
TEST=zmake configure -b lazor; flash and run
BRANCH=none
Signed-off-by: Andrew McRae <amcrae@google.com>
Change-Id: I8901b988b27f932c584b702e66487f2c0a81a7e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3454927
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r-- | zephyr/shim/chip/npcx/system_external_storage.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/zephyr/shim/chip/npcx/system_external_storage.c b/zephyr/shim/chip/npcx/system_external_storage.c index 373a4a48f7..71d43c2197 100644 --- a/zephyr/shim/chip/npcx/system_external_storage.c +++ b/zephyr/shim/chip/npcx/system_external_storage.c @@ -109,9 +109,12 @@ uint32_t system_get_lfw_address() enum ec_image system_get_shrspi_image_copy(void) { - uint32_t fwctrl = 0; + static uint32_t fwctrl = 0xFFFFFFFF; - syscon_read_reg(mdc_dev, NPCX_FWCTRL, &fwctrl); + /* On first entry, read the value and cache it. */ + if (fwctrl == 0xFFFFFFFF) { + syscon_read_reg(mdc_dev, NPCX_FWCTRL, &fwctrl); + } if (IS_BIT_SET(fwctrl, NPCX_FWCTRL_RO_REGION)) { /* RO image */ #ifdef CHIP_HAS_RO_B |