diff options
author | Cyril Bur <cyril.bur@au1.ibm.com> | 2017-04-06 11:38:50 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-04-07 14:51:34 +1000 |
commit | 47a4831befa13e8fa4da0529a233415e5a43ac5f (patch) | |
tree | b6e2bbca196b3354c0f04ed3ec4aa2af4ef50ce3 /external | |
parent | 7bfa8e516f05bea0900d2a355ff3aff31c88df55 (diff) | |
download | talos-skiboot-47a4831befa13e8fa4da0529a233415e5a43ac5f.tar.gz talos-skiboot-47a4831befa13e8fa4da0529a233415e5a43ac5f.zip |
external/pflash: Use blocklevel_smart_erase()
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/pflash/pflash.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c index 2f9cc71d..a344987e 100644 --- a/external/pflash/pflash.c +++ b/external/pflash/pflash.c @@ -235,7 +235,6 @@ static void erase_chip(void) static void erase_range(uint32_t start, uint32_t size, bool will_program) { - uint32_t done = 0; int rc; printf("About to erase 0x%08x..0x%08x !\n", start, start + size); @@ -247,33 +246,11 @@ static void erase_range(uint32_t start, uint32_t size, bool will_program) } printf("Erasing...\n"); - progress_init(size >> 8); - while(size) { - /* If aligned to 64k and at least 64k, use 64k erase */ - if ((start & 0xffff) == 0 && size >= 0x10000) { - rc = blocklevel_erase(bl, start, 0x10000); - if (rc) { - fprintf(stderr, "Error %d erasing 0x%08x\n", - rc, start); - exit(1); - } - start += 0x10000; - size -= 0x10000; - done += 0x10000; - } else { - rc = blocklevel_erase(bl, start, 0x1000); - if (rc) { - fprintf(stderr, "Error %d erasing 0x%08x\n", - rc, start); - exit(1); - } - start += 0x1000; - size -= 0x1000; - done += 0x1000; - } - progress_tick(done >> 8); + rc = blocklevel_smart_erase(bl, start, size); + if (rc) { + fprintf(stderr, "Failed to blocklevel_smart_erase(): %d\n", rc); + return; } - progress_end(); /* If this is a flash partition, mark it empty if we aren't * going to program over it as well |