public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] NAND: fixed bugs in nand_[read,write]_skip_bad()
@ 2008-11-18 17:27 Valeriy Glushkov
  2008-11-21 10:57 ` [U-Boot] [PATCH] NAND: fixed bugs in nand_[read, write]_skip_bad() Valeriy Glushkov
  2008-11-21 17:22 ` Scott Wood
  0 siblings, 2 replies; 5+ messages in thread
From: Valeriy Glushkov @ 2008-11-18 17:27 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Valeriy Glushkov <gvv@lstec.com>
---
 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

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

end of thread, other threads:[~2008-11-25 16:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-18 17:27 [U-Boot] [PATCH] NAND: fixed bugs in nand_[read,write]_skip_bad() Valeriy Glushkov
2008-11-21 10:57 ` [U-Boot] [PATCH] NAND: fixed bugs in nand_[read, write]_skip_bad() Valeriy Glushkov
2008-11-21 17:22 ` Scott Wood
2008-11-25 14:36   ` [U-Boot] [PATCH v2] " Valeriy Glushkov
2008-11-25 16:47     ` Scott Wood

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