[PATCH] mtd: fsl_elbc_nand: set NAND_NO_SUBPAGE_WRITE flag if using hardware ECC

From: Nikita Yushchenko
Date: Tue May 06 2014 - 05:15:14 EST


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.

Signed-off-by: Nikita Yushchenko <nyushchenko@xxxxxxxxxxxxx>
---
drivers/mtd/nand/fsl_elbc_nand.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index ec549cd..bb146a0 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -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;
--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/