diff options
author | Vic Yang <victoryang@chromium.org> | 2014-10-09 14:04:32 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-15 20:49:35 +0000 |
commit | 4a9cabc3f9e8cfbeee857180c8a0b400ef7c8092 (patch) | |
tree | 6cdc15de6e9995be04351870030ef334fee9459d /include/flash.h | |
parent | b8f73a451d9f0e62aba43dab1184bc1352ee968f (diff) | |
download | chrome-ec-4a9cabc3f9e8cfbeee857180c8a0b400ef7c8092.tar.gz |
Factor out common flash code for STM32F and STM32F0
This is a preparatory work for the following change for write protection
support on STM32F0.
BUG=chrome-os-partner:32745
TEST=make buildall
BRANCH=samus
Change-Id: Ic4deea06e26c4a6ac024a5388e1a5783b40e9876
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/222660
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/flash.h')
-rw-r--r-- | include/flash.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/include/flash.h b/include/flash.h index 2079032a0a..dff1be7948 100644 --- a/include/flash.h +++ b/include/flash.h @@ -28,6 +28,13 @@ #define PSTATE_BANK (PSTATE_OFFSET / CONFIG_FLASH_BANK_SIZE) #define PSTATE_BANK_COUNT (PSTATE_SIZE / CONFIG_FLASH_BANK_SIZE) +/* Range of write protection */ +enum flash_wp_range { + FLASH_WP_NONE = 0, + FLASH_WP_RO, + FLASH_WP_ALL, +}; + /*****************************************************************************/ /* Low-level methods, for use by flash_common. */ @@ -70,12 +77,12 @@ int flash_physical_get_protect(int bank); uint32_t flash_physical_get_protect_flags(void); /** - * Enable/disable protecting RO firmware and pstate at boot. + * Enable/disable protecting firmware/pstate at boot. * - * @param enable Enable (non-zero) or disable (zero) protection + * @param range The range to protect * @return non-zero if error. */ -int flash_physical_protect_ro_at_boot(int enable); +int flash_physical_protect_at_boot(enum flash_wp_range range); /** * Protect flash now. @@ -96,6 +103,13 @@ int flash_physical_protect_now(int all); */ int flash_physical_force_reload(void); +/** + * Restore flash physical layer state after sysjump. + * + * @return non-zero if restored. + */ +int flash_physical_restore_state(void); + /*****************************************************************************/ /* Low-level common code for use by flash modules. */ |