mtd: nand: add "page" parameter to all read_page/read_page_raw APIs
authorSneha Narnakaje <nsnehaprabha@ti.com>
Fri, 18 Sep 2009 19:51:46 +0000 (12:51 -0700)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 19 Sep 2009 18:13:47 +0000 (11:13 -0700)
This patch adds a new "page" parameter to all NAND read_page/read_page_raw
APIs.  The read_page API for the new mode ECC_HW_OOB_FIRST requires the
page information to send the READOOB command and read the OOB area before
the data area.

Reviewed-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Sneha Narnakaje <nsnehaprabha@ti.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/nand/atmel_nand.c
drivers/mtd/nand/cafe_nand.c
drivers/mtd/nand/fsl_elbc_nand.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/sh_flctl.c
include/linux/mtd/nand.h

index 20c828ba94052daae1e7a79ac4b4edb8f6e51104..f8e9975c86e562ca471601ca5f129ee9f402e7cc 100644 (file)
@@ -218,7 +218,7 @@ static int atmel_nand_calculate(struct mtd_info *mtd,
  * buf:        buffer to store read data
  */
 static int atmel_nand_read_page(struct mtd_info *mtd,
-               struct nand_chip *chip, uint8_t *buf)
+               struct nand_chip *chip, uint8_t *buf, int page)
 {
        int eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
index 29acd06b1c39709000b65973d29a75f41dfd347d..a70f40e161d760e8c8e171e94b2f6e6a974947ce 100644 (file)
@@ -381,7 +381,7 @@ static int cafe_nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
  * we need a special oob layout and handling.
  */
 static int cafe_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip,
-                              uint8_t *buf)
+                              uint8_t *buf, int page)
 {
        struct cafe_priv *cafe = mtd->priv;
 
index 1f6eb2578717e479904efad7387164e18d702547..ddd37d2554ede02c08044642d4f30c2d3307ee57 100644 (file)
@@ -739,7 +739,8 @@ static int fsl_elbc_chip_init_tail(struct mtd_info *mtd)
 
 static int fsl_elbc_read_page(struct mtd_info *mtd,
                               struct nand_chip *chip,
-                              uint8_t *buf)
+                             uint8_t *buf,
+                             int page)
 {
        fsl_elbc_read_buf(mtd, buf, mtd->writesize);
        fsl_elbc_read_buf(mtd, chip->oob_poi, mtd->oobsize);
index 4c5e8a74e1b2bf867a995eee53ed30a3951d4dc4..17bbd506202741345ae44f51741805c95073d172 100644 (file)
@@ -765,7 +765,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
  * Not for syndrome calculating ecc controllers, which use a special oob layout
  */
 static int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
-                             uint8_t *buf)
+                             uint8_t *buf, int page)
 {
        chip->read_buf(mtd, buf, mtd->writesize);
        chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
@@ -781,7 +781,7 @@ static int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
  * We need a special oob layout and handling even when OOB isn't used.
  */
 static int nand_read_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
-                             uint8_t *buf)
+                             uint8_t *buf, int page)
 {
        int eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
@@ -820,7 +820,7 @@ static int nand_read_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *c
  * @buf:       buffer to store read data
  */
 static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
-                               uint8_t *buf)
+                               uint8_t *buf, int page)
 {
        int i, eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
@@ -830,7 +830,7 @@ static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
        uint8_t *ecc_code = chip->buffers->ecccode;
        uint32_t *eccpos = chip->ecc.layout->eccpos;
 
-       chip->ecc.read_page_raw(mtd, chip, buf);
+       chip->ecc.read_page_raw(mtd, chip, buf, page);
 
        for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize)
                chip->ecc.calculate(mtd, p, &ecc_calc[i]);
@@ -943,7 +943,7 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, uint3
  * Not for syndrome calculating ecc controllers which need a special oob layout
  */
 static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
-                               uint8_t *buf)
+                               uint8_t *buf, int page)
 {
        int i, eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
@@ -988,7 +988,7 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
  * we need a special oob layout and handling.
  */
 static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
-                                  uint8_t *buf)
+                                  uint8_t *buf, int page)
 {
        int i, eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
@@ -1130,11 +1130,13 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
 
                        /* Now read the page into the buffer */
                        if (unlikely(ops->mode == MTD_OOB_RAW))
-                               ret = chip->ecc.read_page_raw(mtd, chip, bufpoi);
+                               ret = chip->ecc.read_page_raw(mtd, chip,
+                                                             bufpoi, page);
                        else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob)
                                ret = chip->ecc.read_subpage(mtd, chip, col, bytes, bufpoi);
                        else
-                               ret = chip->ecc.read_page(mtd, chip, bufpoi);
+                               ret = chip->ecc.read_page(mtd, chip, bufpoi,
+                                                         page);
                        if (ret < 0)
                                break;
 
index 2bc896623e2d7e21ea5d76977ce3417958293c6f..c5df28596a4aa6c2b3c567e0d5649be87520ea59 100644 (file)
@@ -329,7 +329,7 @@ static void set_cmd_regs(struct mtd_info *mtd, uint32_t cmd, uint32_t flcmcdr_va
 }
 
 static int flctl_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
-                               uint8_t *buf)
+                               uint8_t *buf, int page)
 {
        int i, eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
index 4030ebada49e922cbdc8fb8e486a7a2b149d177d..686f3701f2f403545a0d1d2abd302ef9182aa62e 100644 (file)
@@ -271,13 +271,13 @@ struct nand_ecc_ctrl {
                                           uint8_t *calc_ecc);
        int                     (*read_page_raw)(struct mtd_info *mtd,
                                                 struct nand_chip *chip,
-                                                uint8_t *buf);
+                                                uint8_t *buf, int page);
        void                    (*write_page_raw)(struct mtd_info *mtd,
                                                  struct nand_chip *chip,
                                                  const uint8_t *buf);
        int                     (*read_page)(struct mtd_info *mtd,
                                             struct nand_chip *chip,
-                                            uint8_t *buf);
+                                            uint8_t *buf, int page);
        int                     (*read_subpage)(struct mtd_info *mtd,
                                             struct nand_chip *chip,
                                             uint32_t offs, uint32_t len,