mirror_ubuntu-kernels/include/linux/mtd
Brian Norris e2414f4c20 mtd: nand: write BBM to OOB even with flash-based BBT
Currently, the flash-based BBT implementation writes bad block data only
to its flash-based table and not to the OOB marker area. Then, as new bad
blocks are marked over time, the OOB markers become incomplete and the
flash-based table becomes the only source of current bad block
information. This becomes an obvious problem when, for example:

 * bootloader cannot read the flash-based BBT format
 * BBT is corrupted and the flash must be rescanned for bad
   blocks; we want to remember bad blocks that were marked from Linux

So to keep the bad block markers in sync with the flash-based BBT, this
patch changes the default so that we write bad block markers to the proper
OOB area on each block in addition to flash-based BBT. Comments are
updated, expanded, and/or relocated as necessary.

The new flash-based BBT procedure for marking bad blocks:
 (1) erase the affected block, to allow OOB marker to be written cleanly
 (2) update in-memory BBT
 (3) write bad block marker to OOB area of affected block
 (4) update flash-based BBT
Note that we retain the first error encountered in (3) or (4), finish the
procedures, and dump the error in the end.

This should handle power cuts gracefully enough. (1) and (2) are mostly
harmless (note that (1) will not erase an already-recognized bad block).
The OOB and BBT may be "out of sync" if we experience power loss bewteen
(3) and (4), but we can reasonably expect that on next boot, subsequent
I/O operations will discover that the block should be marked bad again,
thus re-syncing the OOB and BBT.

Note that this is a change from the previous default flash-based BBT
behavior. If your system cannot support writing bad block markers to OOB,
use the new NAND_BBT_NO_OOB_BBM option (in combination with
NAND_BBT_USE_FLASH and NAND_BBT_NO_OOB).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-03-27 00:27:02 +01:00
..
bbm.h mtd: nand: write BBM to OOB even with flash-based BBT 2012-03-27 00:27:02 +01:00
blktrans.h mtd: mtdblock: call mtd_sync() only if opened for write 2012-03-27 00:11:11 +01:00
cfi_endian.h mtd: cfi: Allow per-mapping CFI device endianness 2012-01-09 18:06:13 +00:00
cfi.h mtd: cfi: Allow per-mapping CFI device endianness 2012-01-09 18:06:13 +00:00
concat.h
doc2000.h
flashchip.h
fsmc.h
ftl.h
gen_probe.h
gpmi-nand.h mtd: fix compile error for gpmi-nand 2011-12-23 21:33:15 +05:30
inftl.h
latch-addr-flash.h
map.h mtd: map.h: fix arm cross-build failure 2012-01-09 18:24:34 +00:00
mtd.h mtd: add leading underscore to all mtd functions 2012-03-27 00:20:01 +01:00
mtdram.h
nand_bch.h
nand_ecc.h
nand-gpio.h
nand.h mtd: nand: correct comment on nand_chip badblockbits 2012-03-27 00:12:42 +01:00
ndfc.h
nftl.h
onenand_regs.h
onenand.h mtd: OneNAND: Detect the correct NOP when 4KiB pagesize 2011-09-11 15:02:13 +03:00
partitions.h mtd: remove put_partition_parser() from public header 2011-09-11 15:02:13 +03:00
pfow.h
physmap.h mtd: maps: physmap: allow partition parsers for physmap_flash_data 2012-01-09 18:16:15 +00:00
pismo.h
plat-ram.h
pmc551.h
qinfo.h
sh_flctl.h
sharpsl.h
spear_smi.h mtd: ST SPEAr: Add SMI driver for serial NOR flash 2012-03-27 00:14:16 +01:00
super.h
ubi.h
xip.h