Commit df12a75a authored by Daniel Palmer's avatar Daniel Palmer Committed by Miquel Raynal
Browse files

mtd: spinand: core: Properly fill the OOB area.



The comment in spinand_write_to_cache_op() says that
spinand_ondie_ecc_prepare_io_req() should 0xff fill the OOB
area but it doesn't.

This causes the OOB area to get filled with zeros
and anytime the first page in a block the bad block marker
is cleared and it becomes a bad block on the next boot.

This was observed on Longsys FORSEE branded parts and
might be specific to these parts.

Signed-off-by: default avatarDaniel Palmer <daniel@0x0f.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210617110842.2358461-1-daniel@0x0f.com
parent 5c2f387b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -288,6 +288,8 @@ static int spinand_ondie_ecc_prepare_io_req(struct nand_device *nand,
	struct spinand_device *spinand = nand_to_spinand(nand);
	bool enable = (req->mode != MTD_OPS_RAW);

	memset(spinand->oobbuf, 0xff, nanddev_per_page_oobsize(nand));

	/* Only enable or disable the engine */
	return spinand_ecc_enable(spinand, enable);
}