[PATCH] mtd: nand: Disable subpage writes for drivers without ecc->hwctl

Helmut Schaa helmut.schaa at googlemail.com
Wed Apr 9 03:06:12 PDT 2014


On Wed, Apr 9, 2014 at 11:38 AM, Gupta, Pekon <pekon at ti.com> wrote:
>>diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
>>index 9715a7b..2298289 100644
>>--- a/drivers/mtd/nand/nand_base.c
>>+++ b/drivers/mtd/nand/nand_base.c
>>@@ -3768,7 +3768,7 @@ int nand_scan_tail(struct mtd_info *mtd)
>>                       ecc->write_oob = nand_write_oob_std;
>>               if (!ecc->read_subpage)
>>                       ecc->read_subpage = nand_read_subpage;
>>-              if (!ecc->write_subpage)
>>+              if (!ecc->write_subpage && ecc->hwctl && ecc->calculate)
>
> I don't think this is correct because nand_write_subpage_hwecc() is a
> replaceable function (default generic implementation). So
>
> (1) if chip->ecc.hwctl() and chip->ecc.calculate are not implemented but you
>  still want to use subpage write feature, then you need to provide custom
>  implementation for chip->ecc.write_subpage().
>  that's same for other interfaces of nand_chip like chip->ecc.write_page().

But these don't cause panics :)

> (2) If you don't want to use subpage write feature then just disable it using
>         chip->options |= NAND_NO_SUBPAGE_WRITE;
>
> Can you please tell which NAND controller driver is causing this ?
> We need to fix that..

This happens with fsl_elbc_nand (while trying to run ubiformat on a
mtd dev) but the
crash was caused by the introduction of nand_write_subpage_hwecc. So, in this
case I think instead of trying to fix every possible driver we should
let the nand core
code handle this issue gracefully. Maybe we could add a WARN_ON_ONCE to
notice which drivers require adjustments.

Regards,
Helmut



More information about the linux-mtd mailing list