[Patch 1/1] don't suspend erase for erase in cfi_cmdset_0002

Joakim Tjernlund joakim.tjernlund at transmode.se
Mon Aug 3 08:30:24 EDT 2009


Peter Wippich <pewi at gw-instruments.de> wrote on 03/08/2009 14:20:27:
>
> On Mon, 3 Aug 2009, Joakim Tjernlund wrote:
>
> >
> >
> > >
> > > >
> > > >
> > > > Hi,
> > > >
> > > > came around this problem while stress testing jffs2. From time to time the
> > > > block erase failed and the file system overflows. I don't know if there
> > > > are any Nor chips out there which allow a new erase to start when in erase
> > > > suspend. However, the chips on my board dont't. And even when it doesn't
> > > > make much sense to suspend an erase operation for another erase.
> > > >
> > > > Patch below fixes the problem for me.
> > > >
> > > > Have fun and take care,
> > > >
> > > > Peter
> > > >
> > > > Signed-off-by: Peter Wippich <pewi at gw-instruments.de>
> > > > ---
> > > > diff -Naur a/drivers/mtd/chips/cfi_cmdset_0002.c
> > > > b/drivers/mtd/chips/cfi_cmdset_0002.c
> > > > --- a/drivers/mtd/chips/cfi_cmdset_0002.c   2007-07-10 20:56:30.000000000 +0200
> > > > +++ b/drivers/mtd/chips/cfi_cmdset_0002.c   2009-08-02 19:55:34.000000000 +0200
> > > > @@ -521,6 +521,10 @@
> > > >     case FL_ERASING:
> > > >        if (mode == FL_WRITING) /* FIXME: Erase-suspend-program appears broken. */
> > > >           goto sleep;
> > > > +      if (mode == FL_ERASING) {
> > > > +         printk(KERN_INFO "attempt erase suspend with mode FL_ERASING\n") ;
> > > > +         goto sleep;
> > > > +      }
> > > >
> > > >        if (!(   mode == FL_READY
> > > >              || mode == FL_POINT
> > > >
> > >
> > > This change looks bogus. You are not supposed to need the extra test.
> > > I do think this test is faulty though:
> > >
> > >    if (!(   mode == FL_READY
> > >             || mode == FL_POINT
> > >             || !cfip
> > >             || (mode == FL_WRITING && (cfip->EraseSuspend & 0x2))
> > >             || (mode == FL_WRITING && (cfip->EraseSuspend & 0x1)
> > >           )))
> > >
> > > What happens if cfip is NULL?
> >
> > eeh, and what if erase suspend isn't supported at all?
> > Take a hint from cfi_cmdset_0001.c
>
> Just double checked the data sheet (it's a SST39VF6401B). Erase suspend is
> supported. And the suspend seems to work fine. Just the subsequent second
> erase during suspend seems to fail. In chip_good() at the end of the
> erase it reads 0x1985 ..... instead of 0xffff.
>
> Actually this continues for all blocks until the suspended erase is
> resumend. After that everything works fine again.

Well, I think something else is going on then. if cfip is non NULL(you better check
with a printk) that if should be true and you will end up in sleep, right?

>
> Will check the other issue you pointed out later on.
>
> Peter





More information about the linux-mtd mailing list