diff options
author | Brian Norris <norris@broadcom.com> | 2010-07-15 15:15:44 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-08-02 04:09:06 -0400 |
commit | 58373ff0afff4cc8ac40608872995f4d87eb72ec (patch) | |
tree | cb697da3cc49ab4df73ad6427a3c9df8f1cab4b3 /include/linux/mtd | |
parent | c7b28e25cb9beb943aead770ff14551b55fa8c79 (diff) |
mtd: nand: more BB Detection refactoring and dynamic scan options
This is a revision to PATCH 2/2 that I sent. Link:
http://lists.infradead.org/pipermail/linux-mtd/2010-July/030911.html
Added new flag for scanning of both bytes 1 and 6 of the OOB for
a BB marker (instead of simply one or the other).
The "check_pattern" and "check_short_pattern" functions were updated
to include support for scanning the two different locations in the OOB.
In order to handle increases in variety of necessary scanning patterns,
I implemented dynamic memory allocation of nand_bbt_descr structs
in new function 'nand_create_default_bbt_descr()'. This replaces
some increasingly-unwieldy, statically-declared descriptors. It can
replace several more (e.g. "flashbased" structs). However, I do not
test the flashbased options personally.
How this was tested:
I referenced 30+ data sheets (covering 100+ parts), and I tested a
selection of 10 different chips to varying degrees. Particularly, I
tested the creation of bad-block descriptors and basic BB scanning on
three parts:
ST NAND04GW3B2D, 2K page
ST NAND128W3A, 512B page
Samsung K9F1G08U0A, 2K page
To test these, I wrote some fake bad block markers to the flash (in OOB
bytes 1, 6, and elsewhere) to see if the scanning routine would detect
them properly. However, this method was somewhat limited because the
driver I am using has some bugs in its OOB write functionality.
Signed-off-by: Brian Norris <norris@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r-- | include/linux/mtd/bbm.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index 8ad0b8629c3f..a04b962492a8 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h | |||
@@ -84,6 +84,10 @@ struct nand_bbt_descr { | |||
84 | #define NAND_BBT_SCAN2NDPAGE 0x00004000 | 84 | #define NAND_BBT_SCAN2NDPAGE 0x00004000 |
85 | /* Search good / bad pattern on the last page of the eraseblock */ | 85 | /* Search good / bad pattern on the last page of the eraseblock */ |
86 | #define NAND_BBT_SCANLASTPAGE 0x00008000 | 86 | #define NAND_BBT_SCANLASTPAGE 0x00008000 |
87 | /* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */ | ||
88 | #define NAND_BBT_SCANBYTE1AND6 0x00100000 | ||
89 | /* The nand_bbt_descr was created dynamicaly and must be freed */ | ||
90 | #define NAND_BBT_DYNAMICSTRUCT 0x00200000 | ||
87 | 91 | ||
88 | /* The maximum number of blocks to scan for a bbt */ | 92 | /* The maximum number of blocks to scan for a bbt */ |
89 | #define NAND_BBT_SCAN_MAXBLOCKS 4 | 93 | #define NAND_BBT_SCAN_MAXBLOCKS 4 |