Re: [PATCH v2 2/6] mtd: cfi: add writebufsize initialization

Anatolij Gustschin
2011-01-06T10:49:08Z

On Mon, 20 Dec 2010 17:36:57 +0100
Guillaume LECERF <glecerf@gmail.com> wrote:

> Hello.

Hello.

> 2010/12/16 Anatolij Gustschin <agust@denx.de>:
> > Initialize mtd->writebufsize to the value obtained
> > by CFI query command at probe time.
> >
> > Signed-off-by: Anatolij Gustschin <agust@denx.de>
> > ---
> > --- a/drivers/mtd/chips/cfi_cmdset_0002.c
> > +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
> > @@ -428,6 +428,10 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
> >        mtd->flags   = MTD_CAP_NORFLASH;
> >        mtd->name    = map->name;
> >        mtd->writesize = 1;
> > +       mtd->writebufsize = 1 << cfi->cfiq->MaxBufWriteSize;
>
> What about wbufsize initialized in cfi_amdstd_write_buffers() to
> "cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize" ?
> I don't know this piece of code, but I just wanted to point it to you.

wbufsize is initialized there so that it takes into account the
chip interleaving. If we e.g. have 64 byte write buffer in each
chip and two 16-bit chips in 32-bit bank, the wbufsize will be
initialized to 128 since the cfi_interleave(cfi) will return 2 in
this case. It is really local to the cfi driver. For UBI to work
correctly we need to export the the real physical write buffer size
of one chip, nothing else. So my patch is correct.

Anatolij