}
static int cfi_target_write_memory(struct flash_bank *bank, target_addr_t addr,
- uint32_t size, uint32_t count,
- const uint8_t *buffer)
+ uint32_t count, const uint8_t *buffer)
{
- return target_write_memory(bank->target, addr, size, count, buffer);
+ return target_write_memory(bank->target, addr, bank->bus_width,
+ count, buffer);
}
static int cfi_target_read_memory(struct flash_bank *bank, target_addr_t addr,
- uint32_t size, uint32_t count,
- uint8_t *buffer)
+ uint32_t count, uint8_t *buffer)
{
- return target_read_memory(bank->target, addr, size, count, buffer);
+ return target_read_memory(bank->target, addr, bank->bus_width,
+ count, buffer);
}
static void cfi_command(struct flash_bank *bank, uint8_t cmd, uint8_t *cmd_buf)
uint8_t command[CFI_MAX_BUS_WIDTH];
cfi_command(bank, cmd, command);
- return cfi_target_write_memory(bank, address, bank->bus_width, 1, command);
+ return cfi_target_write_memory(bank, address, 1, command);
}
/* read unsigned 8-bit value from the bank
int retval;
retval = cfi_target_read_memory(bank, flash_address(bank, sector, offset),
- bank->bus_width, 1, data);
+ 1, data);
if (retval != ERROR_OK)
return retval;
int retval;
retval = cfi_target_read_memory(bank, flash_address(bank, sector, offset),
- bank->bus_width, 1, data);
+ 1, data);
if (retval != ERROR_OK)
return retval;
uint8_t i;
for (i = 0; i < 2; i++) {
retval = cfi_target_read_memory(bank, flash_address(bank, sector, offset + i),
- bank->bus_width, 1, &data[i * bank->bus_width]);
+ 1, &data[i * bank->bus_width]);
if (retval != ERROR_OK)
return retval;
}
} else {
retval = cfi_target_read_memory(bank, flash_address(bank, sector, offset),
- bank->bus_width, 2, data);
+ 2, data);
if (retval != ERROR_OK)
return retval;
}
uint8_t i;
for (i = 0; i < 4; i++) {
retval = cfi_target_read_memory(bank, flash_address(bank, sector, offset + i),
- bank->bus_width, 1, &data[i * bank->bus_width]);
+ 1, &data[i * bank->bus_width]);
if (retval != ERROR_OK)
return retval;
}
} else {
retval = cfi_target_read_memory(bank, flash_address(bank, sector, offset),
- bank->bus_width, 4, data);
+ 4, data);
if (retval != ERROR_OK)
return retval;
}
if (retval != ERROR_OK)
return retval;
- retval = cfi_target_write_memory(bank, address, bank->bus_width, 1, word);
+ retval = cfi_target_write_memory(bank, address, 1, word);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
- retval = cfi_target_write_memory(bank, address, bank->bus_width, bufferwsize, word);
+ retval = cfi_target_write_memory(bank, address, bufferwsize, word);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
- retval = cfi_target_write_memory(bank, address, bank->bus_width, 1, word);
+ retval = cfi_target_write_memory(bank, address, 1, word);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
- retval = cfi_target_write_memory(bank, address, bank->bus_width, bufferwsize, word);
+ retval = cfi_target_write_memory(bank, address, bufferwsize, word);
if (retval != ERROR_OK)
return retval;
LOG_INFO("Fixup %d unaligned read head bytes", align);
/* read a complete word from flash */
- retval = cfi_target_read_memory(bank, read_p, bank->bus_width, 1, current_word);
+ retval = cfi_target_read_memory(bank, read_p, 1, current_word);
if (retval != ERROR_OK)
return retval;
align = count / bank->bus_width;
if (align) {
- retval = cfi_target_read_memory(bank, read_p, bank->bus_width, align, buffer);
+ retval = cfi_target_read_memory(bank, read_p, align, buffer);
if (retval != ERROR_OK)
return retval;
LOG_INFO("Fixup %" PRIu32 " unaligned read tail bytes", count);
/* read a complete word from flash */
- retval = cfi_target_read_memory(bank, read_p, bank->bus_width, 1, current_word);
+ retval = cfi_target_read_memory(bank, read_p, 1, current_word);
if (retval != ERROR_OK)
return retval;
LOG_INFO("Fixup %d unaligned head bytes", align);
/* read a complete word from flash */
- retval = cfi_target_read_memory(bank, write_p, bank->bus_width, 1, current_word);
+ retval = cfi_target_read_memory(bank, write_p, 1, current_word);
if (retval != ERROR_OK)
return retval;
LOG_INFO("Fixup %" PRId32 " unaligned tail bytes", count);
/* read a complete word from flash */
- retval = cfi_target_read_memory(bank, write_p, bank->bus_width, 1, current_word);
+ retval = cfi_target_read_memory(bank, write_p, 1, current_word);
if (retval != ERROR_OK)
return retval;
return retval;
retval = cfi_target_read_memory(bank, flash_address(bank, 0, 0x00),
- bank->bus_width, 1, value_buf0);
+ 1, value_buf0);
if (retval != ERROR_OK)
return retval;
retval = cfi_target_read_memory(bank, flash_address(bank, 0, 0x01),
- bank->bus_width, 1, value_buf1);
+ 1, value_buf1);
if (retval != ERROR_OK)
return retval;
switch (bank->chip_width) {