NAND Flash Bad Block Management
NAND Flash Bad Block Management
freescale
semiconductor
TM
08 10, 2010
ABSTRACT:
This doc describe how to handle nand flash bad block with linux software
KEYWORDS: NAND BAD BLOCK BBI BBT
APPROVED:
AUTHOR COMMENTS
3. Incompatibility
Nand flash has the initial data lout which is main + spare area when it come out of factory.
Take 2KB + 64B MLC nand flash as example, the layout of nand flash is:
2112B total
512B main 16B 512B main 16B 512B main 16B 512B main 16B
So, the BBI of NAND flash out of factory is located in the main area of sections 4, as the
following shows,
512B main 16B 512B main 16B 512B main 16B 512B 16B
spare spare spare main spare
Here is the summery of the incompatibility between the NAND flash layout and the FSL
NFC data layout:
BBI of NAND flash out of factory is located in the data area of the last section of
NFC
BBI byte of NFC layout is not correct with large page NAND flash, it only
compatible with small page NAND flash
In order to solve the incompatibility above, we need take one solution to preserve the
BBI out of factory not be overriden by user data, the solution is called BBI swap.
“real” “free”
Page in use
512B main 16B 512B main 16B 512B main 16B 512B 16B
spare spare spare main spare
Section 1 Section 2 Section 3 Section 4
If run-time error occurs during write/erase, how to mark that block as bad
again? We may can't write to that block now
Performance – without BBTgiven large size of NAND, the scanning time will
become pretty significant.
Page in use
512B main 16B 512B main 16B 512B main 16B 512B 16B
spare spare spare main spare
Bad Block Table Store in one good block of the last 4 blocks.
There is one main table and one mirror table.
-3 -2 -1 -0
…….
Mirror Main
Issues:
The NAND data which written by old NAND driver will become corrupt when using the
new NAND driver. This is due to that one byte of user data written by old driver is
swapped to spare area and is replaced with 0xFF by new driver.
If the NAND flash contains the valid user data, please do the following,
As for the BBT table which created by old NAND driver. Currently, the BBT can’t be
erased by NAND driver, which means the BBT table, will remain there. The new driver
FREESCALE SEMICONDUCTOR INTERNAL USE ONLY
can recognize the BBT table and re-use it. But due to the BI swap, the bad block
information appears on the BBI offset will be swapped with 0xFF, which lead to any bad
block appears on this range will be taken as good block. This is very very rarely case and
if it’s unfortunately happen, the only we can do is to erase the bad block table with uboot
force erase function.
Recommendation:
Highly recommend using the BBI swap + BBT solutions for NAND flash bad block
management during mass production.