public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Add flash programming counter]
Date: Thu, 6 Mar 2008 07:20:05 +0100	[thread overview]
Message-ID: <200803060720.06034.sr@denx.de> (raw)
In-Reply-To: <1204746189.31869.49.camel@laptop>

On Wednesday 05 March 2008, York Sun wrote:
> Add flash programming counter. It prints how many KB has been programmed
> in case you suspect it hangs when programming large files.

I do like such a progress output. But printing each KB seems a little
too much from my point of view. Could even slow down the programming
because of the slow serial output on some systems.

How about this version:

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 439c950..5721c6b 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1188,6 +1188,7 @@ void flash_print_info (flash_info_t * info)
 int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 {
 	ulong wp;
+	ulong count;
 	uchar *p;
 	int aln;
 	cfiword_t cword;
@@ -1196,6 +1197,7 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 #ifdef CFG_FLASH_USE_BUFFER_WRITE
 	int buffered_size;
 #endif
+	count = cnt;
 	/* get lower aligned address */
 	wp = (addr & ~(info->portwidth - 1));
 
@@ -1248,6 +1250,8 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 		wp += i;
 		src += i;
 		cnt -= i;
+		if (!((count - cnt) % (1 << 14)))
+			printf("\r\t\t %d KB ", (count - cnt) >> 10);
 	}
 #else
 	while (cnt >= info->portwidth) {
@@ -1259,6 +1263,8 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 			return rc;
 		wp += info->portwidth;
 		cnt -= info->portwidth;
+		if (!((count - cnt) % (1 << 14)))
+			printf("\r\t\t %d KB ", (count - cnt) >> 10);
 	}
 #endif /* CFG_FLASH_USE_BUFFER_WRITE */
 	if (cnt == 0) {


What's do other think? Should we add such an "enhancement" to the
common CFI driver?

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

  reply	other threads:[~2008-03-06  6:20 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05 19:43 [U-Boot-Users] [PATCH] Add flash programming counter] York Sun
2008-03-06  6:20 ` Stefan Roese [this message]
2008-03-06  8:19   ` Martin Krause
2008-03-06 12:48   ` Wolfgang Denk
2008-03-06 13:33     ` Stefan Roese
2008-03-06 16:32       ` Wolfgang Denk
2008-03-06 17:17         ` Michael Schwingen
2008-03-06 19:35           ` Jerry Van Baren
2008-03-07 13:02             ` Clemens Koller
2008-03-07 13:11               ` Stefan Roese
2008-03-07 13:26                 ` Jerry Van Baren
2008-03-07 13:35                   ` Stefan Roese
2008-03-07 13:57                     ` Jerry Van Baren
2008-03-07 14:04                       ` Stefan Roese
2008-03-07 14:15                         ` Wolfgang Denk
2008-03-07 14:18                           ` Kumar Gala
2008-03-07 14:22                           ` Stefan Roese
2008-03-07 14:13                       ` Wolfgang Denk
2008-03-07 14:36                         ` Jerry Van Baren
2008-03-07 14:59                           ` Wolfgang Denk
2008-03-07 16:09                             ` Jerry Van Baren
2008-03-07 16:33                               ` Wolfgang Denk
2008-03-07 17:12                                 ` Jerry Van Baren
2008-03-07 19:36                                   ` Wolfgang Denk
2008-03-07 20:52                                     ` Jerry Van Baren
2008-03-07 17:46                                 ` Kim Phillips
2008-03-07 19:39                                   ` Wolfgang Denk
2008-03-07 14:10                 ` Wolfgang Denk
2008-03-07 13:24               ` Jerry Van Baren
2008-03-07 13:33                 ` Jerry Van Baren
2008-03-06 19:41           ` Stefan Roese
2008-03-06 22:58             ` Wolfgang Denk
2008-03-07  6:38               ` Stefan Roese
2008-03-07 16:34                 ` Jon Loeliger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803060720.06034.sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox