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