public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] Add flash programming counter]
@ 2008-03-05 19:43 York Sun
  2008-03-06  6:20 ` Stefan Roese
  0 siblings, 1 reply; 34+ messages in thread
From: York Sun @ 2008-03-05 19:43 UTC (permalink / raw)
  To: u-boot

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);
 	}

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

end of thread, other threads:[~2008-03-07 20:52 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-05 19:43 [U-Boot-Users] [PATCH] Add flash programming counter] York Sun
2008-03-06  6:20 ` 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

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