Skip to contentSkip to conversation

mtd: fsl_elbc_nand: set NAND_NO_SUBPAGE_WRITE flag if using hardware ECC

PATCH In review Nikita Yushchenko 2 participants 2 messages May 6, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: fsl_elbc_nand: set NAND_NO_SUBPAGE_WRITE flag if using hardware ECC

Per MPC8572E manual, sec 14.4.3.1.3: "Transfers shorter than a full page, however, require software to prepare the appropriate ECC in the spare region"

Need to set NAND_NO_SUBPAGE_WRITE flag. If this is not done, then generic nand_write_subpage_hwecc() is called instead of driver's write routine, which results into OOPS dereferencing NULL chip->ecc.hwctl pointer.

---
 drivers/mtd/nand/fsl_elbc_nand.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/nand/fsl_elbc_nand.c +2 -0
index ec549cd..bb146a0 100644
@@ -766,6 +766,8 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
 	if ((in_be32(&lbc->bank[priv->bank].br) & BR_DECC) ==
 	    BR_DECC_CHK_GEN) {
 		chip->ecc.mode = NAND_ECC_HW;
+		/* hardware can't calculate ECC for subpages */
+		chip->options |= NAND_NO_SUBPAGE_WRITE;
 		/* put in small page settings and adjust later if needed */
 		chip->ecc.layout = (priv->fmr & FMR_ECCM) ?
 				&fsl_elbc_oob_sp_eccm1 : &fsl_elbc_oob_sp_eccm0;
Signature · 1 line
1.7.10.4
#1 lore raw

Hi Nikita,

Quoted 6 lines

From: Nikita Yushchenko

Per MPC8572E manual, sec 14.4.3.1.3: "Transfers shorter than a full page, however, require software to prepare the appropriate ECC in the spare region"

Quoted 7 lines

Need to set NAND_NO_SUBPAGE_WRITE flag. If this is not done, then generic nand_write_subpage_hwecc() is called instead of driver's write routine, which results into OOPS dereferencing NULL chip->ecc.hwctl pointer.

---

This one is already solved.

Please refer below discussion and its previous thread on why NAND_NO_SUBPAGE_WRITE should _not_ be set, because it breaks compatibility with older UBIFS images.

http://lists.infradead.org/pipermail/linux-mtd/2014-April/053262.html

Also below is the appropriate fix without breaking backward compatibility.
http://lists.infradead.org/pipermail/linux-mtd/2014-May/053745.html

with regards, pekon