2
0

002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 98d33db1c87e2447b9b203399d2f995e05ecdb52 Mon Sep 17 00:00:00 2001
  2. From: Lars-Peter Clausen <lars@metafoo.de>
  3. Date: Sat, 26 Feb 2011 15:30:07 +0100
  4. Subject: [PATCH 2/7] NAND: Optimize NAND_ECC_HW_OOB_FIRST read
  5. Avoid sending unnecessary READ commands to the chip.
  6. ---
  7. drivers/mtd/nand/nand_base.c | 17 +++++++++++++----
  8. 1 file changed, 13 insertions(+), 4 deletions(-)
  9. --- a/drivers/mtd/nand/nand_base.c
  10. +++ b/drivers/mtd/nand/nand_base.c
  11. @@ -1360,9 +1360,16 @@ static int nand_read_page_hwecc_oob_firs
  12. unsigned int max_bitflips = 0;
  13. /* Read the OOB area first */
  14. - chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
  15. - chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
  16. - chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
  17. + /* Read the OOB area first */
  18. + if (mtd->writesize > 512) {
  19. + chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
  20. + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
  21. + chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1);
  22. + } else {
  23. + chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
  24. + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
  25. + chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
  26. + }
  27. for (i = 0; i < chip->ecc.total; i++)
  28. ecc_code[i] = chip->oob_poi[eccpos[i]];
  29. @@ -1575,7 +1582,9 @@ static int nand_do_read_ops(struct mtd_i
  30. __func__, buf);
  31. read_retry:
  32. - chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
  33. + if (chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) {
  34. + chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
  35. + }
  36. /*
  37. * Now read the page into the buffer. Absent an error,