Flash filesystem questions

Erik Ekman erik at kryo.se
Fri Jan 16 01:42:13 PST 2015


On Fri, Jan 16, 2015 at 10:33 AM, Ricard Wanderlof
<ricard.wanderlof at axis.com> wrote:
>
> On Thu, 15 Jan 2015, Erik Ekman wrote:
>
>> Next problem is bad blocks. I have not found anything in the hardware
>> that keeps track of them. I am thinking about using the first two
>> working blocks as maps, one u8 per erase block. Since I only have 8k,
>> 16k or 32k erase blocks it should not wear them out too much during
>> updates.
>
> Normally flashes never keep track of bad blocks themselves, except that
> bad blocks are usually marked as such during the manufacturing process,
> but it is completely up to software to make use of the that information.
>
>> Is this a valid strategy or is there a common smart solution?
>
> The mtd driver layer has a bad block table mechanism which does all this
> for you. (see nand_bbt.c). It just has to be enabled using a flag in the
> board driver.

I found that, but it requires the driver to be at the nand layer, I am just
implementing the MTD interface. I saw in some other threads in the list
that a generic bbt implementation might be needed (for SPI NAND, my
device, and Dan Ehrenberg).

My flash complains when writing or erasing to bad blocks, but reads
return no error. Is that the normal case? Should I try making a version
of nand_bbt.c for the more generic case?

/Erik



More information about the linux-mtd mailing list