summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-08-17 15:36:41 -0500
committerStefan Roese <sr@denx.de>2012-09-03 11:24:27 +0200
commitde15a06aad1f221255366ac07238c80fed146da1 (patch)
tree73921dc7c0bfabbad9696bc1e97181367c0029d6 /common
parent6822a647b94cb05869231251e5a29f9742bb3ce2 (diff)
downloadu-boot-imx-de15a06aad1f221255366ac07238c80fed146da1.zip
u-boot-imx-de15a06aad1f221255366ac07238c80fed146da1.tar.gz
u-boot-imx-de15a06aad1f221255366ac07238c80fed146da1.tar.bz2
cfi: Make the flash erase and write operations abortable
Check for ctrlc() in operations that take time and loop over the flash addresses. In netconsole, tstc() is expensive. Only check once in a while to not slow down the operation significantly. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_flash.c3
-rw-r--r--common/flash.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/common/cmd_flash.c b/common/cmd_flash.c
index 0e9b2e3..e55d366 100644
--- a/common/cmd_flash.c
+++ b/common/cmd_flash.c
@@ -443,7 +443,8 @@ int flash_sect_erase (ulong addr_first, ulong addr_last)
rcode = flash_erase (info, s_first[bank], s_last[bank]);
}
}
- printf ("Erased %d sectors\n", erased);
+ if (rcode == 0)
+ printf("Erased %d sectors\n", erased);
} else if (rcode == 0) {
puts ("Error: start and/or end address"
" not on sector boundary\n");
diff --git a/common/flash.c b/common/flash.c
index 781cb9c..8244ba2 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -221,6 +221,9 @@ void flash_perror (int err)
case ERR_PROG_ERROR:
puts ("General Flash Programming Error\n");
break;
+ case ERR_ABORTED:
+ puts("Flash Programming Aborted\n");
+ break;
default:
printf ("%s[%d] FIXME: rc=%d\n", __FILE__, __LINE__, err);
break;