From 676a995cb3e940b1c9e727ec8a97bef2a14c4ca5 Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Mon, 30 Mar 2015 11:01:10 -0700 Subject: Ryu: Add PD_NO_DEBUG logic Signed-off-by: Anton Staaf BRANCH=None BUG=chromium:470299 TEST=make buildall -j Change-Id: I79f831c8a0b581561472470986b86c77b7f824a1 Reviewed-on: https://chromium-review.googlesource.com/264796 Reviewed-by: Randall Spangler Tested-by: Anton Staaf Commit-Queue: Anton Staaf Trybot-Ready: Anton Staaf --- common/main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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(); -- cgit v1.2.1