NOR/CFI: remove use of cfi_add_byte()
authorAntonio Borneo <borneo.antonio@gmail.com>
Fri, 7 May 2010 06:03:39 +0000 (14:03 +0800)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Sun, 16 May 2010 11:39:47 +0000 (13:39 +0200)
Remove the function cfi_add_byte() and rewrite the only
instance of it.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
src/flash/nor/cfi.c

index b2d184d4a582c6b9d5a78cdb39ab4195f8ad6f5b..94ff7b9479c10e813101c2e15833caa97bf5aaa1 100644 (file)
@@ -953,40 +953,6 @@ static int cfi_protect(struct flash_bank *bank, int set, int first, int last)
        }
 }
 
-/* FIXME Replace this by a simple memcpy() - still unsure about sideeffects */
-static void cfi_add_byte(struct flash_bank *bank, uint8_t *word, uint8_t byte)
-{
-       /* struct target *target = bank->target; */
-
-       int i;
-
-       /* NOTE:
-        * The data to flash must not be changed in endian! We write a bytestrem in
-        * target byte order already. Only the control and status byte lane of the flash
-        * WSM is interpreted by the CPU in different ways, when read a uint16_t or uint32_t
-        * word (data seems to be in the upper or lower byte lane for uint16_t accesses).
-        */
-
-#if 0
-       if (target->endianness == TARGET_LITTLE_ENDIAN)
-       {
-#endif
-               /* shift bytes */
-               for (i = 0; i < bank->bus_width - 1; i++)
-                       word[i] = word[i + 1];
-               word[bank->bus_width - 1] = byte;
-#if 0
-       }
-       else
-       {
-               /* shift bytes */
-               for (i = bank->bus_width - 1; i > 0; i--)
-                       word[i] = word[i - 1];
-               word[0] = byte;
-       }
-#endif
-}
-
 /* Convert code image to target endian */
 /* FIXME create general block conversion fcts in target.c?) */
 static void cfi_fix_code_endian(struct target *target, uint8_t *dest, const uint32_t *src, uint32_t count)
@@ -1936,12 +1902,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset,
                                if (fallback)
                                {
                                        for (i = 0; i < bank->bus_width; i++)
-                                               current_word[i] = 0;
-
-                                       for (i = 0; i < bank->bus_width; i++)
-                                       {
-                                               cfi_add_byte(bank, current_word, *buffer++);
-                                       }
+                                               current_word[i] = *buffer++;
 
                                        retval = cfi_write_word(bank, current_word, write_p);
                                        if (retval != ERROR_OK)

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)