mtd: nand: pass page number to ecc->write_xxx() methods
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Tue, 13 Oct 2015 09:22:18 +0000 (11:22 +0200)
committerBrian Norris <computersforpeace@gmail.com>
Tue, 13 Oct 2015 19:56:49 +0000 (12:56 -0700)
The ->read_xxx() methods are all passed the page number the NAND controller
is supposed to read, but ->write_xxx() do not have such a parameter.

This is a problem if we want to properly implement data
scrambling/randomization in order to mitigate MLC sensibility to repeated
pattern: to prevent bitflips in adjacent pages in the same block we need
to avoid repeating the same pattern at the same offset in those pages,
hence the randomizer/scrambler engine need to be passed the page value
in order to adapt its seed accordingly.

Moreover, adding the page parameter to the ->write_xxx() methods add some
consistency to the current API.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Josh Wu <josh.wu@atmel.com>
CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
CC: Maxime Ripard <maxime.ripard@free-electrons.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Huang Shijie <shijie.huang@arm.com>
CC: Stefan Agner <stefan@agner.ch>
CC: devel@driverdev.osuosl.org
CC: linux-arm-kernel@lists.infradead.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
20 files changed:
drivers/mtd/nand/atmel_nand.c
drivers/mtd/nand/bf5xx_nand.c
drivers/mtd/nand/brcmnand/brcmnand.c
drivers/mtd/nand/cafe_nand.c
drivers/mtd/nand/denali.c
drivers/mtd/nand/docg4.c
drivers/mtd/nand/fsl_elbc_nand.c
drivers/mtd/nand/fsl_ifc_nand.c
drivers/mtd/nand/gpmi-nand/gpmi-nand.c
drivers/mtd/nand/hisi504_nand.c
drivers/mtd/nand/lpc32xx_mlc.c
drivers/mtd/nand/lpc32xx_slc.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/omap2.c
drivers/mtd/nand/pxa3xx_nand.c
drivers/mtd/nand/sh_flctl.c
drivers/mtd/nand/sunxi_nand.c
drivers/mtd/nand/vf610_nfc.c
drivers/staging/mt29f_spinand/mt29f_spinand.c
include/linux/mtd/nand.h

index 89894737871329ed0cd78111b8d9aa7f81317c7a..583cdd9bb9710b0168f9b16892906e2a6535666f 100644 (file)
@@ -954,7 +954,8 @@ static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,
 }
 
 static int atmel_nand_pmecc_write_page(struct mtd_info *mtd,
-               struct nand_chip *chip, const uint8_t *buf, int oob_required)
+               struct nand_chip *chip, const uint8_t *buf, int oob_required,
+               int page)
 {
        struct atmel_nand_host *host = chip->priv;
        uint32_t *eccpos = chip->ecc.layout->eccpos;
@@ -2005,7 +2006,8 @@ static int nfc_sram_write_page(struct mtd_info *mtd, struct nand_chip *chip,
 
        if (likely(!raw))
                /* Need to write ecc into oob */
-               status = chip->ecc.write_page(mtd, chip, buf, oob_required);
+               status = chip->ecc.write_page(mtd, chip, buf, oob_required,
+                                             page);
 
        if (status < 0)
                return status;
index acec34403ad4d23e2f0e9fbd1d4da5fe6be5f6e7..61bd2160717ce425dc6b7234b3e8ea07c06f1387 100644 (file)
@@ -566,7 +566,8 @@ static int bf5xx_nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip
 }
 
 static int bf5xx_nand_write_page_raw(struct mtd_info *mtd,
-               struct nand_chip *chip, const uint8_t *buf, int oob_required)
+               struct nand_chip *chip, const uint8_t *buf, int oob_required,
+               int page)
 {
        bf5xx_nand_write_buf(mtd, buf, mtd->writesize);
        bf5xx_nand_write_buf(mtd, chip->oob_poi, mtd->oobsize);
index ea319a4058b79036b9db7357d30048b1ae06080e..7c1c306650a4c07eed6c74b12af2e8b2bc98feb7 100644 (file)
@@ -1606,7 +1606,7 @@ out:
 }
 
 static int brcmnand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
