aboutsummaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-06-16 18:44:20 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-06-16 18:44:20 +0000
commit996acf082c07c654c850317ca35b88c8c86f6935 (patch)
tree6d23fbf8c639c15e99206d2120d7253c7b2b751b /src/flash
parentd52d7f69beb2b313d92c79e45b5d71a1729e43a4 (diff)
fallback for no implementation of multi word CFI write. Successful codepath not affected.
git-svn-id: svn://svn.berlios.de/openocd/trunk@711 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/cfi.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/flash/cfi.c b/src/flash/cfi.c
index a4b95f08..fea75a74 100644
--- a/src/flash/cfi.c
+++ b/src/flash/cfi.c
@@ -1738,21 +1738,25 @@ int cfi_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
/* fall back to memory writes */
while (count >= bank->bus_width)
{
+ int fallback;
if ((write_p & 0xff) == 0)
{
LOG_INFO("Programming at %08x, count %08x bytes remaining", write_p, count);
}
+ fallback = 1;
if ((bufferwsize > 0) && (count >= buffersize) && !(write_p & buffermask))
{
retval = cfi_write_words(bank, buffer, bufferwsize, write_p);
- if (retval != ERROR_OK)
- return retval;
-
- buffer += buffersize;
- write_p += buffersize;
- count -= buffersize;
+ if (retval == ERROR_OK)
+ {
+ buffer += buffersize;
+ write_p += buffersize;
+ count -= buffersize;
+ fallback=0;
+ }
}
- else
+ /* try the slow way? */
+ if (fallback)
{
for (i = 0; i < bank->bus_width; i++)
current_word[i] = 0;