summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2015-03-30 11:01:10 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-04-13 15:27:11 +0000
commit676a995cb3e940b1c9e727ec8a97bef2a14c4ca5 (patch)
treef9dfcdfceb6291c6bc6cbd3b5e4ae693503fae81
parentf224ae87bd6967533d53278541c57414d61d26cf (diff)
downloadchrome-ec-676a995cb3e940b1c9e727ec8a97bef2a14c4ca5.tar.gz
Ryu: Add PD_NO_DEBUG logic
Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=chromium:470299 TEST=make buildall -j Change-Id: I79f831c8a0b581561472470986b86c77b7f824a1 Reviewed-on: https://chromium-review.googlesource.com/264796 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Trybot-Ready: Anton Staaf <robotboy@chromium.org>
-rw-r--r--common/main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/main.c b/common/main.c
index 00bc19df4a..8f9c48e4af 100644
--- a/common/main.c
+++ b/common/main.c
@@ -78,6 +78,21 @@ test_mockable int main(void)
flash_pre_init();
#endif
+#if defined(CONFIG_CASE_CLOSED_DEBUG)
+ /*
+ * If the device is both soft (EC flash protection active) and hard
+ * (WP hardware signal active) write protected then we assert
+ * PD_NO_DEBUG, preventing the EC from interfering with the AP's
+ * access to the SPI flash. The PD_NO_DEBUG signal is latched in
+ * hardware, so changing this GPIO later has no effect.
+ */
+#define FLASH_PROTECT_MASK (EC_FLASH_PROTECT_RO_NOW | \
+ EC_FLASH_PROTECT_GPIO_ASSERTED)
+
+ if ((flash_get_protect() & FLASH_PROTECT_MASK) == FLASH_PROTECT_MASK)
+ gpio_set_level(GPIO_PD_DISABLE_DEBUG, 1);
+#endif
+
/* Set the CPU clocks / PLLs. System is now running at full speed. */
clock_init();