From c725167ba8e2aa9e43bc86e28b44b6cb444740a8 Mon Sep 17 00:00:00 2001 From: rodrigo_l_rosa Date: Sat, 19 Nov 2011 15:39:20 -0800 Subject: dsp5680xx - mark erase after unlocking flash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the unlocking procedure erases the flash mem (even if it wasn't locked), so it should be marked as erased after unlocking. Change-Id: I5cc6a1e1d6cf4e1f243de532eff54111ffd66187 Signed-off-by: Rodrigo L. Rosa Reviewed-on: http://openocd.zylin.com/222 Tested-by: jenkins Reviewed-by: Øyvind Harboe --- src/flash/nor/dsp5680xx_flash.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/flash/nor/dsp5680xx_flash.c') diff --git a/src/flash/nor/dsp5680xx_flash.c b/src/flash/nor/dsp5680xx_flash.c index 688493b3..d804088f 100644 --- a/src/flash/nor/dsp5680xx_flash.c +++ b/src/flash/nor/dsp5680xx_flash.c @@ -132,8 +132,15 @@ static int dsp5680xx_flash_protect(struct flash_bank *bank, int set, int first, int retval; if(set) retval = dsp5680xx_f_lock(bank->target); - else - retval = dsp5680xx_f_unlock(bank->target); +else{ + retval = dsp5680xx_f_unlock(bank->target); + if (retval == ERROR_OK) { + /* mark all as erased */ + for (int i = 0; i <= (HFM_SECTOR_COUNT-1); i++) + /* FM does not recognize it as erased if erased via JTAG. */ + bank->sectors[i].is_erased = 1; + } +} return retval; } -- cgit v1.2.3-18-g5258