[U-Boot] [PATCH RFC] nand: remove spurious read cycle in OOB first page reads

Nick Thompson nick.thompson at gefanuc.com
Fri Nov 20 16:30:46 CET 2009


In the case of a nand controller that needs the OOB data before
it can read the page data, an unnecessary read sequence is sent
to the nand. This reduces read performance.

This sequence is sent by default before all page reads, but the
OOB first page read function immediately issues a new command, a
simulated READOOB command, which overrides the previous sequence.

This patch (fragment) prevents the initial read sequence from
being sent if chip->ecc.mode indicates OOB first operation.

Signed-off-by: Nick Thompson <nick.thompson at gefanuc.com>
---

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 426bb95..cf85bde 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1261,7 +1272,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
                        bufpoi = aligned ? buf : chip->buffers->databuf;

                        if (likely(sndcmd)) {
-                               chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
+                               if (chip->ecc.mode != NAND_ECC_HW_OOB_FIRST)
+                                       chip->cmdfunc(mtd, NAND_CMD_READ0,
+                                                     0x00, page);
                                sndcmd = 0;
                        }


More information about the U-Boot mailing list