1 /* The maximum number of NAND chips in an array */
2 #define NAND_MAX_CHIPS 1
4 /* This constant declares the max. oobsize / page, which
5 * is supported now. If you add a chip with bigger oobsize/page
6 * adjust this accordingly.
8 #define NAND_MAX_OOBSIZE 64
9 #define NAND_MAX_PAGESIZE 2048
11 #define NAND_PAGESIZE_512B 512
12 #define NAND_PAGESIZE_2KB 2048
15 * struct nand_bbt_descr - bad block table descriptor
16 * @options: options for this descriptor
17 * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE
18 * when bbt is searched, then we store the found bbts pages here.
19 * Its an array and supports up to 8 chips now
20 * @offs: offset of the pattern in the oob area of the page
21 * @veroffs: offset of the bbt version counter in the oob are of the page
22 * @version: version read from the bbt page during scan
23 * @len: length of the pattern, if 0 no pattern check is performed
24 * @maxblocks: maximum number of blocks to search for a bbt. This number of
25 * blocks is reserved at the end of the device where the tables are
27 * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than
28 * bad) block in the stored bbt
29 * @pattern: pattern to identify bad block table or factory marked good /
30 * bad blocks, can be NULL, if len = 0
32 * Descriptor for the bad block table marker and the descriptor for the
33 * pattern which identifies good and bad blocks. The assumption is made
34 * that the pattern and the version count are always located in the oob area
37 struct nand_bbt_descr {
45 int reserved_block_code;
49 /* Options for the bad block table descriptors */
51 /* The number of bits used per block in the bbt on the device */
52 #define NAND_BBT_NRBITS_MSK 0x0000000F
53 #define NAND_BBT_1BIT 0x00000001
54 #define NAND_BBT_2BIT 0x00000002
55 #define NAND_BBT_4BIT 0x00000004
56 #define NAND_BBT_8BIT 0x00000008
57 /* The bad block table is in the last good block of the device */
58 #define NAND_BBT_LASTBLOCK 0x00000010
59 /* The bbt is at the given page, else we must scan for the bbt */
60 #define NAND_BBT_ABSPAGE 0x00000020
61 /* The bbt is at the given page, else we must scan for the bbt */
62 #define NAND_BBT_SEARCH 0x00000040
63 /* bbt is stored per chip on multichip devices */
64 #define NAND_BBT_PERCHIP 0x00000080
65 /* bbt has a version counter at offset veroffs */
66 #define NAND_BBT_VERSION 0x00000100
67 /* Create a bbt if none axists */
68 #define NAND_BBT_CREATE 0x00000200
69 /* Search good / bad pattern through all pages of a block */
70 #define NAND_BBT_SCANALLPAGES 0x00000400
71 /* Scan block empty during good / bad block scan */
72 #define NAND_BBT_SCANEMPTY 0x00000800
73 /* Write bbt if neccecary */
74 #define NAND_BBT_WRITE 0x00001000
75 /* Read and write back block contents when writing bbt */
76 #define NAND_BBT_SAVECONTENT 0x00002000
77 /* Search good / bad pattern on the first and the second page */
78 #define NAND_BBT_SCAN2NDPAGE 0x00004000
80 /* The maximum number of blocks to scan for a bbt */
81 #define NAND_BBT_SCAN_MAXBLOCKS 4