[RFC/PATCH] mtd: m25p80: set writebufsize

Shmulik Ladkani shmulik.ladkani at gmail.com
Fri Feb 3 02:52:31 EST 2012


On Fri, 03 Feb 2012 08:14:56 +0200 Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> On Wed, 2012-02-01 at 11:11 +0200, Shmulik Ladkani wrote:
> > According to mtd.h, 'writebufsize' should be set to the "Size of the
> > write buffer used by the MTD".
> > 
> > m25p->page_size should be set to the size of the device's data buffer
> > (used by the Page Program operation).
> > 
> > Hence for m25p80, 'flash->mtd.writebufsize = flash->page_size' seems
> > right.
> > 
> > BTW 'writebufsize' is propagated to UBI's 'max_write_size' which
> > currently affects UBIFS write-buffer size.
> > 
> > It should be set to "the maximum amount of bytes the underlying flash is
> > able to program at a time" (according to ubifs/io.c).
> > 
> > Hence again, for m25p80, 'flash->page_size' seems adequate.
> 
> This parameter was introduced for NOR flashes, and in NAND flashes
> context it looks weird. Probably we could document this better. But
> basically, it describes how much data the driver is able to write at a
> time. All NAND drivers write only one page at a time, so this parameter
> should be set to NAND page size.

Sorry, prev message was vague.

Note m25p is Serial NOR Flash (its 'writesize' is set to 1, as it can be
programmed byte at a time).

m25p->page_size denotes the *maximum* number of bytes which can be
programmed using the "Page Program" instruction of the serial interface.

This number equals the size of the device's internal write buffer.
Which also means "the maximum amount of bytes the underlying flash is
able to program at a time".

(To be honest, this is correct for two m25p devices I've worked with,
according to their data sheets. I beleive it should be correct for other
m25p devices as well)

For these reasons, setting m25p's mtd.writebufsize to m25p->page_size is
adequate.

Regards
Shmulik



More information about the linux-mtd mailing list