flash/nor/kinetis: do not attempt mass-erase in place of a bank erase 94/2594/3
authorPaul Fertser <fercerpav@gmail.com>
Tue, 10 Mar 2015 19:22:36 +0000 (22:22 +0300)
committerSpencer Oliver <spen@spen-soft.co.uk>
Wed, 25 Mar 2015 20:47:46 +0000 (20:47 +0000)
Many kinetis parts come in multi-bank configuration, so this
optimisation here can't be performed safely.

Investigated and fixed by Richard Braun.

Change-Id: I2b56614b47951595c403a1a8edd3afe11b85679b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2594
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/flash/nor/kinetis.c

index a392a17ba30df713abedd9d5cca5a03d9e510066..396fe42a9c8f3c709993ed7e72cd8869329f3082 100644 (file)
@@ -797,20 +797,6 @@ static int kinetis_ftfx_command(struct flash_bank *bank, uint8_t fcmd, uint32_t
        return ERROR_OK;
 }
 
        return ERROR_OK;
 }
 
-static int kinetis_mass_erase(struct flash_bank *bank)
-{
-       uint8_t ftfx_fstat;
-
-       if (bank->target->state != TARGET_HALTED) {
-               LOG_ERROR("Target not halted");
-               return ERROR_TARGET_NOT_HALTED;
-       }
-
-       LOG_INFO("Execute Erase All Blocks");
-       return kinetis_ftfx_command(bank, FTFx_CMD_MASSERASE, 0,
-                                   0, 0, 0, 0,  0, 0, 0, 0,  &ftfx_fstat);
-}
-
 COMMAND_HANDLER(kinetis_securing_test)
 {
        int result;
 COMMAND_HANDLER(kinetis_securing_test)
 {
        int result;
@@ -845,9 +831,6 @@ static int kinetis_erase(struct flash_bank *bank, int first, int last)
        if ((first > bank->num_sectors) || (last > bank->num_sectors))
                return ERROR_FLASH_OPERATION_FAILED;
 
        if ((first > bank->num_sectors) || (last > bank->num_sectors))
                return ERROR_FLASH_OPERATION_FAILED;
 
-       if ((first == 0) && (last == (bank->num_sectors - 1)))
-               return kinetis_mass_erase(bank);
-
        /*
         * FIXME: TODO: use the 'Erase Flash Block' command if the
         * requested erase is PFlash or NVM and encompasses the entire
        /*
         * FIXME: TODO: use the 'Erase Flash Block' command if the
         * requested erase is PFlash or NVM and encompasses the entire

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)