aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/virtual.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2016-05-08 23:49:07 +0200
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>2016-10-30 20:30:48 +0000
commiteaacb900dd3ce5257dcfec35a8032a873d141b6a (patch)
tree2cd0d6ba7538f4627b294488fe0f96d10368c364 /src/flash/nor/virtual.c
parentb9ee6dd4655310c0553f4eef853213b11c1df28f (diff)
flash/nor: Add erased_value to drivers and pass it to targets
struct flash_driver has a default_padded_value field that is similar, but it can be changed by the user for the specific purpose of padding. Add a new erased_value field and initialize it for all targets, particularly stm32lx, xmc4xxx and virtual. Use this value in core.c:default_flash_mem_blank_check(), the slow path. Extend the target API to pass erased_value down to target code. Adding an argument ensures that we catch all callers. This allows us to merge xmc4xxx.c:xmc4xxx_blank_check_memory() into armv7m:armv7m_blank_check_memory(). It further allows us to use default_flash_blank_check() in place of xmc4xxx.c:xmc4xxx_flash_blank_check(), adding a potential slow path fallback, as well as stm32lx:stm32lx_erase_check(), adding the potential armv7m fast path with fallback to default_flash_mem_blank_check(). Fix a mips32 code comment while at it (zeroed -> erased). The armv4_5 and mips32 target implementations will now error out if an erase value other than 0xff is used, causing default_flash_blank_check() to fall back to the default_flank_mem_blank_check() slow path. Change-Id: I39323fbbc4b71c256cd567e439896d0245d4745f Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3497 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/flash/nor/virtual.c')
-rw-r--r--src/flash/nor/virtual.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/flash/nor/virtual.c b/src/flash/nor/virtual.c
index 3cb793e3..06981f4f 100644
--- a/src/flash/nor/virtual.c
+++ b/src/flash/nor/virtual.c
@@ -44,6 +44,7 @@ static void virtual_update_bank_info(struct flash_bank *bank)
bank->size = master_bank->size;
bank->chip_width = master_bank->chip_width;
bank->bus_width = master_bank->bus_width;
+ bank->erased_value = master_bank->erased_value;
bank->default_padded_value = master_bank->default_padded_value;
bank->num_sectors = master_bank->num_sectors;
bank->sectors = master_bank->sectors;