-                              const uint8_t *buf, int oob_required)
+                              const uint8_t *buf, int oob_required, int page)
 {
        struct brcmnand_host *host = chip->priv;
        void *oob = oob_required ? chip->oob_poi : NULL;
@@ -1617,7 +1617,7 @@ static int brcmnand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
 
 static int brcmnand_write_page_raw(struct mtd_info *mtd,
                                   struct nand_chip *chip, const uint8_t *buf,
-                                  int oob_required)
+                                  int oob_required, int page)
 {
        struct brcmnand_host *host = chip->priv;
        void *oob = oob_required ? chip->oob_poi : NULL;
index aa1dc559f36192a5d99d41c2e41884989e9b871c..9de78d2a2eb189bcf9fd2a630d077d0a34515016 100644 (file)
@@ -516,7 +516,8 @@ static struct nand_bbt_descr cafe_bbt_mirror_descr_512 = {
 
 static int cafe_nand_write_page_lowlevel(struct mtd_info *mtd,
                                          struct nand_chip *chip,
-                                         const uint8_t *buf, int oob_required)
+                                         const uint8_t *buf, int oob_required,
+                                         int page)
 {
        struct cafe_priv *cafe = mtd->priv;
 
index 0db16ef5604fba26e9cb44af68d19ad667ad359f..67eb2be0db87be99464c2b1db58ce2a66433fb28 100644 (file)
@@ -1114,7 +1114,7 @@ static int write_page(struct mtd_info *mtd, struct nand_chip *chip,
  * by write_page above.
  */
 static int denali_write_page(struct mtd_info *mtd, struct nand_chip *chip,
-                               const uint8_t *buf, int oob_required)
+                               const uint8_t *buf, int oob_required, int page)
 {
        /*
         * for regular page writes, we let HW handle all the ECC
@@ -1129,7 +1129,8 @@ static int denali_write_page(struct mtd_info *mtd, struct nand_chip *chip,
  * write_page() function above.
  */
 static int denali_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
-                                       const uint8_t *buf, int oob_required)
+                                const uint8_t *buf, int oob_required,
+                                int page)
 {
        /*
         * for raw page writes, we want to disable ECC and simply write
index 510c12d41761e96c75cca000a2a2c179d6ef4a62..408cf69b854b97f9a55529c4dd4cdaa05e04ac86 100644 (file)
@@ -977,13 +977,13 @@ static int write_page(struct mtd_info *mtd, struct nand_chip *nand,
 }
 
 static int docg4_write_page_raw(struct mtd_info *mtd, struct nand_chip *nand,
-                                const uint8_t *buf, int oob_required)
+                               const uint8_t *buf, int oob_required, int page)
 {
        return write_page(mtd, nand, buf, false);
 }
 
 static int docg4_write_page(struct mtd_info *mtd, struct nand_chip *nand,
-                            const uint8_t *buf, int oob_required)
+                            const uint8_t *buf, int oob_required, int page)
 {
        return write_page(mtd, nand, buf, true);
 }
@@ -1113,7 +1113,7 @@ static int docg4_block_markbad(struct mtd_info *mtd, loff_t ofs)
 
        /* write first page of block */
        write_page_prologue(mtd, g4_addr);
-       docg4_write_page(mtd, nand, buf, 1);
+       docg4_write_page(mtd, nand, buf, 1, page);
        ret = pageprog(mtd);
 
        kfree(buf);
index 43cf0f961c3ebd445dc03f5f4aa8825cffd88b45..dcb1f7f4873f39d8a38689af1467aa2b9b29c1f4 100644 (file)
@@ -715,7 +715,7 @@ static int fsl_elbc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
  * waitfunc.
  */
 static int fsl_elbc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
-                               const uint8_t *buf, int oob_required)
+                               const uint8_t *buf, int oob_required, int page)
 {
        fsl_elbc_write_buf(mtd, buf, mtd->writesize);
        fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
@@ -728,7 +728,7 @@ static int fsl_elbc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
  */
 static int fsl_elbc_write_subpage(struct mtd_info *mtd, struct nand_chip *chip,
                                uint32_t offset, uint32_t data_len,
-                               const uint8_t *buf, int oob_required)
+                               const uint8_t *buf, int oob_required, int page)
 {
        fsl_elbc_write_buf(mtd, buf, mtd->writesize);
        fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
index b9dd41cba3afc85f1daac4eb32912bd444a4f312..7f4ac8c190016df2ebd291bd296046456542b106 100644 (file)
@@ -772,7 +772,7 @@ static int fsl_ifc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
  * waitfunc.
  */
 static int fsl_ifc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
-                              const uint8_t *buf, int oob_required)
+                              const uint8_t *buf, int oob_required, int page)
 {
        fsl_ifc_write_buf(mtd, buf, mtd->writesize);
        fsl_ifc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
index 1dbcc8182f1b5689e6895dd56fcce3db13bf2622..2064adac1d1778871bb647e6678187e5a5de6da1 100644 (file)
@@ -1160,7 +1160,7 @@ static int gpmi_ecc_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
 }
 
 static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
