diff options
author | Edgar Grimberg <edgar.grimberg@zylin.com> | 2010-02-02 10:39:52 +0100 |
---|---|---|
committer | David Brownell <dbrownell@users.sourceforge.net> | 2010-02-02 09:30:33 -0800 |
commit | 503f6139c7ed05339daea8c4984d32840d795222 (patch) | |
tree | 97dd0ae96d776635f9ce98c73ee53ea450250de2 /src | |
parent | 3d2d5dcc9c27b84dc2e5e9ed53be0f784a450042 (diff) | |
download | riscv-openocd-503f6139c7ed05339daea8c4984d32840d795222.zip riscv-openocd-503f6139c7ed05339daea8c4984d32840d795222.tar.gz riscv-openocd-503f6139c7ed05339daea8c4984d32840d795222.tar.bz2 |
flash/str7x: After reset init the flash is unlocked
The default state of the STR7 flash after a reset init is unlocked.
The information in the flash driver now reflects this.
The information about the lock status cannot be read from the
flash chip, so the user is informed that flash info might not
contain accurate information.
[dbrownell@users.sourceforge.net: line length shrinkage]
Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/flash/nor/str7x.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index a2e27da..3bf07c9 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -93,7 +93,10 @@ static int str7x_build_block_list(struct flash_bank *bank) bank->sectors[num_sectors].offset = mem_layout_str7bank0[i].sector_start; bank->sectors[num_sectors].size = mem_layout_str7bank0[i].sector_size; bank->sectors[num_sectors].is_erased = -1; - bank->sectors[num_sectors].is_protected = 1; + /* the reset_init handler marks all the sectors unprotected, + * matching hardware after reset; keep the driver in sync + */ + bank->sectors[num_sectors].is_protected = 0; str7x_info->sector_bits[num_sectors++] = mem_layout_str7bank0[i].sector_bit; } @@ -102,7 +105,10 @@ static int str7x_build_block_list(struct flash_bank *bank) bank->sectors[num_sectors].offset = mem_layout_str7bank1[i].sector_start; bank->sectors[num_sectors].size = mem_layout_str7bank1[i].sector_size; bank->sectors[num_sectors].is_erased = -1; - bank->sectors[num_sectors].is_protected = 1; + /* the reset_init handler marks all the sectors unprotected, + * matching hardware after reset; keep the driver in sync + */ + bank->sectors[num_sectors].is_protected = 0; str7x_info->sector_bits[num_sectors++] = mem_layout_str7bank1[i].sector_bit; } @@ -600,6 +606,12 @@ COMMAND_HANDLER(str7x_handle_part_id_command) static int str7x_info(struct flash_bank *bank, char *buf, int buf_size) { snprintf(buf, buf_size, "str7x flash driver info"); + /* STR7x flash doesn't support sector protection interrogation. + * FLASH_NVWPAR acts as a write only register; its read value + * doesn't reflect the actual protection state of the sectors. + */ + LOG_WARNING("STR7x flash lock information might not be correct " + "due to hardware limitations."); return ERROR_OK; } |