diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-07-08 11:11:06 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-07-08 13:53:59 -0700 |
commit | 49799b827856bd911e6b86821a9ec95687c4ca78 (patch) | |
tree | 9d3cd08a308f54e67c504090a1f23d269db16def /chip/stm32/flash-stm32l.c | |
parent | 4e31062449cce3a86cd855403c147213cdbd06cc (diff) | |
download | chrome-ec-49799b827856bd911e6b86821a9ec95687c4ca78.tar.gz |
stm32l: Fix flash_is_erased() detection
STM32L erases flash to 0, not 1, so we need a config value to indicate
that. This speeds up flash erase on STM32L by not re-erasing
already-erased blocks.
BUG=chrome-os-partner:13066
BRANCH=none
TEST=manual - hack flash_physical_erase() to print something just after
flash_is_erased() check.
1. flasherase 0x1f800 0x800
2. flashwrite 0x1fa00 0x100
3. flasherase 0x1f800 0x800 -> only re-erases 0x1fa00
Change-Id: I4d726caf0605e7815b9360bb2d44bdfdd757b4a2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61110
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'chip/stm32/flash-stm32l.c')
-rw-r--r-- | chip/stm32/flash-stm32l.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/chip/stm32/flash-stm32l.c b/chip/stm32/flash-stm32l.c index afb614b921..a08328baa0 100644 --- a/chip/stm32/flash-stm32l.c +++ b/chip/stm32/flash-stm32l.c @@ -263,11 +263,10 @@ int flash_physical_erase(int offset, int size) address += CONFIG_FLASH_ERASE_SIZE / sizeof(uint32_t)) { timestamp_t deadline; - /* - * crosbug.com/p/13066 - * We can't do the flash_is_erased() trick on stm32l since - * bits erase to 0, not 1. Will address later if needed. - */ + /* Do nothing if already erased */ + if (flash_is_erased((uint32_t)address - CONFIG_FLASH_BASE, + CONFIG_FLASH_ERASE_SIZE)) + continue; /* Start erase */ *address = 0x00000000; |