summaryrefslogtreecommitdiff
path: root/src/flash/nor/cfi.c
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-05-05 15:08:34 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-05-05 15:24:25 +0200
commit737c9b6258c6e68714ae264ff36126eb5d382d6a (patch)
tree508ba9ecd384a3f4d2fda13231d5fe53161e8c78 /src/flash/nor/cfi.c
parentf7e0f3c285e9b1578184da886792e02d253ea687 (diff)
downloadopenocd+libswd-737c9b6258c6e68714ae264ff36126eb5d382d6a.tar.gz
openocd+libswd-737c9b6258c6e68714ae264ff36126eb5d382d6a.tar.bz2
openocd+libswd-737c9b6258c6e68714ae264ff36126eb5d382d6a.tar.xz
openocd+libswd-737c9b6258c6e68714ae264ff36126eb5d382d6a.zip
flash: stop caching protection state
There are a million reasons why cached protection state might be stale: power cycling of target, reset, code executing on the target, etc. The "flash protect_check" command is now gone. This is *always* executed when running a "flash info". As a bonus for more a more robust approach, lots of code could be deleted. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/flash/nor/cfi.c')
-rw-r--r--src/flash/nor/cfi.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c
index 92b553b5..4ef41b9a 100644
--- a/src/flash/nor/cfi.c
+++ b/src/flash/nor/cfi.c
@@ -852,6 +852,17 @@ static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int la
*/
if ((!set) && (!(pri_ext->feature_support & 0x20)))
{
+ /* FIX!!! this code path is broken!!!
+ *
+ * The correct approach is:
+ *
+ * 1. read out current protection status
+ *
+ * 2. override read out protection status w/unprotected.
+ *
+ * 3. re-protect what should be protected.
+ *
+ */
for (i = 0; i < bank->num_sectors; i++)
{
if (bank->sectors[i].is_protected == 1)