Skip to contentSkip to conversation

Bad Block management routine for MTD NandFlash driver?

DISCUSSION Jason Chan 2 participants 6 messages Jun 17, 2002 Memory technology devices (MTD)

lore
Share & tools
lore

Jason Chan

author
#0 lore raw

Hi all,
Any bad block management routine (eg. Invalid block table ) is
implemented for MTD NandFlash driver?
It seems that the ECC routine is not enough for my nandflash driver. And I need a more robust bad block management routine for that. Should I implement the invalid block table by myself, or there are some already implemented?

Signature · 4 lines
Best Regards,

Jason Chan
Emsoft Ltd.
#1 lore raw
Quoted 4 lines · [email protected] said:

Any bad block management routine (eg. Invalid block table ) is
implemented for MTD NandFlash driver? It seems that the ECC routine is not enough for my nandflash driver. And I need a more robust bad block management routine for that.

The low-level hardware driver does not implement and bad block management. That is done by whatever file system or translation layer you use on the flash. What are you intending to use? JFFS2?

--
dwmw2

author
#2 lore raw

David,
I trying to use EXT2 for my nandflash driver. Is that OK?

When I make a EXT2 file system on the nandflash driver, the mtd/nand/nand.c show a error message that "nand_erase: Failed erase", and it keep looping the same statement.

Since I may use other filesystem in the future, eg. CRAMFS or VFAT, I have no idea on the completeness of the filesystem on the bad block managment. So how can enable use the translation layer to manage my bad block?

Quoted 14 lines · David Woodhouse
Quoted 5 lines · [email protected] said:

Any bad block management routine (eg. Invalid block table ) is
implemented for MTD NandFlash driver? It seems that the ECC routine is not enough for my nandflash driver. And I need a more robust bad block management routine for that.

The low-level hardware driver does not implement and bad block management. That is done by whatever file system or translation layer you use on the flash. What are you intending to use? JFFS2?

--
dwmw2

Signature · 4 lines
Best Regards,

Jason Chan
Emsoft Ltd.
#3 lore raw
Quoted 1 line · [email protected] said:

I trying to use EXT2 for my nandflash driver. Is that OK?

No. You need _some_ kind of file system which is capable of dealing with flash -- either a real file system directly on the flash such as JFFS2, or a 'translation layer' like the SmartMedia one or NFTL if you really need to use ext2 for some reason.

--
dwmw2

author
#4 lore raw

David,
Sorry, I don't fully understand your 2nd suggestion, 'translation
layer' like the SmartMedia one.
Is that means the smartmedia mtd driver already has bad block management?

Quoted 11 lines · David Woodhouse
Quoted 2 lines · [email protected] said:

I trying to use EXT2 for my nandflash driver. Is that OK?

No. You need _some_ kind of file system which is capable of dealing with flash -- either a real file system directly on the flash such as JFFS2, or a 'translation layer' like the SmartMedia one or NFTL if you really need to use ext2 for some reason.

--
dwmw2

Signature · 4 lines
Best Regards,

Jason Chan
Emsoft Ltd.
#5 lore raw
Quoted 3 lines · [email protected] said:

Sorry, I don't fully understand your 2nd suggestion, 'translation
layer' like the SmartMedia one. Is that means the smartmedia mtd driver already has bad block management?

You need more than just bad block management. You need a complete file system, to give you wear levelling and reliable operation.

The 'mtdblock' driver is not meant for read/write use in normal circumstances. When you write a sector to the 'mtdblock' device, it reads the whole erase block from the flash, modifies the sector you wanted to change, erases the flash erase block and writes back the modified data.

If you lose power or crash between the erase and the writeback, you lose a whole erase block of data, not just the sector you were overwriting. And there's no wear levelling -- so some blocks will be worn to the point of destruction while others still have plenty of life.

You must have some kind of file system on the flash, whether that's a real file system such as JFFS2 or a pseudo-filesystem like SmartMedia or NFTL which emulates a block device, on top of which you put a 'normal' file system.

We don't yet have an implementation of the SmartMedia translation layer in CVS, although I think someone _has_ implemented it. NFTL has patent issues so I wouldn't advise using that. In fact, emulating a block device is the wrong approach entirely -- it's no longer justifiable now that we're not using DOS, and you should probably be using JFFS2.

JFFS2 recognises bad blocks during the medium scan at mount time, and does not keep a separate table of bad blocks. If this approach is insufficient, patches are welcome.

--
dwmw2