From: David B. <dbr...@us...> - 2010-02-02 18:31:20
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via cc440ca1d44f0aaaf34daa365966b7b092126913 (commit) via 503f6139c7ed05339daea8c4984d32840d795222 (commit) from 3d2d5dcc9c27b84dc2e5e9ed53be0f784a450042 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit cc440ca1d44f0aaaf34daa365966b7b092126913 Author: Edgar Grimberg <edg...@zy...> Date: Tue Feb 2 13:17:26 2010 +0100 tcl/str7x: Reset init unlocks the flash For STR7x flash, the device cannot be queried for the protect status. The solution is to remove the protection on reset init. The driver also initialises the sector protect field to unprotected. [dbr...@us...: line length shrinkage] Signed-off-by: Edgar Grimberg <edg...@zy...> Signed-off-by: David Brownell <dbr...@us...> diff --git a/tcl/target/str730.cfg b/tcl/target/str730.cfg index 381fa5f..cab2338 100644 --- a/tcl/target/str730.cfg +++ b/tcl/target/str730.cfg @@ -34,7 +34,14 @@ set _TARGETNAME $_CHIPNAME.cpu target create $_TARGETNAME arm7tdmi -endian little -chain-position 0 -variant arm7tdmi $_TARGETNAME configure -event reset-start { jtag_khz 10 } -$_TARGETNAME configure -event reset-init { jtag_khz 3000 } +$_TARGETNAME configure -event reset-init { + jtag_khz 3000 + +# Because the hardware cannot be interrogated for the protection state +# of sectors, initialize all the sectors to be unprotected. The initial +# state is reflected by the driver, too. + flash protect 0 0 last off +} $_TARGETNAME configure -event gdb-flash-erase-start { flash protect 0 0 7 off } diff --git a/tcl/target/str750.cfg b/tcl/target/str750.cfg index 5df968b..c467ae2 100644 --- a/tcl/target/str750.cfg +++ b/tcl/target/str750.cfg @@ -36,7 +36,15 @@ set _TARGETNAME $_CHIPNAME.cpu target create $_TARGETNAME arm7tdmi -endian little -chain-position 0 -variant arm7tdmi $_TARGETNAME configure -event reset-start { jtag_khz 10 } -$_TARGETNAME configure -event reset-init { jtag_khz 3000 } +$_TARGETNAME configure -event reset-init { + jtag_khz 3000 + +# Because the hardware cannot be interrogated for the protection state +# of sectors, initialize all the sectors to be unprotected. The initial +# state is reflected by the driver, too. + flash protect 0 0 last off + flash protect 1 0 last off +} $_TARGETNAME configure -event gdb-flash-erase-start { flash protect 0 0 7 off flash protect 1 0 1 off commit 503f6139c7ed05339daea8c4984d32840d795222 Author: Edgar Grimberg <edg...@zy...> Date: Tue Feb 2 10:39:52 2010 +0100 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. [dbr...@us...: line length shrinkage] Signed-off-by: Edgar Grimberg <edg...@zy...> Signed-off-by: David Brownell <dbr...@us...> 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; } diff --git a/tcl/target/str710.cfg b/tcl/target/str710.cfg index 9da69ac..028c604 100644 --- a/tcl/target/str710.cfg +++ b/tcl/target/str710.cfg @@ -30,7 +30,15 @@ set _TARGETNAME $_CHIPNAME.cpu target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi $_TARGETNAME configure -event reset-start { jtag_khz 10 } -$_TARGETNAME configure -event reset-init { jtag_khz 6000 } +$_TARGETNAME configure -event reset-init { + jtag_khz 6000 + +# Because the hardware cannot be interrogated for the protection state +# of sectors, initialize all the sectors to be unprotected. The initial +# state is reflected by the driver, too. + flash protect 0 0 last off + flash protect 1 0 last off +} $_TARGETNAME configure -event gdb-flash-erase-start { flash protect 0 0 7 off flash protect 1 0 1 off ----------------------------------------------------------------------- Summary of changes: src/flash/nor/str7x.c | 16 ++++++++++++++-- tcl/target/str710.cfg | 10 +++++++++- tcl/target/str730.cfg | 9 ++++++++- tcl/target/str750.cfg | 10 +++++++++- 4 files changed, 40 insertions(+), 5 deletions(-) hooks/post-receive -- Main OpenOCD repository |