diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-05-21 11:03:29 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-05-23 11:08:44 -0700 |
commit | a1006865e7f695ddd1c730cc9c6c6a6f109c43b9 (patch) | |
tree | 70f68e84e2340b7bf4210de177ee000ece27fda0 /chip/lm4/flash.c | |
parent | bd8fec9bae8fc36cc1e46bf0417f2da00530b522 (diff) | |
download | chrome-ec-a1006865e7f695ddd1c730cc9c6c6a6f109c43b9.tar.gz |
Move write protect GPIO handling to flash module
Write protect signal naming is now consistent across boards.
New CONFIG_WP_ACTIVE_HIGH is present on systems where the write
protect signal is active-high (e.g. Link). This will be used in the
next CL, which moves flash_get_protect() to flash_common.c
BUG=chrome-os-partner:15613
BRANCH=none
TEST=flashinfo properly reports WP signal status
Change-Id: I502ab033c3eb36661cc3ee97320874b3fbf6fc0d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56087
Reviewed-by: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'chip/lm4/flash.c')
-rw-r--r-- | chip/lm4/flash.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/chip/lm4/flash.c b/chip/lm4/flash.c index f7a08d67dd..2a8e45c1b6 100644 --- a/chip/lm4/flash.c +++ b/chip/lm4/flash.c @@ -6,6 +6,7 @@ /* Flash memory module for Chrome EC */ #include "flash.h" +#include "gpio.h" #include "registers.h" #include "switch.h" #include "system.h" @@ -176,6 +177,11 @@ int flash_physical_get_protect(int bank) return (LM4_FLASH_FMPPE[F_BANK(bank)] & F_BIT(bank)) ? 0 : 1; } +int flash_physical_get_all_protect_now(void) +{ + return all_protected; +} + /*****************************************************************************/ /* High-level APIs */ @@ -186,18 +192,16 @@ uint32_t flash_get_protect(void) int i; /* Read all-protected state from our shadow copy */ - if (all_protected) + if (flash_physical_get_all_protect_now()) flags |= EC_FLASH_PROTECT_ALL_NOW; /* Read the current persist state from flash */ if (flash_get_protect_ro_at_boot()) flags |= EC_FLASH_PROTECT_RO_AT_BOOT; -#ifdef HAS_TASK_SWITCH /* Check if write protect pin is asserted now */ - if (switch_get_write_protect()) + if (gpio_get_level(GPIO_WP)) flags |= EC_FLASH_PROTECT_GPIO_ASSERTED; -#endif /* Scan flash protection */ for (i = 0; i < PHYSICAL_BANKS; i++) { |