qcom: nand: fix NAND dummy spare area programming

NAND_CMD_PRG_PAGE_ALL uses the spare data from buffer itself
which is not applicable. The spare area in NAND page for
QPIC are dummy bytes so 0xff should be written to these
spare area. NAND_CMD_PRG_PAGE does the same thing and HLOS
driver uses this command for all page program
operations.  The actual spare data is being written along
with every codeword since the codewords size is 516 in which
512 bytes are user data and 4 bytes are spare data.

Change-Id: I5651caf5ea95f046570e8318f59e140398869ece
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
This commit is contained in:
Abhishek Sahu 2017-06-26 14:18:00 +05:30 committed by Gerrit - the friendly Code Review server
parent 25137add04
commit 98c1c8e9db

View file

@ -1220,13 +1220,12 @@ qpic_nand_write_page(struct mtd_info *mtd, uint32_t pg_addr,
if (cfg_mode == NAND_CFG_RAW) {
cfg.cfg0 = dev->cfg0_raw;
cfg.cfg1 = dev->cfg1_raw;
cfg.cmd = NAND_CMD_PRG_PAGE;
} else {
cfg.cfg0 = dev->cfg0;
cfg.cfg1 = dev->cfg1;
cfg.cmd = NAND_CMD_PRG_PAGE_ALL;
}
cfg.cmd = NAND_CMD_PRG_PAGE;
cfg.exec = 1;
cfg.addr0 = pg_addr << 16;
@ -1900,11 +1899,12 @@ static uint8_t *qpic_nand_write_oobbuf(struct mtd_info *mtd,
size_t write_ooblen;
struct qpic_nand_dev *dev = MTD_QPIC_NAND_DEV(mtd);
memset(dev->pad_oob, 0xFF, dev->oob_per_page);
if (ops->oobbuf == NULL)
return dev->pad_oob;
write_ooblen = ops->ooblen - ops->oobretlen;
memset(dev->pad_oob, 0xFF, dev->oob_per_page);
if (write_ooblen < dev->oob_per_page) {
memcpy(dev->pad_oob, ops->oobbuf + ops->oobretlen, write_ooblen);