public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Question on mtd devices with zero erasesize
@ 2017-12-06 13:28 Antonio Borneo
  2017-12-07  9:34 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Borneo @ 2017-12-06 13:28 UTC (permalink / raw)
  To: linux-mtd; +Cc: Antonio Borneo

Hi,
I have searched in the mailing list archives but didn't found such topic.

In mainline kernel there are already few RAM based mtd devices; the
concept of "erase unit" (sector or page) does not always apply to
them.
At least two of such devices set the field "erasesize" to zero (or,
better, do not set it at all and left it to zero):
- drivers/mtd/devices/ms02-nv.c
- drivers/mtd/devices/mchp23k256.c

The following is tested with mchp23k256 only.
Of course I read zero from /sys/class/mtd/mtdX/erasesize
The tool mdtinfo core-dumps for division by zero when it try to
compute the number of erase units by dividing device size by
erasesize.

What would be the proper fix?

First of all, is erasesize=1 correct in this case, or for some reason
it is better to use another value?

Then, is the driver that is supposed to provide a non-zero value for erasesize?
Or is the mtd framework that should check the value set by the driver
and eventually replace it with a minimum erasesize?
Or is the userland that has to accept the zero value?

Thanks and Best Regards,
Antonio Borneo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-07  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-06 13:28 Question on mtd devices with zero erasesize Antonio Borneo
2017-12-07  9:34 ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox