public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: York Sun <yorksun@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Add flash programming counter]
Date: Wed, 05 Mar 2008 13:43:09 -0600	[thread overview]
Message-ID: <1204746189.31869.49.camel@laptop> (raw)

Add flash programming counter. It prints how many KB has been programmed
in case you suspect it hangs when programming large files.

Signed-off-by: York Sun <yorksun@freescale.com>
---
 drivers/mtd/cfi_flash.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 439c950..c55cf1d 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, temp;
 	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));
 
@@ -1222,6 +1224,7 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 	}
 
 	/* handle the aligned part */
+	temp = 0;
 #ifdef CFG_FLASH_USE_BUFFER_WRITE
 	buffered_size = (info->portwidth / info->chipwidth);
 	buffered_size *= info->buffer_size;
@@ -1248,6 +1251,10 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 		wp += i;
 		src += i;
 		cnt -= i;
+		if (((count-cnt)>>10) > temp) {
+			temp = (count-cnt)>>10;
+			printf("\r\t\t%d KB",temp);
+		}
 	}
 #else
 	while (cnt >= info->portwidth) {
@@ -1259,8 +1266,13 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 			return rc;
 		wp += info->portwidth;
 		cnt -= info->portwidth;
+		if (((count-cnt)>>10) > temp) {
+			temp = (count-cnt)>>10;
+			printf("\r\t\t%d KB",temp);
+		}
 	}
 #endif /* CFG_FLASH_USE_BUFFER_WRITE */
+	printf("\n");
 	if (cnt == 0) {
 		return (0);
 	}

             reply	other threads:[~2008-03-05 19:43 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05 19:43 York Sun [this message]
2008-03-06  6:20 ` [U-Boot-Users] [PATCH] Add flash programming counter] Stefan Roese
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=1204746189.31869.49.camel@laptop \
    --to=yorksun@freescale.com \
    --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