Commit 767eb6fb authored by Boris Brezillon's avatar Boris Brezillon Committed by Miquel Raynal

mtd: rawnand: Pass a nand_chip object to ecc->write_xxx() hooks

Let's make the raw NAND API consistent by patching all helpers and
hooks to take a nand_chip object instead of an mtd_info one or
remove the mtd_info object when both are passed.

Let's tackle all ecc->write_xxx() hooks at once.
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent b9761687
...@@ -858,15 +858,13 @@ static int atmel_nand_pmecc_write_pg(struct nand_chip *chip, const u8 *buf, ...@@ -858,15 +858,13 @@ static int atmel_nand_pmecc_write_pg(struct nand_chip *chip, const u8 *buf,
return nand_prog_page_end_op(chip); return nand_prog_page_end_op(chip);
} }
static int atmel_nand_pmecc_write_page(struct mtd_info *mtd, static int atmel_nand_pmecc_write_page(struct nand_chip *chip, const u8 *buf,
struct nand_chip *chip, const u8 *buf,
int oob_required, int page) int oob_required, int page)
{ {
return atmel_nand_pmecc_write_pg(chip, buf, oob_required, page, false); return atmel_nand_pmecc_write_pg(chip, buf, oob_required, page, false);
} }
static int atmel_nand_pmecc_write_page_raw(struct mtd_info *mtd, static int atmel_nand_pmecc_write_page_raw(struct nand_chip *chip,
struct nand_chip *chip,
const u8 *buf, int oob_required, const u8 *buf, int oob_required,
int page) int page)
{ {
...@@ -963,8 +961,7 @@ static int atmel_hsmc_nand_pmecc_write_pg(struct nand_chip *chip, ...@@ -963,8 +961,7 @@ static int atmel_hsmc_nand_pmecc_write_pg(struct nand_chip *chip,
return ret; return ret;
} }
static int atmel_hsmc_nand_pmecc_write_page(struct mtd_info *mtd, static int atmel_hsmc_nand_pmecc_write_page(struct nand_chip *chip,
struct nand_chip *chip,
const u8 *buf, int oob_required, const u8 *buf, int oob_required,
int page) int page)
{ {
...@@ -972,8 +969,7 @@ static int atmel_hsmc_nand_pmecc_write_page(struct mtd_info *mtd, ...@@ -972,8 +969,7 @@ static int atmel_hsmc_nand_pmecc_write_page(struct mtd_info *mtd,
false); false);
} }
static int atmel_hsmc_nand_pmecc_write_page_raw(struct mtd_info *mtd, static int atmel_hsmc_nand_pmecc_write_page_raw(struct nand_chip *chip,
struct nand_chip *chip,
const u8 *buf, const u8 *buf,
int oob_required, int page) int oob_required, int page)
{ {
......
...@@ -1909,9 +1909,10 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -1909,9 +1909,10 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip,
return ret; return ret;
} }
static int brcmnand_write_page(struct mtd_info *mtd, struct nand_chip *chip, static int brcmnand_write_page(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct brcmnand_host *host = nand_get_controller_data(chip); struct brcmnand_host *host = nand_get_controller_data(chip);
void *oob = oob_required ? chip->oob_poi : NULL; void *oob = oob_required ? chip->oob_poi : NULL;
...@@ -1921,10 +1922,10 @@ static int brcmnand_write_page(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -1921,10 +1922,10 @@ static int brcmnand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
return nand_prog_page_end_op(chip); return nand_prog_page_end_op(chip);
} }
static int brcmnand_write_page_raw(struct mtd_info *mtd, static int brcmnand_write_page_raw(struct nand_chip *chip, const uint8_t *buf,
struct nand_chip *chip, const uint8_t *buf,
int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct brcmnand_host *host = nand_get_controller_data(chip); struct brcmnand_host *host = nand_get_controller_data(chip);
void *oob = oob_required ? chip->oob_poi : NULL; void *oob = oob_required ? chip->oob_poi : NULL;
...@@ -1936,16 +1937,16 @@ static int brcmnand_write_page_raw(struct mtd_info *mtd, ...@@ -1936,16 +1937,16 @@ static int brcmnand_write_page_raw(struct mtd_info *mtd,
return nand_prog_page_end_op(chip); return nand_prog_page_end_op(chip);
} }
static int brcmnand_write_oob(struct mtd_info *mtd, struct nand_chip *chip, static int brcmnand_write_oob(struct nand_chip *chip, int page)
int page)
{ {
return brcmnand_write(mtd, chip, (u64)page << chip->page_shift, return brcmnand_write(nand_to_mtd(chip), chip,
NULL, chip->oob_poi); (u64)page << chip->page_shift, NULL,
chip->oob_poi);
} }
static int brcmnand_write_oob_raw(struct mtd_info *mtd, struct nand_chip *chip, static int brcmnand_write_oob_raw(struct nand_chip *chip, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct brcmnand_host *host = nand_get_controller_data(chip); struct brcmnand_host *host = nand_get_controller_data(chip);
int ret; int ret;
......
...@@ -346,9 +346,10 @@ static irqreturn_t cafe_nand_interrupt(int irq, void *id) ...@@ -346,9 +346,10 @@ static irqreturn_t cafe_nand_interrupt(int irq, void *id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int cafe_nand_write_oob(struct mtd_info *mtd, static int cafe_nand_write_oob(struct nand_chip *chip, int page)
struct nand_chip *chip, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
return nand_prog_page_op(chip, page, mtd->writesize, chip->oob_poi, return nand_prog_page_op(chip, page, mtd->writesize, chip->oob_poi,
mtd->oobsize); mtd->oobsize);
} }
...@@ -533,11 +534,11 @@ static struct nand_bbt_descr cafe_bbt_mirror_descr_512 = { ...@@ -533,11 +534,11 @@ static struct nand_bbt_descr cafe_bbt_mirror_descr_512 = {
}; };
static int cafe_nand_write_page_lowlevel(struct mtd_info *mtd, static int cafe_nand_write_page_lowlevel(struct nand_chip *chip,
struct nand_chip *chip, const uint8_t *buf, int oob_required,
const uint8_t *buf, int oob_required, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct cafe_priv *cafe = nand_get_controller_data(chip); struct cafe_priv *cafe = nand_get_controller_data(chip);
nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize); nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize);
......
...@@ -761,9 +761,9 @@ static int denali_read_oob(struct nand_chip *chip, int page) ...@@ -761,9 +761,9 @@ static int denali_read_oob(struct nand_chip *chip, int page)
return 0; return 0;
} }
static int denali_write_oob(struct mtd_info *mtd, struct nand_chip *chip, static int denali_write_oob(struct nand_chip *chip, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct denali_nand_info *denali = mtd_to_denali(mtd); struct denali_nand_info *denali = mtd_to_denali(mtd);
denali_reset_irq(denali); denali_reset_irq(denali);
...@@ -806,9 +806,10 @@ static int denali_read_page(struct nand_chip *chip, uint8_t *buf, ...@@ -806,9 +806,10 @@ static int denali_read_page(struct nand_chip *chip, uint8_t *buf,
return stat; return stat;
} }
static int denali_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, static int denali_write_page_raw(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct denali_nand_info *denali = mtd_to_denali(mtd); struct denali_nand_info *denali = mtd_to_denali(mtd);
int writesize = mtd->writesize; int writesize = mtd->writesize;
int oobsize = mtd->oobsize; int oobsize = mtd->oobsize;
...@@ -884,9 +885,10 @@ static int denali_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -884,9 +885,10 @@ static int denali_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
return denali_data_xfer(denali, tmp_buf, size, page, 1, 1); return denali_data_xfer(denali, tmp_buf, size, page, 1, 1);
} }
static int denali_write_page(struct mtd_info *mtd, struct nand_chip *chip, static int denali_write_page(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct denali_nand_info *denali = mtd_to_denali(mtd); struct denali_nand_info *denali = mtd_to_denali(mtd);
return denali_data_xfer(denali, (void *)buf, mtd->writesize, return denali_data_xfer(denali, (void *)buf, mtd->writesize,
......
...@@ -1007,20 +1007,19 @@ static int write_page(struct mtd_info *mtd, struct nand_chip *nand, ...@@ -1007,20 +1007,19 @@ static int write_page(struct mtd_info *mtd, struct nand_chip *nand,
return nand_prog_page_end_op(nand); return nand_prog_page_end_op(nand);
} }
static int docg4_write_page_raw(struct mtd_info *mtd, struct nand_chip *nand, static int docg4_write_page_raw(struct nand_chip *nand, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
return write_page(mtd, nand, buf, page, false); return write_page(nand_to_mtd(nand), nand, buf, page, false);
} }
static int docg4_write_page(struct mtd_info *mtd, struct nand_chip *nand, static int docg4_write_page(struct nand_chip *nand, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
return write_page(mtd, nand, buf, page, true); return write_page(nand_to_mtd(nand), nand, buf, page, true);
} }
static int docg4_write_oob(struct mtd_info *mtd, struct nand_chip *nand, static int docg4_write_oob(struct nand_chip *nand, int page)
int page)
{ {
/* /*
* Writing oob-only is not really supported, because MLC nand must write * Writing oob-only is not really supported, because MLC nand must write
...@@ -1144,7 +1143,7 @@ static int docg4_block_markbad(struct mtd_info *mtd, loff_t ofs) ...@@ -1144,7 +1143,7 @@ static int docg4_block_markbad(struct mtd_info *mtd, loff_t ofs)
/* write first page of block */ /* write first page of block */
write_page_prologue(mtd, g4_addr); write_page_prologue(mtd, g4_addr);
docg4_write_page(mtd, nand, buf, 1, page); docg4_write_page(nand, buf, 1, page);
ret = pageprog(mtd); ret = pageprog(mtd);
kfree(buf); kfree(buf);
......
...@@ -731,9 +731,11 @@ static int fsl_elbc_read_page(struct nand_chip *chip, uint8_t *buf, ...@@ -731,9 +731,11 @@ static int fsl_elbc_read_page(struct nand_chip *chip, uint8_t *buf,
/* ECC will be calculated automatically, and errors will be detected in /* ECC will be calculated automatically, and errors will be detected in
* waitfunc. * waitfunc.
*/ */
static int fsl_elbc_write_page(struct mtd_info *mtd, struct nand_chip *chip, static int fsl_elbc_write_page(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize); nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize);
fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize); fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
...@@ -743,10 +745,12 @@ static int fsl_elbc_write_page(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -743,10 +745,12 @@ static int fsl_elbc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
/* ECC will be calculated automatically, and errors will be detected in /* ECC will be calculated automatically, and errors will be detected in
* waitfunc. * waitfunc.
*/ */
static int fsl_elbc_write_subpage(struct mtd_info *mtd, struct nand_chip *chip, static int fsl_elbc_write_subpage(struct nand_chip *chip, uint32_t offset,
uint32_t offset, uint32_t data_len, uint32_t data_len, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
nand_prog_page_begin_op(chip, page, 0, NULL, 0); nand_prog_page_begin_op(chip, page, 0, NULL, 0);
fsl_elbc_write_buf(mtd, buf, mtd->writesize); fsl_elbc_write_buf(mtd, buf, mtd->writesize);
fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize); fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
......
...@@ -707,9 +707,11 @@ static int fsl_ifc_read_page(struct nand_chip *chip, uint8_t *buf, ...@@ -707,9 +707,11 @@ static int fsl_ifc_read_page(struct nand_chip *chip, uint8_t *buf,
/* ECC will be calculated automatically, and errors will be detected in /* ECC will be calculated automatically, and errors will be detected in
* waitfunc. * waitfunc.
*/ */
static int fsl_ifc_write_page(struct mtd_info *mtd, struct nand_chip *chip, static int fsl_ifc_write_page(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize); nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize);
fsl_ifc_write_buf(mtd, chip->oob_poi, mtd->oobsize); fsl_ifc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
......
...@@ -1182,9 +1182,10 @@ static int gpmi_ecc_read_subpage(struct nand_chip *chip, uint32_t offs, ...@@ -1182,9 +1182,10 @@ static int gpmi_ecc_read_subpage(struct nand_chip *chip, uint32_t offs,
return max_bitflips; return max_bitflips;
} }
static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip, static int gpmi_ecc_write_page(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct gpmi_nand_data *this = nand_get_controller_data(chip); struct gpmi_nand_data *this = nand_get_controller_data(chip);
struct bch_geometry *nfc_geo = &this->bch_geometry; struct bch_geometry *nfc_geo = &this->bch_geometry;
const void *payload_virt; const void *payload_virt;
...@@ -1351,9 +1352,9 @@ static int gpmi_ecc_read_oob(struct nand_chip *chip, int page) ...@@ -1351,9 +1352,9 @@ static int gpmi_ecc_read_oob(struct nand_chip *chip, int page)
return 0; return 0;
} }
static int static int gpmi_ecc_write_oob(struct nand_chip *chip, int page)
gpmi_ecc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct mtd_oob_region of = { }; struct mtd_oob_region of = { };
/* Do we have available oob area? */ /* Do we have available oob area? */
...@@ -1464,11 +1465,10 @@ static int gpmi_ecc_read_page_raw(struct nand_chip *chip, uint8_t *buf, ...@@ -1464,11 +1465,10 @@ static int gpmi_ecc_read_page_raw(struct nand_chip *chip, uint8_t *buf,
* See set_geometry_by_ecc_info inline comments to have a full description * See set_geometry_by_ecc_info inline comments to have a full description
* of the layout used by the GPMI controller. * of the layout used by the GPMI controller.
*/ */
static int gpmi_ecc_write_page_raw(struct mtd_info *mtd, static int gpmi_ecc_write_page_raw(struct nand_chip *chip, const uint8_t *buf,
struct nand_chip *chip,
const uint8_t *buf,
int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct gpmi_nand_data *this = nand_get_controller_data(chip); struct gpmi_nand_data *this = nand_get_controller_data(chip);
struct bch_geometry *nfc_geo = &this->bch_geometry; struct bch_geometry *nfc_geo = &this->bch_geometry;
int eccsize = nfc_geo->ecc_chunk_size; int eccsize = nfc_geo->ecc_chunk_size;
...@@ -1541,10 +1541,9 @@ static int gpmi_ecc_read_oob_raw(struct nand_chip *chip, int page) ...@@ -1541,10 +1541,9 @@ static int gpmi_ecc_read_oob_raw(struct nand_chip *chip, int page)
return gpmi_ecc_read_page_raw(chip, NULL, 1, page); return gpmi_ecc_read_page_raw(chip, NULL, 1, page);
} }
static int gpmi_ecc_write_oob_raw(struct mtd_info *mtd, struct nand_chip *chip, static int gpmi_ecc_write_oob_raw(struct nand_chip *chip, int page)
int page)
{ {
return gpmi_ecc_write_page_raw(mtd, chip, NULL, 1, page); return gpmi_ecc_write_page_raw(chip, NULL, 1, page);
} }
static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs) static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs)
...@@ -1715,7 +1714,7 @@ static int mx23_write_transcription_stamp(struct gpmi_nand_data *this) ...@@ -1715,7 +1714,7 @@ static int mx23_write_transcription_stamp(struct gpmi_nand_data *this)
/* Write the first page of the current stride. */ /* Write the first page of the current stride. */
dev_dbg(dev, "Writing an NCB fingerprint in page 0x%x\n", page); dev_dbg(dev, "Writing an NCB fingerprint in page 0x%x\n", page);
status = chip->ecc.write_page_raw(mtd, chip, buffer, 0, page); status = chip->ecc.write_page_raw(chip, buffer, 0, page);
if (status) if (status)
dev_err(dev, "[%s] Write failed.\n", __func__); dev_err(dev, "[%s] Write failed.\n", __func__);
} }
......
...@@ -577,10 +577,12 @@ static int hisi_nand_read_oob(struct nand_chip *chip, int page) ...@@ -577,10 +577,12 @@ static int hisi_nand_read_oob(struct nand_chip *chip, int page)
return 0; return 0;
} }
static int hisi_nand_write_page_hwecc(struct mtd_info *mtd, static int hisi_nand_write_page_hwecc(struct nand_chip *chip,
struct nand_chip *chip, const uint8_t *buf, int oob_required, const uint8_t *buf, int oob_required,
int page) int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize); nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize);
if (oob_required) if (oob_required)
chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
......
...@@ -508,11 +508,11 @@ static int lpc32xx_read_page(struct nand_chip *chip, uint8_t *buf, ...@@ -508,11 +508,11 @@ static int lpc32xx_read_page(struct nand_chip *chip, uint8_t *buf,
return 0; return 0;
} }
static int lpc32xx_write_page_lowlevel(struct mtd_info *mtd, static int lpc32xx_write_page_lowlevel(struct nand_chip *chip,
struct nand_chip *chip,
const uint8_t *buf, int oob_required, const uint8_t *buf, int oob_required,
int page) int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct lpc32xx_nand_host *host = nand_get_controller_data(chip); struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
const uint8_t *oobbuf = chip->oob_poi; const uint8_t *oobbuf = chip->oob_poi;
uint8_t *dma_buf = (uint8_t *)buf; uint8_t *dma_buf = (uint8_t *)buf;
...@@ -568,8 +568,7 @@ static int lpc32xx_read_oob(struct nand_chip *chip, int page) ...@@ -568,8 +568,7 @@ static int lpc32xx_read_oob(struct nand_chip *chip, int page)
return 0; return 0;
} }
static int lpc32xx_write_oob(struct mtd_info *mtd, struct nand_chip *chip, static int lpc32xx_write_oob(struct nand_chip *chip, int page)
int page)
{ {
/* None, write_oob conflicts with the automatic LPC MLC ECC decoder! */ /* None, write_oob conflicts with the automatic LPC MLC ECC decoder! */
return 0; return 0;
......
...@@ -406,9 +406,10 @@ static int lpc32xx_nand_read_oob_syndrome(struct nand_chip *chip, int page) ...@@ -406,9 +406,10 @@ static int lpc32xx_nand_read_oob_syndrome(struct nand_chip *chip, int page)
/* /*
* Write the OOB data to the device without ECC using FIFO method * Write the OOB data to the device without ECC using FIFO method
*/ */
static int lpc32xx_nand_write_oob_syndrome(struct mtd_info *mtd, static int lpc32xx_nand_write_oob_syndrome(struct nand_chip *chip, int page)
struct nand_chip *chip, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
return nand_prog_page_op(chip, page, mtd->writesize, chip->oob_poi, return nand_prog_page_op(chip, page, mtd->writesize, chip->oob_poi,
mtd->oobsize); mtd->oobsize);
} }
...@@ -678,11 +679,11 @@ static int lpc32xx_nand_read_page_raw_syndrome(struct nand_chip *chip, ...@@ -678,11 +679,11 @@ static int lpc32xx_nand_read_page_raw_syndrome(struct nand_chip *chip,
* Write the data and OOB data to the device, use ECC with the data, * Write the data and OOB data to the device, use ECC with the data,
* disable ECC for the OOB data * disable ECC for the OOB data
*/ */
static int lpc32xx_nand_write_page_syndrome(struct mtd_info *mtd, static int lpc32xx_nand_write_page_syndrome(struct nand_chip *chip,
struct nand_chip *chip,
const uint8_t *buf, const uint8_t *buf,
int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct lpc32xx_nand_host *host = nand_get_controller_data(chip); struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
struct mtd_oob_region oobregion = { }; struct mtd_oob_region oobregion = { };
uint8_t *pb; uint8_t *pb;
...@@ -716,11 +717,12 @@ static int lpc32xx_nand_write_page_syndrome(struct mtd_info *mtd, ...@@ -716,11 +717,12 @@ static int lpc32xx_nand_write_page_syndrome(struct mtd_info *mtd,
* Write the data and OOB data to the device, no ECC correction with the * Write the data and OOB data to the device, no ECC correction with the
* data or OOB data * data or OOB data
*/ */
static int lpc32xx_nand_write_page_raw_syndrome(struct mtd_info *mtd, static int lpc32xx_nand_write_page_raw_syndrome(struct nand_chip *chip,
struct nand_chip *chip,
const uint8_t *buf, const uint8_t *buf,
int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
/* Raw writes can just use the FIFO interface */ /* Raw writes can just use the FIFO interface */
nand_prog_page_begin_op(chip, page, 0, buf, nand_prog_page_begin_op(chip, page, 0, buf,
chip->ecc.size * chip->ecc.steps); chip->ecc.size * chip->ecc.steps);
......
...@@ -1136,8 +1136,7 @@ static int marvell_nfc_hw_ecc_hmg_do_write_page(struct nand_chip *chip, ...@@ -1136,8 +1136,7 @@ static int marvell_nfc_hw_ecc_hmg_do_write_page(struct nand_chip *chip,
return ret; return ret;
} }
static int marvell_nfc_hw_ecc_hmg_write_page_raw(struct mtd_info *mtd, static int marvell_nfc_hw_ecc_hmg_write_page_raw(struct nand_chip *chip,
struct nand_chip *chip,
const u8 *buf, const u8 *buf,
int oob_required, int page) int oob_required, int page)
{ {
...@@ -1145,8 +1144,7 @@ static int marvell_nfc_hw_ecc_hmg_write_page_raw(struct mtd_info *mtd, ...@@ -1145,8 +1144,7 @@ static int marvell_nfc_hw_ecc_hmg_write_page_raw(struct mtd_info *mtd,
true, page); true, page);
} }
static int marvell_nfc_hw_ecc_hmg_write_page(struct mtd_info *mtd, static int marvell_nfc_hw_ecc_hmg_write_page(struct nand_chip *chip,
struct nand_chip *chip,
const u8 *buf, const u8 *buf,
int oob_required, int page) int oob_required, int page)
{ {
...@@ -1165,10 +1163,11 @@ static int marvell_nfc_hw_ecc_hmg_write_page(struct mtd_info *mtd, ...@@ -1165,10 +1163,11 @@ static int marvell_nfc_hw_ecc_hmg_write_page(struct mtd_info *mtd,
* it appears before the ECC bytes when reading), the ->write_oob_raw() function * it appears before the ECC bytes when reading), the ->write_oob_raw() function
* also stands for ->write_oob(). * also stands for ->write_oob().
*/ */
static int marvell_nfc_hw_ecc_hmg_write_oob_raw(struct mtd_info *mtd, static int marvell_nfc_hw_ecc_hmg_write_oob_raw(struct nand_chip *chip,
struct nand_chip *chip,
int page) int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
/* Invalidate page cache */ /* Invalidate page cache */
chip->pagebuf = -1; chip->pagebuf = -1;
...@@ -1405,8 +1404,7 @@ static int marvell_nfc_hw_ecc_bch_read_oob(struct nand_chip *chip, int page) ...@@ -1405,8 +1404,7 @@ static int marvell_nfc_hw_ecc_bch_read_oob(struct nand_chip *chip, int page)
} }
/* BCH write helpers */ /* BCH write helpers */
static int marvell_nfc_hw_ecc_bch_write_page_raw(struct mtd_info *mtd, static int marvell_nfc_hw_ecc_bch_write_page_raw(struct nand_chip *chip,
struct nand_chip *chip,
const u8 *buf, const u8 *buf,
int oob_required, int page) int oob_required, int page)
{ {
...@@ -1519,11 +1517,11 @@ marvell_nfc_hw_ecc_bch_write_chunk(struct nand_chip *chip, int chunk, ...@@ -1519,11 +1517,11 @@ marvell_nfc_hw_ecc_bch_write_chunk(struct nand_chip *chip, int chunk,
return 0; return 0;
} }
static int marvell_nfc_hw_ecc_bch_write_page(struct mtd_info *mtd, static int marvell_nfc_hw_ecc_bch_write_page(struct nand_chip *chip,
struct nand_chip *chip,
const u8 *buf, const u8 *buf,
int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
const struct marvell_hw_ecc_layout *lt = to_marvell_nand(chip)->layout; const struct marvell_hw_ecc_layout *lt = to_marvell_nand(chip)->layout;
const u8 *data = buf; const u8 *data = buf;
const u8 *spare = chip->oob_poi; const u8 *spare = chip->oob_poi;
...@@ -1568,27 +1566,29 @@ static int marvell_nfc_hw_ecc_bch_write_page(struct mtd_info *mtd, ...@@ -1568,27 +1566,29 @@ static int marvell_nfc_hw_ecc_bch_write_page(struct mtd_info *mtd,
return 0; return 0;
} }
static int marvell_nfc_hw_ecc_bch_write_oob_raw(struct mtd_info *mtd, static int marvell_nfc_hw_ecc_bch_write_oob_raw(struct nand_chip *chip,
struct nand_chip *chip,
int page) int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
/* Invalidate page cache */ /* Invalidate page cache */
chip->pagebuf = -1; chip->pagebuf = -1;
memset(chip->data_buf, 0xFF, mtd->writesize); memset(chip->data_buf, 0xFF, mtd->writesize);
return chip->ecc.write_page_raw(mtd, chip, chip->data_buf, true, page); return chip->ecc.write_page_raw(chip, chip->data_buf, true, page);
} }
static int marvell_nfc_hw_ecc_bch_write_oob(struct mtd_info *mtd, static int marvell_nfc_hw_ecc_bch_write_oob(struct nand_chip *chip, int page)
struct nand_chip *chip, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
/* Invalidate page cache */ /* Invalidate page cache */
chip->pagebuf = -1; chip->pagebuf = -1;
memset(chip->data_buf, 0xFF, mtd->writesize); memset(chip->data_buf, 0xFF, mtd->writesize);
return chip->ecc.write_page(mtd, chip, chip->data_buf, true, page); return chip->ecc.write_page(chip, chip->data_buf, true, page);
} }
/* NAND framework ->exec_op() hooks and related helpers */ /* NAND framework ->exec_op() hooks and related helpers */
......
...@@ -807,27 +807,27 @@ static int mtk_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -807,27 +807,27 @@ static int mtk_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
return nand_prog_page_end_op(chip); return nand_prog_page_end_op(chip);
} }
static int mtk_nfc_write_page_hwecc(struct mtd_info *mtd, static int mtk_nfc_write_page_hwecc(struct nand_chip *chip, const u8 *buf,
struct nand_chip *chip, const u8 *buf,
int oob_on, int page) int oob_on, int page)
{ {
return mtk_nfc_write_page(mtd, chip, buf, page, 0); return mtk_nfc_write_page(nand_to_mtd(chip), chip, buf, page, 0);
} }
static int mtk_nfc_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, static int mtk_nfc_write_page_raw(struct nand_chip *chip, const u8 *buf,
const u8 *buf, int oob_on, int pg) int oob_on, int pg)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct mtk_nfc *nfc = nand_get_controller_data(chip); struct mtk_nfc *nfc = nand_get_controller_data(chip);
mtk_nfc_format_page(mtd, buf); mtk_nfc_format_page(mtd, buf);
return mtk_nfc_write_page(mtd, chip, nfc->buffer, pg, 1); return mtk_nfc_write_page(mtd, chip, nfc->buffer, pg, 1);
} }
static int mtk_nfc_write_subpage_hwecc(struct mtd_info *mtd, static int mtk_nfc_write_subpage_hwecc(struct nand_chip *chip, u32 offset,
struct nand_chip *chip, u32 offset,
u32 data_len, const u8 *buf, u32 data_len, const u8 *buf,
int oob_on, int page) int oob_on, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct mtk_nfc *nfc = nand_get_controller_data(chip); struct mtk_nfc *nfc = nand_get_controller_data(chip);
int ret; int ret;
...@@ -839,10 +839,9 @@ static int mtk_nfc_write_subpage_hwecc(struct mtd_info *mtd, ...@@ -839,10 +839,9 @@ static int mtk_nfc_write_subpage_hwecc(struct mtd_info *mtd,
return mtk_nfc_write_page(mtd, chip, nfc->buffer, page, 1); return mtk_nfc_write_page(mtd, chip, nfc->buffer, page, 1);
} }
static int mtk_nfc_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip, static int mtk_nfc_write_oob_std(struct nand_chip *chip, int page)
int page)
{ {
return mtk_nfc_write_page_raw(mtd, chip, NULL, 1, page); return mtk_nfc_write_page_raw(chip, NULL, 1, page);
} }
static int mtk_nfc_update_ecc_stats(struct mtd_info *mtd, u8 *buf, u32 sectors) static int mtk_nfc_update_ecc_stats(struct mtd_info *mtd, u8 *buf, u32 sectors)
......
...@@ -873,22 +873,21 @@ static int mxc_nand_write_page(struct nand_chip *chip, const uint8_t *buf, ...@@ -873,22 +873,21 @@ static int mxc_nand_write_page(struct nand_chip *chip, const uint8_t *buf,
return 0; return 0;
} }
static int mxc_nand_write_page_ecc(struct mtd_info *mtd, struct nand_chip *chip, static int mxc_nand_write_page_ecc(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int oob_required, int page)
int page)
{ {
return mxc_nand_write_page(chip, buf, true, page); return mxc_nand_write_page(chip, buf, true, page);
} }
static int mxc_nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, static int mxc_nand_write_page_raw(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
return mxc_nand_write_page(chip, buf, false, page); return mxc_nand_write_page(chip, buf, false, page);
} }
static int mxc_nand_write_oob(struct mtd_info *mtd, struct nand_chip *chip, static int mxc_nand_write_oob(struct nand_chip *chip, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct mxc_nand_host *host = nand_get_controller_data(chip); struct mxc_nand_host *host = nand_get_controller_data(chip);
memset(host->data_buf, 0xff, mtd->writesize); memset(host->data_buf, 0xff, mtd->writesize);
......
...@@ -3787,12 +3787,13 @@ EXPORT_SYMBOL(nand_read_oob_syndrome); ...@@ -3787,12 +3787,13 @@ EXPORT_SYMBOL(nand_read_oob_syndrome);
/** /**
* nand_write_oob_std - [REPLACEABLE] the most common OOB data write function * nand_write_oob_std - [REPLACEABLE] the most common OOB data write function
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @page: page number to write * @page: page number to write
*/ */
int nand_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip, int page) int nand_write_oob_std(struct nand_chip *chip, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
return nand_prog_page_op(chip, page, mtd->writesize, chip->oob_poi, return nand_prog_page_op(chip, page, mtd->writesize, chip->oob_poi,
mtd->oobsize); mtd->oobsize);
} }
...@@ -3801,13 +3802,12 @@ EXPORT_SYMBOL(nand_write_oob_std); ...@@ -3801,13 +3802,12 @@ EXPORT_SYMBOL(nand_write_oob_std);
/** /**
* nand_write_oob_syndrome - [REPLACEABLE] OOB data write function for HW ECC * nand_write_oob_syndrome - [REPLACEABLE] OOB data write function for HW ECC
* with syndrome - only for large page flash * with syndrome - only for large page flash
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @page: page number to write * @page: page number to write
*/ */
int nand_write_oob_syndrome(struct mtd_info *mtd, struct nand_chip *chip, int nand_write_oob_syndrome(struct nand_chip *chip, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
int chunk = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad; int chunk = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad;
int eccsize = chip->ecc.size, length = mtd->oobsize; int eccsize = chip->ecc.size, length = mtd->oobsize;
int ret, i, len, pos, sndcmd = 0, steps = chip->ecc.steps; int ret, i, len, pos, sndcmd = 0, steps = chip->ecc.steps;
...@@ -3984,7 +3984,6 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from, ...@@ -3984,7 +3984,6 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
/** /**
* nand_write_page_raw_notsupp - dummy raw page write function * nand_write_page_raw_notsupp - dummy raw page write function
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @buf: data buffer * @buf: data buffer
* @oob_required: must write chip->oob_poi to OOB * @oob_required: must write chip->oob_poi to OOB
...@@ -3992,8 +3991,8 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from, ...@@ -3992,8 +3991,8 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
* *
* Returns -ENOTSUPP unconditionally. * Returns -ENOTSUPP unconditionally.
*/ */
int nand_write_page_raw_notsupp(struct mtd_info *mtd, struct nand_chip *chip, int nand_write_page_raw_notsupp(struct nand_chip *chip, const u8 *buf,
const u8 *buf, int oob_required, int page) int oob_required, int page)
{ {
return -ENOTSUPP; return -ENOTSUPP;
} }
...@@ -4001,7 +4000,6 @@ EXPORT_SYMBOL(nand_write_page_raw_notsupp); ...@@ -4001,7 +4000,6 @@ EXPORT_SYMBOL(nand_write_page_raw_notsupp);
/** /**
* nand_write_page_raw - [INTERN] raw page write function * nand_write_page_raw - [INTERN] raw page write function
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @buf: data buffer * @buf: data buffer
* @oob_required: must write chip->oob_poi to OOB * @oob_required: must write chip->oob_poi to OOB
...@@ -4009,9 +4007,10 @@ EXPORT_SYMBOL(nand_write_page_raw_notsupp); ...@@ -4009,9 +4007,10 @@ EXPORT_SYMBOL(nand_write_page_raw_notsupp);
* *
* Not for syndrome calculating ECC controllers, which use a special oob layout. * Not for syndrome calculating ECC controllers, which use a special oob layout.
*/ */
int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, int nand_write_page_raw(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
int ret; int ret;
ret = nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize); ret = nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize);
...@@ -4031,7 +4030,6 @@ EXPORT_SYMBOL(nand_write_page_raw); ...@@ -4031,7 +4030,6 @@ EXPORT_SYMBOL(nand_write_page_raw);
/** /**
* nand_write_page_raw_syndrome - [INTERN] raw page write function * nand_write_page_raw_syndrome - [INTERN] raw page write function
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @buf: data buffer * @buf: data buffer
* @oob_required: must write chip->oob_poi to OOB * @oob_required: must write chip->oob_poi to OOB
...@@ -4039,11 +4037,11 @@ EXPORT_SYMBOL(nand_write_page_raw); ...@@ -4039,11 +4037,11 @@ EXPORT_SYMBOL(nand_write_page_raw);
* *
* We need a special oob layout and handling even when ECC isn't checked. * 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, static int nand_write_page_raw_syndrome(struct nand_chip *chip,
struct nand_chip *chip,
const uint8_t *buf, int oob_required, const uint8_t *buf, int oob_required,
int page) int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
int eccsize = chip->ecc.size; int eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes; int eccbytes = chip->ecc.bytes;
uint8_t *oob = chip->oob_poi; uint8_t *oob = chip->oob_poi;
...@@ -4096,16 +4094,15 @@ static int nand_write_page_raw_syndrome(struct mtd_info *mtd, ...@@ -4096,16 +4094,15 @@ static int nand_write_page_raw_syndrome(struct mtd_info *mtd,
} }
/** /**
* nand_write_page_swecc - [REPLACEABLE] software ECC based page write function * nand_write_page_swecc - [REPLACEABLE] software ECC based page write function
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @buf: data buffer * @buf: data buffer
* @oob_required: must write chip->oob_poi to OOB * @oob_required: must write chip->oob_poi to OOB
* @page: page number to write * @page: page number to write
*/ */
static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, static int nand_write_page_swecc(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int oob_required, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
int i, eccsize = chip->ecc.size, ret; int i, eccsize = chip->ecc.size, ret;
int eccbytes = chip->ecc.bytes; int eccbytes = chip->ecc.bytes;
int eccsteps = chip->ecc.steps; int eccsteps = chip->ecc.steps;
...@@ -4121,21 +4118,20 @@ static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -4121,21 +4118,20 @@ static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
if (ret) if (ret)
return ret; return ret;
return chip->ecc.write_page_raw(mtd, chip, buf, 1, page); return chip->ecc.write_page_raw(chip, buf, 1, page);
} }
/** /**
* nand_write_page_hwecc - [REPLACEABLE] hardware ECC based page write function * nand_write_page_hwecc - [REPLACEABLE] hardware ECC based page write function
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @buf: data buffer * @buf: data buffer
* @oob_required: must write chip->oob_poi to OOB * @oob_required: must write chip->oob_poi to OOB
* @page: page number to write * @page: page number to write
*/ */
static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, static int nand_write_page_hwecc(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int oob_required, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
int i, eccsize = chip->ecc.size, ret; int i, eccsize = chip->ecc.size, ret;
int eccbytes = chip->ecc.bytes; int eccbytes = chip->ecc.bytes;
int eccsteps = chip->ecc.steps; int eccsteps = chip->ecc.steps;
...@@ -4171,7 +4167,6 @@ static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -4171,7 +4167,6 @@ static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
/** /**
* nand_write_subpage_hwecc - [REPLACEABLE] hardware ECC based subpage write * nand_write_subpage_hwecc - [REPLACEABLE] hardware ECC based subpage write
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @offset: column address of subpage within the page * @offset: column address of subpage within the page
* @data_len: data length * @data_len: data length
...@@ -4179,11 +4174,11 @@ static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -4179,11 +4174,11 @@ static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
* @oob_required: must write chip->oob_poi to OOB * @oob_required: must write chip->oob_poi to OOB
* @page: page number to write * @page: page number to write
*/ */
static int nand_write_subpage_hwecc(struct mtd_info *mtd, static int nand_write_subpage_hwecc(struct nand_chip *chip, uint32_t offset,
struct nand_chip *chip, uint32_t offset, uint32_t data_len, const uint8_t *buf,
uint32_t data_len, const uint8_t *buf, int oob_required, int page)
int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
uint8_t *oob_buf = chip->oob_poi; uint8_t *oob_buf = chip->oob_poi;
uint8_t *ecc_calc = chip->ecc.calc_buf; uint8_t *ecc_calc = chip->ecc.calc_buf;
int ecc_size = chip->ecc.size; int ecc_size = chip->ecc.size;
...@@ -4242,7 +4237,6 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd, ...@@ -4242,7 +4237,6 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
/** /**
* nand_write_page_syndrome - [REPLACEABLE] hardware ECC syndrome based page write * nand_write_page_syndrome - [REPLACEABLE] hardware ECC syndrome based page write
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @buf: data buffer * @buf: data buffer
* @oob_required: must write chip->oob_poi to OOB * @oob_required: must write chip->oob_poi to OOB
...@@ -4251,11 +4245,10 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd, ...@@ -4251,11 +4245,10 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
* The hw generator calculates the error syndrome automatically. Therefore we * The hw generator calculates the error syndrome automatically. Therefore we
* need a special oob layout and handling. * need a special oob layout and handling.
*/ */
static int nand_write_page_syndrome(struct mtd_info *mtd, static int nand_write_page_syndrome(struct nand_chip *chip, const uint8_t *buf,
struct nand_chip *chip, int oob_required, int page)
const uint8_t *buf, int oob_required,
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
int i, eccsize = chip->ecc.size; int i, eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes; int eccbytes = chip->ecc.bytes;
int eccsteps = chip->ecc.steps; int eccsteps = chip->ecc.steps;
...@@ -4336,14 +4329,13 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -4336,14 +4329,13 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
subpage = 0; subpage = 0;
if (unlikely(raw)) if (unlikely(raw))
status = chip->ecc.write_page_raw(mtd, chip, buf, status = chip->ecc.write_page_raw(chip, buf, oob_required,
oob_required, page); page);
else if (subpage) else if (subpage)
status = chip->ecc.write_subpage(mtd, chip, offset, data_len, status = chip->ecc.write_subpage(chip, offset, data_len, buf,
buf, oob_required, page); oob_required, page);
else else
status = chip->ecc.write_page(mtd, chip, buf, oob_required, status = chip->ecc.write_page(chip, buf, oob_required, page);
page);
if (status < 0) if (status < 0)
return status; return status;
...@@ -4610,9 +4602,9 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, ...@@ -4610,9 +4602,9 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
nand_fill_oob(mtd, ops->oobbuf, ops->ooblen, ops); nand_fill_oob(mtd, ops->oobbuf, ops->ooblen, ops);
if (ops->mode == MTD_OPS_RAW) if (ops->mode == MTD_OPS_RAW)
status = chip->ecc.write_oob_raw(mtd, chip, page & chip->pagemask); status = chip->ecc.write_oob_raw(chip, page & chip->pagemask);
else else
status = chip->ecc.write_oob(mtd, chip, page & chip->pagemask); status = chip->ecc.write_oob(chip, page & chip->pagemask);
chip->select_chip(mtd, -1); chip->select_chip(mtd, -1);
......
...@@ -394,7 +394,7 @@ EXPORT_SYMBOL(__nand_calculate_ecc); ...@@ -394,7 +394,7 @@ EXPORT_SYMBOL(__nand_calculate_ecc);
/** /**
* nand_calculate_ecc - [NAND Interface] Calculate 3-byte ECC for 256/512-byte * nand_calculate_ecc - [NAND Interface] Calculate 3-byte ECC for 256/512-byte
* block * block
* @mtd: MTD block structure * @chip: NAND chip object
* @buf: input buffer with raw data * @buf: input buffer with raw data
* @code: output buffer with ECC * @code: output buffer with ECC
*/ */
......
...@@ -332,9 +332,8 @@ micron_nand_read_page_on_die_ecc(struct nand_chip *chip, uint8_t *buf, ...@@ -332,9 +332,8 @@ micron_nand_read_page_on_die_ecc(struct nand_chip *chip, uint8_t *buf,
} }
static int static int
micron_nand_write_page_on_die_ecc(struct mtd_info *mtd, struct nand_chip *chip, micron_nand_write_page_on_die_ecc(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int oob_required, int page)
int page)
{ {
int ret; int ret;
...@@ -342,7 +341,7 @@ micron_nand_write_page_on_die_ecc(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -342,7 +341,7 @@ micron_nand_write_page_on_die_ecc(struct mtd_info *mtd, struct nand_chip *chip,
if (ret) if (ret)
return ret; return ret;
ret = nand_write_page_raw(mtd, chip, buf, oob_required, page); ret = nand_write_page_raw(chip, buf, oob_required, page);
micron_nand_on_die_ecc_setup(chip, false); micron_nand_on_die_ecc_setup(chip, false);
return ret; return ret;
......
...@@ -1511,7 +1511,6 @@ static int omap_elm_correct_data(struct nand_chip *chip, u_char *data, ...@@ -1511,7 +1511,6 @@ static int omap_elm_correct_data(struct nand_chip *chip, u_char *data,
/** /**
* omap_write_page_bch - BCH ecc based write page function for entire page * omap_write_page_bch - BCH ecc based write page function for entire page
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @buf: data buffer * @buf: data buffer
* @oob_required: must write chip->oob_poi to OOB * @oob_required: must write chip->oob_poi to OOB
...@@ -1519,9 +1518,10 @@ static int omap_elm_correct_data(struct nand_chip *chip, u_char *data, ...@@ -1519,9 +1518,10 @@ static int omap_elm_correct_data(struct nand_chip *chip, u_char *data,
* *
* Custom write page method evolved to support multi sector writing in one shot * 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, static int omap_write_page_bch(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
int ret; int ret;
uint8_t *ecc_calc = chip->ecc.calc_buf; uint8_t *ecc_calc = chip->ecc.calc_buf;
...@@ -1549,7 +1549,6 @@ static int omap_write_page_bch(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -1549,7 +1549,6 @@ static int omap_write_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
/** /**
* omap_write_subpage_bch - BCH hardware ECC based subpage write * omap_write_subpage_bch - BCH hardware ECC based subpage write
* @mtd: mtd info structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @offset: column address of subpage within the page * @offset: column address of subpage within the page
* @data_len: data length * @data_len: data length
...@@ -1559,11 +1558,11 @@ static int omap_write_page_bch(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -1559,11 +1558,11 @@ static int omap_write_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
* *
* OMAP optimized subpage write method. * OMAP optimized subpage write method.
*/ */
static int omap_write_subpage_bch(struct mtd_info *mtd, static int omap_write_subpage_bch(struct nand_chip *chip, u32 offset,
struct nand_chip *chip, u32 offset,
u32 data_len, const u8 *buf, u32 data_len, const u8 *buf,
int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
u8 *ecc_calc = chip->ecc.calc_buf; u8 *ecc_calc = chip->ecc.calc_buf;
int ecc_size = chip->ecc.size; int ecc_size = chip->ecc.size;
int ecc_bytes = chip->ecc.bytes; int ecc_bytes = chip->ecc.bytes;
......
...@@ -2005,8 +2005,8 @@ static int qcom_nandc_read_oob(struct nand_chip *chip, int page) ...@@ -2005,8 +2005,8 @@ static int qcom_nandc_read_oob(struct nand_chip *chip, int page)
} }
/* implements ecc->write_page() */ /* implements ecc->write_page() */
static int qcom_nandc_write_page(struct mtd_info *mtd, struct nand_chip *chip, static int qcom_nandc_write_page(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct qcom_nand_host *host = to_qcom_nand_host(chip); struct qcom_nand_host *host = to_qcom_nand_host(chip);
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
...@@ -2075,10 +2075,11 @@ static int qcom_nandc_write_page(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -2075,10 +2075,11 @@ static int qcom_nandc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
} }
/* implements ecc->write_page_raw() */ /* implements ecc->write_page_raw() */
static int qcom_nandc_write_page_raw(struct mtd_info *mtd, static int qcom_nandc_write_page_raw(struct nand_chip *chip,
struct nand_chip *chip, const uint8_t *buf, const uint8_t *buf, int oob_required,
int oob_required, int page) int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct qcom_nand_host *host = to_qcom_nand_host(chip); struct qcom_nand_host *host = to_qcom_nand_host(chip);
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
struct nand_ecc_ctrl *ecc = &chip->ecc; struct nand_ecc_ctrl *ecc = &chip->ecc;
...@@ -2153,9 +2154,9 @@ static int qcom_nandc_write_page_raw(struct mtd_info *mtd, ...@@ -2153,9 +2154,9 @@ static int qcom_nandc_write_page_raw(struct mtd_info *mtd,
* since ECC is calculated for the combined codeword. So update the OOB from * since ECC is calculated for the combined codeword. So update the OOB from
* chip->oob_poi, and pad the data area with OxFF before writing. * chip->oob_poi, and pad the data area with OxFF before writing.
*/ */
static int qcom_nandc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, static int qcom_nandc_write_oob(struct nand_chip *chip, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct qcom_nand_host *host = to_qcom_nand_host(chip); struct qcom_nand_host *host = to_qcom_nand_host(chip);
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
struct nand_ecc_ctrl *ecc = &chip->ecc; struct nand_ecc_ctrl *ecc = &chip->ecc;
......
...@@ -622,10 +622,11 @@ static int flctl_read_page_hwecc(struct nand_chip *chip, uint8_t *buf, ...@@ -622,10 +622,11 @@ static int flctl_read_page_hwecc(struct nand_chip *chip, uint8_t *buf,
return 0; return 0;
} }
static int flctl_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, static int flctl_write_page_hwecc(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int oob_required, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize); nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize);
chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
return nand_prog_page_end_op(chip); return nand_prog_page_end_op(chip);
......
...@@ -1297,11 +1297,11 @@ static int sunxi_nfc_hw_ecc_read_subpage_dma(struct nand_chip *chip, ...@@ -1297,11 +1297,11 @@ static int sunxi_nfc_hw_ecc_read_subpage_dma(struct nand_chip *chip,
buf, page); buf, page);
} }
static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd, static int sunxi_nfc_hw_ecc_write_page(struct nand_chip *chip,
struct nand_chip *chip,
const uint8_t *buf, int oob_required, const uint8_t *buf, int oob_required,
int page) int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct nand_ecc_ctrl *ecc = &chip->ecc; struct nand_ecc_ctrl *ecc = &chip->ecc;
int ret, i, cur_off = 0; int ret, i, cur_off = 0;
...@@ -1331,12 +1331,12 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd, ...@@ -1331,12 +1331,12 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
return nand_prog_page_end_op(chip); return nand_prog_page_end_op(chip);
} }
static int sunxi_nfc_hw_ecc_write_subpage(struct mtd_info *mtd, static int sunxi_nfc_hw_ecc_write_subpage(struct nand_chip *chip,
struct nand_chip *chip,
u32 data_offs, u32 data_len, u32 data_offs, u32 data_len,
const u8 *buf, int oob_required, const u8 *buf, int oob_required,
int page) int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct nand_ecc_ctrl *ecc = &chip->ecc; struct nand_ecc_ctrl *ecc = &chip->ecc;
int ret, i, cur_off = 0; int ret, i, cur_off = 0;
...@@ -1363,12 +1363,12 @@ static int sunxi_nfc_hw_ecc_write_subpage(struct mtd_info *mtd, ...@@ -1363,12 +1363,12 @@ static int sunxi_nfc_hw_ecc_write_subpage(struct mtd_info *mtd,
return nand_prog_page_end_op(chip); return nand_prog_page_end_op(chip);
} }
static int sunxi_nfc_hw_ecc_write_page_dma(struct mtd_info *mtd, static int sunxi_nfc_hw_ecc_write_page_dma(struct nand_chip *chip,
struct nand_chip *chip,
const u8 *buf, const u8 *buf,
int oob_required, int oob_required,
int page) int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct nand_chip *nand = mtd_to_nand(mtd); struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller); struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller);
struct nand_ecc_ctrl *ecc = &nand->ecc; struct nand_ecc_ctrl *ecc = &nand->ecc;
...@@ -1425,7 +1425,7 @@ static int sunxi_nfc_hw_ecc_write_page_dma(struct mtd_info *mtd, ...@@ -1425,7 +1425,7 @@ static int sunxi_nfc_hw_ecc_write_page_dma(struct mtd_info *mtd,
return nand_prog_page_end_op(chip); return nand_prog_page_end_op(chip);
pio_fallback: pio_fallback:
return sunxi_nfc_hw_ecc_write_page(mtd, chip, buf, oob_required, page); return sunxi_nfc_hw_ecc_write_page(chip, buf, oob_required, page);
} }
static int sunxi_nfc_hw_ecc_read_oob(struct nand_chip *chip, int page) static int sunxi_nfc_hw_ecc_read_oob(struct nand_chip *chip, int page)
...@@ -1435,16 +1435,15 @@ static int sunxi_nfc_hw_ecc_read_oob(struct nand_chip *chip, int page) ...@@ -1435,16 +1435,15 @@ static int sunxi_nfc_hw_ecc_read_oob(struct nand_chip *chip, int page)
return chip->ecc.read_page(chip, chip->data_buf, 1, page); return chip->ecc.read_page(chip, chip->data_buf, 1, page);
} }
static int sunxi_nfc_hw_ecc_write_oob(struct mtd_info *mtd, static int sunxi_nfc_hw_ecc_write_oob(struct nand_chip *chip, int page)
struct nand_chip *chip,
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
int ret; int ret;
chip->pagebuf = -1; chip->pagebuf = -1;
memset(chip->data_buf, 0xff, mtd->writesize); memset(chip->data_buf, 0xff, mtd->writesize);
ret = chip->ecc.write_page(mtd, chip, chip->data_buf, 1, page); ret = chip->ecc.write_page(chip, chip->data_buf, 1, page);
if (ret) if (ret)
return ret; return ret;
......
...@@ -300,9 +300,10 @@ static int tango_read_page(struct nand_chip *chip, u8 *buf, ...@@ -300,9 +300,10 @@ static int tango_read_page(struct nand_chip *chip, u8 *buf,
return res; return res;
} }
static int tango_write_page(struct mtd_info *mtd, struct nand_chip *chip, static int tango_write_page(struct nand_chip *chip, const u8 *buf,
const u8 *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct tango_nfc *nfc = to_tango_nfc(chip->controller); struct tango_nfc *nfc = to_tango_nfc(chip->controller);
int err, status, len = mtd->writesize; int err, status, len = mtd->writesize;
...@@ -433,8 +434,8 @@ static int tango_read_page_raw(struct nand_chip *chip, u8 *buf, ...@@ -433,8 +434,8 @@ static int tango_read_page_raw(struct nand_chip *chip, u8 *buf,
return 0; return 0;
} }
static int tango_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, static int tango_write_page_raw(struct nand_chip *chip, const u8 *buf,
const u8 *buf, int oob_required, int page) int oob_required, int page)
{ {
nand_prog_page_begin_op(chip, page, 0, NULL, 0); nand_prog_page_begin_op(chip, page, 0, NULL, 0);
raw_write(chip, buf, chip->oob_poi); raw_write(chip, buf, chip->oob_poi);
...@@ -448,8 +449,7 @@ static int tango_read_oob(struct nand_chip *chip, int page) ...@@ -448,8 +449,7 @@ static int tango_read_oob(struct nand_chip *chip, int page)
return 0; return 0;
} }
static int tango_write_oob(struct mtd_info *mtd, struct nand_chip *chip, static int tango_write_oob(struct nand_chip *chip, int page)
int page)
{ {
nand_prog_page_begin_op(chip, page, 0, NULL, 0); nand_prog_page_begin_op(chip, page, 0, NULL, 0);
raw_write(chip, NULL, chip->oob_poi); raw_write(chip, NULL, chip->oob_poi);
......
...@@ -625,10 +625,10 @@ static int tegra_nand_read_page_raw(struct nand_chip *chip, u8 *buf, ...@@ -625,10 +625,10 @@ static int tegra_nand_read_page_raw(struct nand_chip *chip, u8 *buf,
mtd->oobsize, page, true); mtd->oobsize, page, true);
} }
static int tegra_nand_write_page_raw(struct mtd_info *mtd, static int tegra_nand_write_page_raw(struct nand_chip *chip, const u8 *buf,
struct nand_chip *chip, const u8 *buf,
int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
void *oob_buf = oob_required ? chip->oob_poi : NULL; void *oob_buf = oob_required ? chip->oob_poi : NULL;
return tegra_nand_page_xfer(mtd, chip, (void *)buf, oob_buf, return tegra_nand_page_xfer(mtd, chip, (void *)buf, oob_buf,
...@@ -643,9 +643,10 @@ static int tegra_nand_read_oob(struct nand_chip *chip, int page) ...@@ -643,9 +643,10 @@ static int tegra_nand_read_oob(struct nand_chip *chip, int page)
mtd->oobsize, page, true); mtd->oobsize, page, true);
} }
static int tegra_nand_write_oob(struct mtd_info *mtd, struct nand_chip *chip, static int tegra_nand_write_oob(struct nand_chip *chip, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
return tegra_nand_page_xfer(mtd, chip, NULL, chip->oob_poi, return tegra_nand_page_xfer(mtd, chip, NULL, chip->oob_poi,
mtd->oobsize, page, false); mtd->oobsize, page, false);
} }
...@@ -760,10 +761,10 @@ static int tegra_nand_read_page_hwecc(struct nand_chip *chip, u8 *buf, ...@@ -760,10 +761,10 @@ static int tegra_nand_read_page_hwecc(struct nand_chip *chip, u8 *buf,
} }
} }
static int tegra_nand_write_page_hwecc(struct mtd_info *mtd, static int tegra_nand_write_page_hwecc(struct nand_chip *chip, const u8 *buf,
struct nand_chip *chip, const u8 *buf,
int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct tegra_nand_controller *ctrl = to_tegra_ctrl(chip->controller); struct tegra_nand_controller *ctrl = to_tegra_ctrl(chip->controller);
void *oob_buf = oob_required ? chip->oob_poi : NULL; void *oob_buf = oob_required ? chip->oob_poi : NULL;
int ret; int ret;
......
...@@ -603,9 +603,10 @@ static int vf610_nfc_read_page(struct nand_chip *chip, uint8_t *buf, ...@@ -603,9 +603,10 @@ static int vf610_nfc_read_page(struct nand_chip *chip, uint8_t *buf,
} }
} }
static int vf610_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip, static int vf610_nfc_write_page(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct vf610_nfc *nfc = mtd_to_nfc(mtd); struct vf610_nfc *nfc = mtd_to_nfc(mtd);
int trfr_sz = mtd->writesize + mtd->oobsize; int trfr_sz = mtd->writesize + mtd->oobsize;
u32 row = 0, cmd1 = 0, cmd2 = 0, code = 0; u32 row = 0, cmd1 = 0, cmd2 = 0, code = 0;
...@@ -658,10 +659,10 @@ static int vf610_nfc_read_page_raw(struct nand_chip *chip, u8 *buf, ...@@ -658,10 +659,10 @@ static int vf610_nfc_read_page_raw(struct nand_chip *chip, u8 *buf,
return ret; return ret;
} }
static int vf610_nfc_write_page_raw(struct mtd_info *mtd, static int vf610_nfc_write_page_raw(struct nand_chip *chip, const u8 *buf,
struct nand_chip *chip, const u8 *buf,
int oob_required, int page) int oob_required, int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct vf610_nfc *nfc = mtd_to_nfc(mtd); struct vf610_nfc *nfc = mtd_to_nfc(mtd);
int ret; int ret;
...@@ -690,9 +691,9 @@ static int vf610_nfc_read_oob(struct nand_chip *chip, int page) ...@@ -690,9 +691,9 @@ static int vf610_nfc_read_oob(struct nand_chip *chip, int page)
return ret; return ret;
} }
static int vf610_nfc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, static int vf610_nfc_write_oob(struct nand_chip *chip, int page)
int page)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
struct vf610_nfc *nfc = mtd_to_nfc(mtd); struct vf610_nfc *nfc = mtd_to_nfc(mtd);
int ret; int ret;
......
...@@ -630,8 +630,7 @@ static int spinand_erase_block(struct spi_device *spi_nand, u16 block_id) ...@@ -630,8 +630,7 @@ static int spinand_erase_block(struct spi_device *spi_nand, u16 block_id)
} }
#ifdef CONFIG_MTD_SPINAND_ONDIEECC #ifdef CONFIG_MTD_SPINAND_ONDIEECC
static int spinand_write_page_hwecc(struct mtd_info *mtd, static int spinand_write_page_hwecc(struct nand_chip *chip,
struct nand_chip *chip,
const u8 *buf, int oob_required, const u8 *buf, int oob_required,
int page) int page)
{ {
......
...@@ -654,23 +654,21 @@ struct nand_ecc_ctrl { ...@@ -654,23 +654,21 @@ struct nand_ecc_ctrl {
uint8_t *calc_ecc); uint8_t *calc_ecc);
int (*read_page_raw)(struct nand_chip *chip, uint8_t *buf, int (*read_page_raw)(struct nand_chip *chip, uint8_t *buf,
int oob_required, int page); int oob_required, int page);
int (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, int (*write_page_raw)(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page); int oob_required, int page);
int (*read_page)(struct nand_chip *chip, uint8_t *buf, int (*read_page)(struct nand_chip *chip, uint8_t *buf,
int oob_required, int page); int oob_required, int page);
int (*read_subpage)(struct nand_chip *chip, uint32_t offs, int (*read_subpage)(struct nand_chip *chip, uint32_t offs,
uint32_t len, uint8_t *buf, int page); uint32_t len, uint8_t *buf, int page);
int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip, int (*write_subpage)(struct nand_chip *chip, uint32_t offset,
uint32_t offset, uint32_t data_len, uint32_t data_len, const uint8_t *data_buf,
const uint8_t *data_buf, int oob_required, int page); int oob_required, int page);
int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, int (*write_page)(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page); int oob_required, int page);
int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, int (*write_oob_raw)(struct nand_chip *chip, int page);
int page);
int (*read_oob_raw)(struct nand_chip *chip, int page); int (*read_oob_raw)(struct nand_chip *chip, int page);
int (*read_oob)(struct nand_chip *chip, int page); int (*read_oob)(struct nand_chip *chip, int page);
int (*write_oob)(struct mtd_info *mtd, struct nand_chip *chip, int (*write_oob)(struct nand_chip *chip, int page);
int page);
}; };
/** /**
...@@ -1668,11 +1666,10 @@ int nand_ecc_choose_conf(struct nand_chip *chip, ...@@ -1668,11 +1666,10 @@ int nand_ecc_choose_conf(struct nand_chip *chip,
const struct nand_ecc_caps *caps, int oobavail); const struct nand_ecc_caps *caps, int oobavail);
/* Default write_oob implementation */ /* Default write_oob implementation */
int nand_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip, int page); int nand_write_oob_std(struct nand_chip *chip, int page);
/* Default write_oob syndrome implementation */ /* Default write_oob syndrome implementation */
int nand_write_oob_syndrome(struct mtd_info *mtd, struct nand_chip *chip, int nand_write_oob_syndrome(struct nand_chip *chip, int page);
int page);
/* Default read_oob implementation */ /* Default read_oob implementation */
int nand_read_oob_std(struct nand_chip *chip, int page); int nand_read_oob_std(struct nand_chip *chip, int page);
...@@ -1694,10 +1691,10 @@ int nand_read_page_raw_notsupp(struct nand_chip *chip, u8 *buf, ...@@ -1694,10 +1691,10 @@ int nand_read_page_raw_notsupp(struct nand_chip *chip, u8 *buf,
int oob_required, int page); int oob_required, int page);
/* Default write_page_raw implementation */ /* Default write_page_raw implementation */
int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, int nand_write_page_raw(struct nand_chip *chip, const uint8_t *buf,
const uint8_t *buf, int oob_required, int page); int oob_required, int page);
int nand_write_page_raw_notsupp(struct mtd_info *mtd, struct nand_chip *chip, int nand_write_page_raw_notsupp(struct nand_chip *chip, const u8 *buf,
const u8 *buf, int oob_required, int page); int oob_required, int page);
/* Reset and initialize a NAND device */ /* Reset and initialize a NAND device */
int nand_reset(struct nand_chip *chip, int chipnr); int nand_reset(struct nand_chip *chip, int chipnr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment