aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSpencer Oliver <spen@spen-soft.co.uk>2012-02-17 14:33:48 +0000
committerSpencer Oliver <spen@spen-soft.co.uk>2012-02-29 11:19:58 +0000
commit38dc2530013a992b98e7926447378dae4f33ed59 (patch)
tree877b28c80838025fa9c818a7847f017c6b7ca17f /src
parent6dfd56a7432fd7daa60ef8caa78f13576049de03 (diff)
downloadriscv-openocd-38dc2530013a992b98e7926447378dae4f33ed59.zip
riscv-openocd-38dc2530013a992b98e7926447378dae4f33ed59.tar.gz
riscv-openocd-38dc2530013a992b98e7926447378dae4f33ed59.tar.bz2
flash: change stm32lx driver probe behaviour
Currently stm32lx flash driver will remove the readout protection if set during a probe. This may not be what the user wants, so let them decide. Change-Id: I8575e3b339b10a4f7bac57cca9586dcab513d347 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/465 Tested-by: jenkins
Diffstat (limited to 'src')
-rw-r--r--src/flash/nor/stm32lx.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c
index 58a2a80..3bc825a 100644
--- a/src/flash/nor/stm32lx.c
+++ b/src/flash/nor/stm32lx.c
@@ -463,7 +463,6 @@ static int stm32lx_probe(struct flash_bank *bank)
int i;
uint16_t flash_size;
uint32_t device_id;
- uint32_t reg32;
stm32lx_info->probed = 0;
@@ -479,64 +478,6 @@ static int stm32lx_probe(struct flash_bank *bank)
return ERROR_FAIL;
}
- /* Read the RDP byte and check if it is 0xAA */
- uint8_t rdp;
- retval = target_read_u32(target, FLASH_OBR, &reg32);
- if (retval != ERROR_OK)
- return retval;
- rdp = reg32 & 0xFF;
- if (rdp != 0xAA) {
- /*
- * Unlocking the option byte is done by unlocking the PECR, then
- * by writing the 2 option byte keys to OPTKEYR
- */
-
- /* To unlock the PECR write the 2 PEKEY to the PEKEYR register */
- retval = target_write_u32(target, FLASH_PEKEYR, PEKEY1);
- if (retval != ERROR_OK)
- return retval;
-
- retval = target_write_u32(target, FLASH_PEKEYR, PEKEY2);
- if (retval != ERROR_OK)
- return retval;
-
- /* Make sure it worked */
- retval = target_read_u32(target, FLASH_PECR, &reg32);
- if (retval != ERROR_OK)
- return retval;
-
- if (reg32 & FLASH_PECR__PELOCK)
- return ERROR_FLASH_OPERATION_FAILED;
-
- retval = target_write_u32(target, FLASH_OPTKEYR, OPTKEY1);
- if (retval != ERROR_OK)
- return retval;
- retval = target_write_u32(target, FLASH_OPTKEYR, OPTKEY2);
- if (retval != ERROR_OK)
- return retval;
-
- retval = target_read_u32(target, FLASH_PECR, &reg32);
- if (retval != ERROR_OK)
- return retval;
-
- if (reg32 & FLASH_PECR__OPTLOCK) {
- LOG_ERROR("OPTLOCK is not cleared");
- return ERROR_FLASH_OPERATION_FAILED;
- }
-
- /* Then, write RDP to 0x00 to set level 1 */
- reg32 = ((~0xAA) << 16) | (0xAA);
- retval = target_write_u32(target, OB_RDP, reg32);
- if (retval != ERROR_OK)
- return retval;
-
- /* Set Automatic update of the option byte, by setting OBL_LAUNCH in FLASH_PECR */
- reg32 = FLASH_PECR__OBL_LAUNCH;
- retval = target_write_u32(target, FLASH_PECR, reg32);
- if (retval != ERROR_OK)
- return retval;
- }
-
/* get flash size from target. */
retval = target_read_u16(target, F_SIZE, &flash_size);
if (retval != ERROR_OK)