summaryrefslogtreecommitdiff
path: root/common/cbi.c
diff options
context:
space:
mode:
authorZhuohao Lee <zhuohao@chromium.org>2021-02-25 17:16:21 +0800
committerCommit Bot <commit-bot@chromium.org>2021-03-04 06:54:33 +0000
commit1f841a5d48bd07277e6639f86c7cbc66cf9bb2c0 (patch)
tree2ad3e357c1833956bf35bb28800a54844f62b2c8 /common/cbi.c
parent2cbb8138fc7cecf24a12add9acb9a6f330589e59 (diff)
downloadchrome-ec-1f841a5d48bd07277e6639f86c7cbc66cf9bb2c0.tar.gz
cbi: Add CONFIG_BYPASS_CBI_EEPROM_WP_CHECK
In some projects, we modify the cbi eeprom write protection via the hardware design. So, the gpio pin GPIO_WP is decoupled from the cbi eeprom write protection status. With this change, we can update the cbi eeprom data on the fly for the dogfood device during the development. In order to bypass the cbi eeprom write protection check, we add a CONFIG_BYPASS_CBI_EEPROM_WP_CHECK to skip the gpio value. Since this modification is only for the developing device, we add the CONFIG_SYSTEM_UNLOCKED check to avoid someone mis-use this config. BUG=b:169034911 BRANCH=volteer TEST=`ectool cbi set` is working in drobit/copano Change-Id: I3f35159883f75965b1009c45c25ac2cd1c6e7c0d Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2719724 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/cbi.c')
-rw-r--r--common/cbi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/cbi.c b/common/cbi.c
index 97bdbf5a2f..3dda7d1f79 100644
--- a/common/cbi.c
+++ b/common/cbi.c
@@ -251,11 +251,13 @@ int cbi_set_board_info(enum cbi_data_tag tag, const uint8_t *buf, uint8_t size)
static int eeprom_is_write_protected(void)
{
-#ifdef CONFIG_WP_ACTIVE_HIGH
+#ifdef CONFIG_BYPASS_CBI_EEPROM_WP_CHECK
+ return 0;
+#elif defined(CONFIG_WP_ACTIVE_HIGH)
return gpio_get_level(GPIO_WP);
#else
return !gpio_get_level(GPIO_WP_L);
-#endif /* CONFIG_WP_ACTIVE_HIGH */
+#endif /* CONFIG_BYPASS_CBI_EEPROM_WP_CHECK */
}
static int write_board_info(void)