- fixed bugs in nand_[read,write]_skip_bad() to double speed
- added printing of dots to show progress

Signed-off-by: Valeriy Glushkov <[EMAIL PROTECTED]>
---
 drivers/mtd/nand/nand_base.c |   16 ++++++++++++++--
 drivers/mtd/nand/nand_util.c |    6 ++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 00c9d4a..e4da6b1 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1136,8 +1136,11 @@ static int nand_do_read_ops(struct mtd_info *mtd, 
loff_t from,
     ret = chip->ecc.read_page_raw(mtd, chip, bufpoi);
    else
     ret = chip->ecc.read_page(mtd, chip, bufpoi);
-   if (ret < 0)
+   if (ret < 0) {
+    printf("nand_read_opts: page 0x%x error %d\n",
+     realpage, ret);
     break;
+   }

    /* Transfer not aligned data */
    if (!aligned) {
@@ -1190,6 +1193,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, 
loff_t from,
   /* Increment page address */
   realpage++;

+  if( !((realpage << chip->page_shift) & 0xfffff) )
+   debug(".");
+
   page = realpage & chip->pagemask;
   /* Check, if we cross a chip boundary */
   if (!page) {
@@ -1828,8 +1834,11 @@ static int nand_do_write_ops(struct mtd_info *mtd, 
loff_t to,

   ret = chip->write_page(mtd, chip, wbuf, page, cached,
            (ops->mode == MTD_OOB_RAW));
-  if (ret)
+  if (ret) {
+   printf("nand_write_opts: page 0x%x error %d\n",
+    realpage, ret);
    break;
+  }

   writelen -= bytes;
   if (!writelen)
@@ -1839,6 +1848,9 @@ static int nand_do_write_ops(struct mtd_info *mtd, 
loff_t to,
   buf += bytes;
   realpage++;

+  if( !((realpage << chip->page_shift) & 0xfffff) )
+   debug(".");
+
   page = realpage & chip->pagemask;
   /* Check, if we cross a chip boundary */
   if (!page) {
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 52b3d21..818a876 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -498,8 +498,8 @@ int nand_write_skip_bad(nand_info_t *nand, size_t 
offset, size_t *length,
   if (rval != 0) {
    printf ("NAND write to offset %x failed %d\n",
     offset, rval);
-   return rval;
   }
+  return rval;
  }

  while (left_to_write > 0) {
@@ -513,6 +513,7 @@ int nand_write_skip_bad(nand_info_t *nand, size_t 
offset, size_t *length,
    continue;
   }

+  debug(",");
   if (left_to_write < (nand->erasesize - block_offset))
    write_size = left_to_write;
   else
@@ -568,8 +569,8 @@ int nand_read_skip_bad(nand_info_t *nand, size_t offset, 
size_t *length,
   if (rval != 0) {
    printf ("NAND read from offset %x failed %d\n",
     offset, rval);
-   return rval;
   }
+  return rval;
  }

  while (left_to_read > 0) {
@@ -583,6 +584,7 @@ int nand_read_skip_bad(nand_info_t *nand, size_t offset, 
size_t *length,
    continue;
   }

+  debug(",");
   if (left_to_read < (nand->erasesize - block_offset))
    read_length = left_to_read;
   else
-- 
1.5.2.5


_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to