-                               const uint8_t *buf, int oob_required)
+                               const uint8_t *buf, int oob_required, int page)
 {
        struct gpmi_nand_data *this = chip->priv;
        struct bch_geometry *nfc_geo = &this->bch_geometry;
@@ -1446,7 +1446,7 @@ static int gpmi_ecc_read_page_raw(struct mtd_info *mtd,
 static int gpmi_ecc_write_page_raw(struct mtd_info *mtd,
                                   struct nand_chip *chip,
                                   const uint8_t *buf,
-                                  int oob_required)
+                                  int oob_required, int page)
 {
        struct gpmi_nand_data *this = chip->priv;
        struct bch_geometry *nfc_geo = &this->bch_geometry;
@@ -1533,7 +1533,7 @@ static int gpmi_ecc_write_oob_raw(struct mtd_info *mtd, struct nand_chip *chip,
 {
        chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0, page);
 
-       return gpmi_ecc_write_page_raw(mtd, chip, NULL, 1);
+       return gpmi_ecc_write_page_raw(mtd, chip, NULL, 1, page);
 }
 
 static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs)
@@ -1717,7 +1717,7 @@ static int mx23_write_transcription_stamp(struct gpmi_nand_data *this)
                /* Write the first page of the current stride. */
                dev_dbg(dev, "Writing an NCB fingerprint in page 0x%x\n", page);
                chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page);
-               chip->ecc.write_page_raw(mtd, chip, buffer, 0);
+               chip->ecc.write_page_raw(mtd, chip, buffer, 0, page);
                chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
 
                /* Wait for the write to finish. */
