[PATCH] mtd: rawnand: brcmnand: force raw OOB writes

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

 



MTD_OPS_AUTO_OOB is writting OOB with ECC enabled, which changes all ECC bytes
from an erased page to 0x00 when JFFS2 cleanmarkers are added with mtd-utils.
         | BBI |   JFFS2   |   ECC   |   JFFS2   | Spare  |
00000800  ff ff 19 85 20 03 00 00  00 00 00 00 08 ff ff ff

However, if OOB is written with ECC disabled, the JFFS2 cleanmarkers are
correctly written without changing the ECC bytes:
         | BBI |   JFFS2   |   ECC   |   JFFS2   | Spare  |
00000800  ff ff 19 85 20 03 ff ff  ff 00 00 00 08 ff ff ff

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

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 8f9ffb46a09f..566281770841 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -2279,13 +2279,6 @@ static int brcmnand_write_page_raw(struct nand_chip *chip, const uint8_t *buf,
 	return nand_prog_page_end_op(chip);
 }
 
-static int brcmnand_write_oob(struct nand_chip *chip, int page)
-{
-	return brcmnand_write(nand_to_mtd(chip), chip,
-			      (u64)page << chip->page_shift, NULL,
-			      chip->oob_poi);
-}
-
 static int brcmnand_write_oob_raw(struct nand_chip *chip, int page)
 {
 	struct mtd_info *mtd = nand_to_mtd(chip);
@@ -2642,7 +2635,7 @@ static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
 	chip->ecc.write_oob_raw = brcmnand_write_oob_raw;
 	chip->ecc.read_oob_raw = brcmnand_read_oob_raw;
 	chip->ecc.read_oob = brcmnand_read_oob;
-	chip->ecc.write_oob = brcmnand_write_oob;
+	chip->ecc.write_oob = brcmnand_write_oob_raw;
 
 	chip->controller = &ctrl->controller;
 
-- 
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