summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Huang <david.huang@quanta.corp-partner.google.com>2022-06-07 18:28:03 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-20 03:36:41 +0000
commite0c1795a9ab6599419b763054e89bcf2662a1f6e (patch)
tree56c961dee2c54884c9fac33e6f62675109aa7b8a
parent9dae5323bbc98540cc7ee76450c4286fa99d961d (diff)
downloadchrome-ec-e0c1795a9ab6599419b763054e89bcf2662a1f6e.tar.gz
zephyr: Add controlled EC_CBI_WP
Control EC_CBI_WP based on WP_ODL state. BUG=b:234572033 b:236067475 b:235425819 BRANCH=none TEST=Check EC_CBI_WP status enable/disable when WP_ODL enable/disable. Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: If1a6b4c9ccf663894c33978864acc60bd37a2e45 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3694916 Reviewed-by: Eric Yilun Lin <yllin@google.com> Tested-by: David Huang <david.huang@quanta.corp-partner.google.com> Auto-Submit: David Huang <david.huang@quanta.corp-partner.google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
-rw-r--r--zephyr/app/ec/ec_app_main.c9
-rw-r--r--zephyr/shim/include/config_chip.h5
2 files changed, 14 insertions, 0 deletions
diff --git a/zephyr/app/ec/ec_app_main.c b/zephyr/app/ec/ec_app_main.c
index 12043a3c4a..17c6eeb697 100644
--- a/zephyr/app/ec/ec_app_main.c
+++ b/zephyr/app/ec/ec_app_main.c
@@ -11,6 +11,7 @@
#include "ap_power/ap_pwrseq.h"
#include "button.h"
#include "chipset.h"
+#include "cros_board_info.h"
#include "ec_tasks.h"
#include "hooks.h"
#include "keyboard_scan.h"
@@ -77,6 +78,14 @@ void ec_app_main(void)
}
/*
+ * If the EC has exclusive control over the CBI EEPROM WP signal, have
+ * the EC set the WP if appropriate. Note that once the WP is set, the
+ * EC must be reset via EC_RST_ODL in order for the WP to become unset.
+ */
+ if (IS_ENABLED(CONFIG_PLATFORM_EC_EEPROM_CBI_WP) && system_is_locked())
+ cbi_latch_eeprom_wp();
+
+ /*
* Print the init time. Not completely accurate because it can't take
* into account the time before timer_init(), but it'll at least catch
* the majority of the time.
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 73f38a72f4..a498e6909e 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -2108,6 +2108,11 @@ extern struct jump_data mock_jump_data;
#define I2C_ADDR_EEPROM_FLAGS DT_REG_ADDR(DT_NODELABEL(cbi_eeprom))
#endif
+#undef CONFIG_EEPROM_CBI_WP
+#ifdef CONFIG_PLATFORM_EC_EEPROM_CBI_WP
+#define CONFIG_EEPROM_CBI_WP
+#endif
+
#undef CONFIG_CBI_GPIO
#ifdef CONFIG_PLATFORM_EC_CBI_GPIO
#define CONFIG_CBI_GPIO