summaryrefslogtreecommitdiff
path: root/chip/lm4/flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/lm4/flash.c')
-rw-r--r--chip/lm4/flash.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/chip/lm4/flash.c b/chip/lm4/flash.c
index 826783b45b..8eab52ca9c 100644
--- a/chip/lm4/flash.c
+++ b/chip/lm4/flash.c
@@ -326,8 +326,12 @@ int flash_set_protect(uint32_t mask, uint32_t flags)
retval = rv;
}
- /* All subsequent flags only work if write protect is disabled */
- if (!(flash_get_protect() & EC_FLASH_PROTECT_GPIO_ASSERTED))
+ /*
+ * All subsequent flags only work if write protect is enabled (that is,
+ * hardware WP flag) *and* RO is protected at boot (software WP flag).
+ */
+ if ((~flash_get_protect()) & (EC_FLASH_PROTECT_GPIO_ASSERTED |
+ EC_FLASH_PROTECT_RO_AT_BOOT))
return retval;
if ((mask & EC_FLASH_PROTECT_RO_NOW) &&