index 6099aaa5ee409646216c6d0fd1c8cfc70c6e2897..0cb2e886937d6c1e1da9e7fe2b8919949bdcabee 100644 (file)
@@ -590,7 +590,8 @@ static int hisi_nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
 }
 
 static int hisi_nand_write_page_hwecc(struct mtd_info *mtd,
-               struct nand_chip *chip, const uint8_t *buf, int oob_required)
+               struct nand_chip *chip, const uint8_t *buf, int oob_required,
+               int page)
 {
        chip->write_buf(mtd, buf, mtd->writesize);
        if (oob_required)
index 65b7e03a0f5b72b7622276111a7dfffe62313cbe..9686d025d4c9075b9fafdd2ebc9999819c6a81ff 100644 (file)
@@ -495,7 +495,8 @@ static int lpc32xx_read_page(struct mtd_info *mtd, struct nand_chip *chip,
 
 static int lpc32xx_write_page_lowlevel(struct mtd_info *mtd,
                                       struct nand_chip *chip,
-                                      const uint8_t *buf, int oob_required)
+                                      const uint8_t *buf, int oob_required,
+                                      int page)
 {
        struct lpc32xx_nand_host *host = chip->priv;
        const uint8_t *oobbuf = chip->oob_poi;
index cbf4501090b833f3bf0827dcd249551f7d9ebf3c..40c06b2e622944dcfe4d10da4e536557a7d2b9b9 100644 (file)
@@ -663,7 +663,8 @@ static int lpc32xx_nand_read_page_raw_syndrome(struct mtd_info *mtd,
  */
 static int lpc32xx_nand_write_page_syndrome(struct mtd_info *mtd,
                                            struct nand_chip *chip,
-                                           const uint8_t *buf, int oob_required)
+                                           const uint8_t *buf,
+                                           int oob_required, int page)
 {
        struct lpc32xx_nand_host *host = chip->priv;
        uint8_t *pb = chip->oob_poi + chip->ecc.layout->eccpos[0];
@@ -692,7 +693,7 @@ static int lpc32xx_nand_write_page_syndrome(struct mtd_info *mtd,
 static int lpc32xx_nand_write_page_raw_syndrome(struct mtd_info *mtd,
                                                struct nand_chip *chip,
                                                const uint8_t *buf,
-                                               int oob_required)
+                                               int oob_required, int page)
 {
        /* Raw writes can just use the FIFO interface */
        chip->write_buf(mtd, buf, chip->ecc.size * chip->ecc.steps);
index a8230b164f49e40b58aa7dcf243b16f146c09b02..d87c7d0b46752ebba6ae7ba2ed3eff15ea647a14 100644 (file)
@@ -2155,11 +2155,12 @@ out:
  * @chip: nand chip info structure
  * @buf: data buffer
  * @oob_required: must write chip->oob_poi to OOB
+ * @page: page number to write
  *
  * Not for syndrome calculating ECC controllers, which use a special oob layout.
  */
 static int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
-                               const uint8_t *buf, int oob_required)
+                              const uint8_t *buf, int oob_required, int page)
 {
        chip->write_buf(mtd, buf, mtd->writesize);
        if (oob_required)
@@ -2174,12 +2175,14 @@ static int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
  * @chip: nand chip info structure
  * @buf: data buffer
  * @oob_required: must write chip->oob_poi to OOB
+ * @page: page number to write
  *
  * We need a special oob layout and handling even when ECC isn't checked.
  */
 static int nand_write_page_raw_syndrome(struct mtd_info *mtd,
                                        struct nand_chip *chip,
-                                       const uint8_t *buf, int oob_required)
+                                       const uint8_t *buf, int oob_required,
+                                       int page)
 {
        int eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
@@ -2216,9 +2219,11 @@ static int nand_write_page_raw_syndrome(struct mtd_info *mtd,
  * @chip: nand chip info structure
  * @buf: data buffer
  * @oob_required: must write chip->oob_poi to OOB
+ * @page: page number to write
  */
 static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
-                                 const uint8_t *buf, int oob_required)
+                                const uint8_t *buf, int oob_required,
+                                int page)
 {
        int i, eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
@@ -2234,7 +2239,7 @@ static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
        for (i = 0; i < chip->ecc.total; i++)
                chip->oob_poi[eccpos[i]] = ecc_calc[i];
 
-       return chip->ecc.write_page_raw(mtd, chip, buf, 1);
+       return chip->ecc.write_page_raw(mtd, chip, buf, 1, page);
 }
 
 /**
@@ -2243,9 +2248,11 @@ static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
  * @chip: nand chip info structure
  * @buf: data buffer
  * @oob_required: must write chip->oob_poi to OOB
+ * @page: page number to write
  */
 static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
-                                 const uint8_t *buf, int oob_required)
+                                 const uint8_t *buf, int oob_required,
+                                 int page)
 {
        int i, eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
@@ -2277,11 +2284,12 @@ static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
  * @data_len:  data length
  * @buf:       data buffer
  * @oob_required: must write chip->oob_poi to OOB
+ * @page: page number to write
  */
 static int nand_write_subpage_hwecc(struct mtd_info *mtd,
                                struct nand_chip *chip, uint32_t offset,
                                uint32_t data_len, const uint8_t *buf,
-                               int oob_required)
+                               int oob_required, int page)
 {
        uint8_t *oob_buf  = chip->oob_poi;
        uint8_t *ecc_calc = chip->buffers->ecccalc;
@@ -2336,13 +2344,15 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
  * @chip: nand chip info structure
  * @buf: data buffer
  * @oob_required: must write chip->oob_poi to OOB
+ * @page: page number to write
  *
  * The hw generator calculates the error syndrome automatically. Therefore we
  * need a special oob layout and handling.
  */
 static int nand_write_page_syndrome(struct mtd_info *mtd,
                                    struct nand_chip *chip,
-                                   const uint8_t *buf, int oob_required)
+                                   const uint8_t *buf, int oob_required,
+                                   int page)
 {
        int i, eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
@@ -2406,12 +2416,13 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
 
        if (unlikely(raw))
                status = chip->ecc.write_page_raw(mtd, chip, buf,
-                                                       oob_required);
+                                                 oob_required, page);
        else if (subpage)
                status = chip->ecc.write_subpage(mtd, chip, offset, data_len,
-                                                        buf, oob_required);
+                                                buf, oob_required, page);
        else
-               status = chip->ecc.write_page(mtd, chip, buf, oob_required);
+               status = chip->ecc.write_page(mtd, chip, buf, oob_required,
+                                             page);
 
        if (status < 0)
                return status;
