diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2010-09-30 15:28:01 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-10-24 19:53:48 -0400 |
commit | 7cba7b14fe179969d7217cca52e28519d7d6ca89 (patch) | |
tree | 89d423a12c9f72d990b3e1a8fb394e08bbe2514b /include/linux/mtd | |
parent | df5b4e343c52fcdc54db3f9d07068c98cda6007b (diff) |
mtd: nand: add support for BBT without OOB
The first (sixt) byte in the OOB area contains vendor's bad block
information. During identification of the NAND chip this information is
collected by scanning the complete chip.
The option NAND_USE_FLASH_BBT is used to store this information in a sector so
we don't have to scan the complete flash. Unfortunately the code stores
a marker in order to recognize the BBT in the OOB area. This will fail
if the OOB area is completely used for ECC.
This patch introduces the option NAND_USE_FLASH_BBT_NO_OOB which has to be
used with NAND_USE_FLASH_BBT. It will then store BBT on flash without
touching the OOB area. The BBT format on flash remains same except the
first page starts with the recognition pattern followed by the version byte.
This change was tested in nandsim and it looks good so far :)
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r-- | include/linux/mtd/bbm.h | 2 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index 7fa20beb2ab9..ba15b525987d 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h | |||
@@ -102,6 +102,8 @@ struct nand_bbt_descr { | |||
102 | #define NAND_BBT_SCANBYTE1AND6 0x00100000 | 102 | #define NAND_BBT_SCANBYTE1AND6 0x00100000 |
103 | /* The nand_bbt_descr was created dynamicaly and must be freed */ | 103 | /* The nand_bbt_descr was created dynamicaly and must be freed */ |
104 | #define NAND_BBT_DYNAMICSTRUCT 0x00200000 | 104 | #define NAND_BBT_DYNAMICSTRUCT 0x00200000 |
105 | /* The bad block table does not OOB for marker */ | ||
106 | #define NAND_BBT_NO_OOB 0x00400000 | ||
105 | 107 | ||
106 | /* The maximum number of blocks to scan for a bbt */ | 108 | /* The maximum number of blocks to scan for a bbt */ |
107 | #define NAND_BBT_SCAN_MAXBLOCKS 4 | 109 | #define NAND_BBT_SCAN_MAXBLOCKS 4 |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 0f744547a48c..c0464d41f539 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -206,8 +206,10 @@ typedef enum { | |||
206 | #define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) | 206 | #define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) |
207 | 207 | ||
208 | /* Non chip related options */ | 208 | /* Non chip related options */ |
209 | /* Use a flash based bad block table. This option is passed to the | 209 | /* |
210 | * default bad block table function. */ | 210 | * Use a flash based bad block table. OOB identifier is saved in OOB area. |
211 | * This option is passed to the default bad block table function. | ||
212 | */ | ||
211 | #define NAND_USE_FLASH_BBT 0x00010000 | 213 | #define NAND_USE_FLASH_BBT 0x00010000 |
212 | /* This option skips the bbt scan during initialization. */ | 214 | /* This option skips the bbt scan during initialization. */ |
213 | #define NAND_SKIP_BBTSCAN 0x00020000 | 215 | #define NAND_SKIP_BBTSCAN 0x00020000 |
@@ -216,6 +218,11 @@ typedef enum { | |||
216 | #define NAND_OWN_BUFFERS 0x00040000 | 218 | #define NAND_OWN_BUFFERS 0x00040000 |
217 | /* Chip may not exist, so silence any errors in scan */ | 219 | /* Chip may not exist, so silence any errors in scan */ |
218 | #define NAND_SCAN_SILENT_NODEV 0x00080000 | 220 | #define NAND_SCAN_SILENT_NODEV 0x00080000 |
221 | /* | ||
222 | * If passed additionally to NAND_USE_FLASH_BBT then BBT code will not touch | ||
223 | * the OOB area. | ||
224 | */ | ||
225 | #define NAND_USE_FLASH_BBT_NO_OOB 0x00100000 | ||
219 | 226 | ||
220 | /* Options set by nand scan */ | 227 | /* Options set by nand scan */ |
221 | /* Nand scan has allocated controller struct */ | 228 | /* Nand scan has allocated controller struct */ |