aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/lpc288x.c
diff options
context:
space:
mode:
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>2013-10-05 00:24:28 +0200
committerSpencer Oliver <spen@spen-soft.co.uk>2013-10-15 20:41:31 +0000
commit3c65677ba6f1e946a8294a2bcf89990aa8dccc59 (patch)
tree9a2c30e0f4db0832173663c68e24d1943bad2a5c /src/flash/nor/lpc288x.c
parent6ef28babe3bbf965185b78fea2aa9ecf0a563cf5 (diff)
downloadriscv-openocd-3c65677ba6f1e946a8294a2bcf89990aa8dccc59.zip
riscv-openocd-3c65677ba6f1e946a8294a2bcf89990aa8dccc59.tar.gz
riscv-openocd-3c65677ba6f1e946a8294a2bcf89990aa8dccc59.tar.bz2
lpc288x: Can now use target_write_buffer()
Use the preferred code path according to the comment. Target_write_buffer() now simply uses suitably aligned target_write_memory calls, so from this pov, they should be equivalent. Change-Id: I77f51ec3ac9faa822cf428708a1aecb67c77830c Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1687 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/flash/nor/lpc288x.c')
-rw-r--r--src/flash/nor/lpc288x.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/flash/nor/lpc288x.c b/src/flash/nor/lpc288x.c
index 5710765..b602619 100644
--- a/src/flash/nor/lpc288x.c
+++ b/src/flash/nor/lpc288x.c
@@ -350,22 +350,13 @@ static int lpc288x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offs
target_write_u32(target, F_CTRL, FC_CS | FC_SET_DATA | FC_WEN | FC_FUNC);
target_write_u32(target, F_CTRL, FC_CS | FC_WEN | FC_FUNC);
- /*would be better to use the clean target_write_buffer() interface but
- * it seems not to be a LOT slower....
- * bulk_write_memory() is no quicker :(*/
-#if 1
- if (target_write_memory(target, offset + dest_offset, 4, 128,
- page_buffer) != ERROR_OK) {
- LOG_ERROR("Write failed s %" PRIx32 " p %" PRIx32 "", sector, page);
- return ERROR_FLASH_OPERATION_FAILED;
- }
-#else
+
if (target_write_buffer(target, offset + dest_offset, FLASH_PAGE_SIZE,
page_buffer) != ERROR_OK) {
LOG_INFO("Write to flash buffer failed");
return ERROR_FLASH_OPERATION_FAILED;
}
-#endif
+
dest_offset += FLASH_PAGE_SIZE;
source_offset += count;
bytes_remaining -= count;