index 7fbf00962709386848d92112bf8290c8212af665..93f664cd1c906ade2deb3d16cb79ceae3e36024e 100644 (file)
@@ -1500,11 +1500,12 @@ static int omap_elm_correct_data(struct mtd_info *mtd, u_char *data,
  * @chip:              nand chip info structure
  * @buf:               data buffer
  * @oob_required:      must write chip->oob_poi to OOB
+ * @page:              page
  *
  * Custom write page method evolved to support multi sector writing in one shot
  */
 static int omap_write_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
-                                 const uint8_t *buf, int oob_required)
+                              const uint8_t *buf, int oob_required, int page)
 {
        int i;
        uint8_t *ecc_calc = chip->buffers->ecccalc;
index 0024a9c3563158774f3600e410d91107958c5043..17d7a23f72b27a609ef6b1d79ca0ab1b6880d012 100644 (file)
@@ -1160,7 +1160,8 @@ static void nand_cmdfunc_extended(struct mtd_info *mtd,
 }
 
 static int pxa3xx_nand_write_page_hwecc(struct mtd_info *mtd,
-               struct nand_chip *chip, const uint8_t *buf, int oob_required)
+               struct nand_chip *chip, const uint8_t *buf, int oob_required,
+               int page)
 {
        chip->write_buf(mtd, buf, mtd->writesize);
        chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
index 2e4f762775d544345608586ed84501cfd85608a9..bcba1a924c75f25e0d8ef4ac20f841e6d4a1ae33 100644 (file)
@@ -569,7 +569,8 @@ static int flctl_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
 }
 
 static int flctl_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
-                                  const uint8_t *buf, int oob_required)
+                                 const uint8_t *buf, int oob_required,
+                                 int page)
 {
        chip->write_buf(mtd, buf, mtd->writesize);
        chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
index d8b809b13c0ee1d439a319416c1a1a9dd69e6e9e..ef46ac66248bb49112fcd0ed2ab5b8f3c7f6735f 100644 (file)
@@ -752,7 +752,8 @@ static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,
 
 static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
                                       struct nand_chip *chip,
-                                      const uint8_t *buf, int oob_required)
+                                      const uint8_t *buf, int oob_required,
+                                      int page)
 {
        struct nand_ecc_ctrl *ecc = &chip->ecc;
        int ret, i, cur_off = 0;
@@ -815,7 +816,7 @@ static int sunxi_nfc_hw_syndrome_ecc_read_page(struct mtd_info *mtd,
 static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
                                                struct nand_chip *chip,
                                                const uint8_t *buf,
-                                               int oob_required)
+                                               int oob_required, int page)
 {
        struct nand_ecc_ctrl *ecc = &chip->ecc;
        int ret, i, cur_off = 0;
index ae1f84e3d635ce66bb870a30ca76b888036b6693..d275691dbb7c02a2e1f84c4b4b17395b658c4934 100644 (file)
@@ -612,7 +612,7 @@ static int vf610_nfc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
 }
 
 static int vf610_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
-                              const uint8_t *buf, int oob_required)
+                               const uint8_t *buf, int oob_required, int page)
 {
        struct vf610_nfc *nfc = mtd_to_nfc(mtd);
 
index 9a8ddbb0191fb8939602d8ed3a879ca685edabed..405b643189fd5cac9148e45e5f9d1c0d4bd94b90 100644 (file)
@@ -612,7 +612,8 @@ static int spinand_erase_block(struct spi_device *spi_nand, u16 block_id)
 
 #ifdef CONFIG_MTD_SPINAND_ONDIEECC
 static int spinand_write_page_hwecc(struct mtd_info *mtd,
-               struct nand_chip *chip, const uint8_t *buf, int oob_required)
+               struct nand_chip *chip, const uint8_t *buf, int oob_required,
+               int page)
 {
        const uint8_t *p = buf;
        int eccsize = chip->ecc.size;
index 50e1f94fa3776df9c3d6c3acc9f2f4c51037e434..5a9d1d4c2487fc2cf8f08489f317bf60df93b06f 100644 (file)
@@ -504,16 +504,16 @@ struct nand_ecc_ctrl {
        int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
                        uint8_t *buf, int oob_required, int page);
        int (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
-                       const uint8_t *buf, int oob_required);
+                       const uint8_t *buf, int oob_required, int page);
        int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
                        uint8_t *buf, int oob_required, int page);
        int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
                        uint32_t offs, uint32_t len, uint8_t *buf, int page);
        int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
                        uint32_t offset, uint32_t data_len,
-                       const uint8_t *data_buf, int oob_required);
+                       const uint8_t *data_buf, int oob_required, int page);
        int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
-                       const uint8_t *buf, int oob_required);
+                       const uint8_t *buf, int oob_required, int page);
        int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip,
                        int page);
        int (*read_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip,