Commit 9118ea32 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by David Woodhouse

mtd: NAND: jz4740: Remove custom {read,write}_page handlers

Now that the mtd core supports more then 64 ecc bytes we can use it instead of
some a custom hack in the jz4740 nand driver.
This patch removes the custom {read,write}_page handlers from the jz4740 nand
driver. Thus the driver will now fallback to the default handlers from the nand
core.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent a338adaf
...@@ -251,58 +251,6 @@ static int jz_nand_correct_ecc_rs(struct mtd_info *mtd, uint8_t *dat, ...@@ -251,58 +251,6 @@ static int jz_nand_correct_ecc_rs(struct mtd_info *mtd, uint8_t *dat,
return 0; return 0;
} }
/* Copy paste of nand_read_page_hwecc_oob_first except for different eccpos
* handling. The ecc area is for 4k chips 72 bytes long and thus does not fit
* into the eccpos array. */
static int jz_nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
struct nand_chip *chip, uint8_t *buf, int page)
{
int i, eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes;
int eccsteps = chip->ecc.steps;
uint8_t *p = buf;
unsigned int ecc_offset = chip->page_shift;
/* Read the OOB area first */
chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
for (i = ecc_offset; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
int stat;
chip->ecc.hwctl(mtd, NAND_ECC_READ);
chip->read_buf(mtd, p, eccsize);
stat = chip->ecc.correct(mtd, p, &chip->oob_poi[i], NULL);
if (stat < 0)
mtd->ecc_stats.failed++;
else
mtd->ecc_stats.corrected += stat;
}
return 0;
}
/* Copy-and-paste of nand_write_page_hwecc with different eccpos handling. */
static void jz_nand_write_page_hwecc(struct mtd_info *mtd,
struct nand_chip *chip, const uint8_t *buf)
{
int i, eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes;
int eccsteps = chip->ecc.steps;
const uint8_t *p = buf;
unsigned int ecc_offset = chip->page_shift;
for (i = ecc_offset; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
chip->write_buf(mtd, p, eccsize);
chip->ecc.calculate(mtd, p, &chip->oob_poi[i]);
}
chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
}
#ifdef CONFIG_MTD_CMDLINE_PARTS #ifdef CONFIG_MTD_CMDLINE_PARTS
static const char *part_probes[] = {"cmdline", NULL}; static const char *part_probes[] = {"cmdline", NULL};
#endif #endif
...@@ -393,9 +341,6 @@ static int __devinit jz_nand_probe(struct platform_device *pdev) ...@@ -393,9 +341,6 @@ static int __devinit jz_nand_probe(struct platform_device *pdev)
chip->ecc.size = 512; chip->ecc.size = 512;
chip->ecc.bytes = 9; chip->ecc.bytes = 9;
chip->ecc.read_page = jz_nand_read_page_hwecc_oob_first;
chip->ecc.write_page = jz_nand_write_page_hwecc;
if (pdata) if (pdata)
chip->ecc.layout = pdata->ecc_layout; chip->ecc.layout = pdata->ecc_layout;
......
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