topic: Added Spansion S25FL128S and S25FL256S spifi devices.
[openocd.git] / src / flash / nor / cfi.c
index c443de2dd666669cb1e497ce2c2ced3842fd03c5..56d8e6e85d20e772508e1c899313680ae593ce18 100644 (file)
@@ -1103,19 +1103,6 @@ static int cfi_protect(struct flash_bank *bank, int set, int first, int last)
        }
 }
 
-/* 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)
-{
-       uint32_t i;
-       for (i = 0; i < count; i++) {
-               target_buffer_set_u32(target, dest, *src);
-               dest += 4;
-               src++;
-       }
-}
-
 static uint32_t cfi_command_val(struct flash_bank *bank, uint8_t cmd)
 {
        struct target *target = bank->target;
@@ -1264,7 +1251,8 @@ static int cfi_intel_write_block(struct flash_bank *bank, uint8_t *buffer,
                                "Increase CFI_MAX_INTEL_CODESIZE and recompile.");
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
        }
-       cfi_fix_code_endian(target, target_code, target_code_src, target_code_size / 4);
+
+       target_buffer_set_u32_array(target, target_code, target_code_size / 4, target_code_src);
 
        /* Get memory for block write handler */
        retval = target_alloc_working_area(target,
@@ -1504,7 +1492,8 @@ static int cfi_spansion_write_block_mips(struct flash_bank *bank, uint8_t *buffe
                LOG_ERROR("Out of memory");
                return ERROR_FAIL;
        }
-       cfi_fix_code_endian(target, target_code, target_code_src, target_code_size / 4);
+
+       target_buffer_set_u32_array(target, target_code, target_code_size / 4, target_code_src);
 
        /* allocate working area */
        retval = target_alloc_working_area(target, target_code_size,
@@ -1883,7 +1872,8 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
                LOG_ERROR("Out of memory");
                return ERROR_FAIL;
        }
-       cfi_fix_code_endian(target, target_code, target_code_src, target_code_size / 4);
+
+       target_buffer_set_u32_array(target, target_code, target_code_size / 4, target_code_src);
 
        /* allocate working area */
        retval = target_alloc_working_area(target, target_code_size,
@@ -2307,7 +2297,7 @@ static int cfi_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, u
        }
 
        if (count) {
-               LOG_INFO("Fixup %d unaligned read tail bytes", count);
+               LOG_INFO("Fixup %" PRIu32 " unaligned read tail bytes", count);
 
                /* read a complete word from flash */
                retval = target_read_memory(target, read_p, bank->bus_width, 1, current_word);
@@ -2506,9 +2496,9 @@ static void cfi_fixup_0002_unlock_addresses(struct flash_bank *bank, const void
 static void cfi_fixup_0002_polling_bits(struct flash_bank *bank, const void *param)
 {
        struct cfi_flash_bank *cfi_info = bank->driver_priv;
-       const int status_poll_mask = *(const int *)param;
+       const int *status_poll_mask = param;
 
-       cfi_info->status_poll_mask = status_poll_mask;
+       cfi_info->status_poll_mask = *status_poll_mask;
 }
 
 

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)