mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] cfi_flash: show progress while during erase
@ 2014-05-26 18:12 Franck Jullien
  2014-05-26 18:20 ` Franck Jullien
  2014-05-26 19:04 ` Holger Schurig
  0 siblings, 2 replies; 7+ messages in thread
From: Franck Jullien @ 2014-05-26 18:12 UTC (permalink / raw)
  To: barebox

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 drivers/mtd/nor/cfi_flash.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
index 3d3d231..f2f52e1 100644
--- a/drivers/mtd/nor/cfi_flash.c
+++ b/drivers/mtd/nor/cfi_flash.c
@@ -470,7 +470,7 @@ flash_sect_t find_sector (struct flash_info *info, ulong addr)
 	return sector;
 }
 
-static int cfi_erase(struct flash_info *finfo, size_t count, loff_t offset)
+static int cfi_erase(struct flash_info *finfo, size_t count, loff_t offset, int verbose)
 {
         unsigned long start, end;
         int i, ret = 0;
@@ -481,17 +481,25 @@ static int cfi_erase(struct flash_info *finfo, size_t count, loff_t offset)
         end   = find_sector(finfo, (unsigned long)finfo->base + offset +
 			count - 1);
 
+	if (verbose)
+		init_progression_bar(end - start);
+
         for (i = start; i <= end; i++) {
                 ret = finfo->cfi_cmd_set->flash_erase_one(finfo, i);
                 if (ret)
                         goto out;
 
+		if (verbose)
+			show_progress(i - start);
+
 		if (ctrlc()) {
 			ret = -EINTR;
 			goto out;
 		}
         }
 out:
+	if (verbose)
+		putchar('\n');
         return ret;
 }
 
@@ -933,7 +941,7 @@ static int cfi_mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
 	struct flash_info *info = container_of(mtd, struct flash_info, mtd);
 	int ret;
 
-	ret = cfi_erase(info, instr->len, instr->addr);
+	ret = cfi_erase(info, instr->len, instr->addr, 1);
 
 	if (ret) {
 		instr->state = MTD_ERASE_FAILED;
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-05-27 18:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-26 18:12 [PATCH] cfi_flash: show progress while during erase Franck Jullien
2014-05-26 18:20 ` Franck Jullien
2014-05-27  5:42   ` Sascha Hauer
2014-05-27  6:50     ` Franck Jullien
2014-05-27 18:24       ` Sascha Hauer
2014-05-26 19:04 ` Holger Schurig
2014-05-26 19:12   ` Franck Jullien

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox