[U-Boot-Users] [PATCH] Add flash programming counter]

Stefan Roese
2008-03-06T06:20:05Z

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
=====================================================================