[PATCH RESEND] mtd: nand: allow NAND_NO_SUBPAGE_WRITE to be set from driver
Marek Vasut
marex at denx.de
Tue Jul 31 09:59:15 EDT 2012
Dear Matthieu CASTET,
> Hi Marek,
>
> Marek Vasut a écrit :
> > Dear Matthieu CASTET,
> >
> >> Hi,
> >>
> >> for ONFI flash (like this micron one) the information should be
> >> extracted form the ONFI table (programs_per_page IIRC)
> >>
> >> This should be better than relying on the SOC driver for setting this
> >> flags.
> >>
> >> Does the gpmi driver set this flag because it do not support partial
> >> write ?
> >
> > Yes
> >
> >> In this case why it doesn't set chip->ecc.steps to 1 ?
> >
> > Can you elabore how exactly will that help please?
>
> If you look at the nand_base.c, you will see that mtd->subpage_sft = 0 if
> NAND_NO_SUBPAGE_WRITE flags is set or chip->ecc.steps == 1 [1].
Ok, this is what I saw coming ... this is yet another hole in the design and I
see only undefined behavior. So if default: branch started returning an error,
this whole code will break again.
> [1]
> /* Allow subpage writes up to ecc.steps. Not possible for MLC flash */
> if (!(chip->options & NAND_NO_SUBPAGE_WRITE) &&
> !(chip->cellinfo & NAND_CI_CELLTYPE_MSK)) {
> switch (chip->ecc.steps) {
> case 2:
> mtd->subpage_sft = 1;
> break;
> case 4:
> case 8:
> case 16:
> mtd->subpage_sft = 2;
> break;
> }
> }
> chip->subpagesize = mtd->writesize >> mtd->subpage_sft;
Best regards,
Marek Vasut
More information about the linux-mtd
mailing list