[PATCH] nand: raw: use write_oob_raw for MTD_OPS_AUTO_OOB mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some NAND controllers change the ECC bytes when OOB is written with ECC
enabled.
This is a problem in brcmnand, since adding JFFS2 cleanmarkers after the page
has been erased will change the ECC bytes to 0 and the controller will think
the block is bad.
It can be fixed by using write_oob_raw, which ensures ECC is disabled.

Signed-off-by: Álvaro Fernández Rojas <noltari@xxxxxxxxx>
---
 drivers/mtd/nand/raw/nand_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index c24e5e2ba130..755d25200520 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -488,7 +488,7 @@ static int nand_do_write_oob(struct nand_chip *chip, loff_t to,
 
 	nand_fill_oob(chip, ops->oobbuf, ops->ooblen, ops);
 
-	if (ops->mode == MTD_OPS_RAW)
+	if (ops->mode == MTD_OPS_AUTO_OOB || ops->mode == MTD_OPS_RAW)
 		status = chip->ecc.write_oob_raw(chip, page & chip->pagemask);
 	else
 		status = chip->ecc.write_oob(chip, page & chip->pagemask);
-- 
2.26.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux