From af27fe89838f55cd14be98d0691326627e87b39f Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Mon, 13 Apr 2015 08:57:21 -0700 Subject: CCD: Switch PD_NO_DEBUG logic to use system_is_locked The system_is_locked function encompases the required checks for asserting PD_NO_DEBUG. It also supports forcing a system to be unlocked at build time, as well as handling systems without flash. Signed-off-by: Anton Staaf BRANCH=None BUG=None TEST=make buildall -j Change-Id: I676acb5a2ae169f9739a19910a760706f69f5b7b Reviewed-on: https://chromium-review.googlesource.com/265463 Trybot-Ready: Anton Staaf Tested-by: Anton Staaf Reviewed-by: Alec Berg Commit-Queue: Anton Staaf --- common/main.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'common/main.c') diff --git a/common/main.c b/common/main.c index 8f9c48e4af..f30f2970cd 100644 --- a/common/main.c +++ b/common/main.c @@ -80,17 +80,12 @@ test_mockable int main(void) #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. + * If the device is locked 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); + gpio_set_level(GPIO_PD_DISABLE_DEBUG, system_is_locked()); #endif /* Set the CPU clocks / PLLs. System is now running at full speed. */ -- cgit v1.2.1