summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdraw.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-02-25 12:34:53 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-07-22 16:13:44 +0200
commit278c16713af88748e658f788d0142adfdd904991 (patch)
tree85a4d87b631be7c94fcab4f248450e4cde7d07e5 /drivers/mtd/mtdraw.c
parent4a98bf1a0b6f0632ed9d9e04fdd129fa5f26b86c (diff)
downloadbarebox-278c16713af88748e658f788d0142adfdd904991.tar.gz
barebox-278c16713af88748e658f788d0142adfdd904991.tar.xz
mtd: nand: write BBM to OOB even with flash-based BBT
This is based on Linux: commit e2414f4c20bd4dc62186fbfd7bdec50bce6d2ead Author: Brian Norris <computersforpeace@gmail.com> Date: Mon Feb 6 13:44:00 2012 -0800 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: * code accessing the flash 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. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/mtdraw.c')
0 files changed, 0 insertions, 0 deletions