1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ****************************************************************************
11  ****************************************************************************/
12 #ifndef __LINUX_MTD_BBM_H
13 #define __LINUX_MTD_BBM_H
14 
15 #define NAND_MAX_CHIPS 8
16 
17 struct nand_bbt_descr {
18  int options;
19  int pages[NAND_MAX_CHIPS];
20  int offs;
21  int veroffs;
22  uint8_t version[NAND_MAX_CHIPS];
23  int len;
24  int maxblocks;
25  int reserved_block_code;
26  uint8_t *pattern;
27 };
28 
29 #define NAND_BBT_NRBITS_MSK 0x0000000F
30 #define NAND_BBT_1BIT 0x00000001
31 #define NAND_BBT_2BIT 0x00000002
32 #define NAND_BBT_4BIT 0x00000004
33 #define NAND_BBT_8BIT 0x00000008
34 
35 #define NAND_BBT_LASTBLOCK 0x00000010
36 
37 #define NAND_BBT_ABSPAGE 0x00000020
38 
39 #define NAND_BBT_SEARCH 0x00000040
40 
41 #define NAND_BBT_PERCHIP 0x00000080
42 
43 #define NAND_BBT_VERSION 0x00000100
44 
45 #define NAND_BBT_CREATE 0x00000200
46 
47 #define NAND_BBT_SCANALLPAGES 0x00000400
48 
49 #define NAND_BBT_SCANEMPTY 0x00000800
50 
51 #define NAND_BBT_WRITE 0x00001000
52 
53 #define NAND_BBT_SAVECONTENT 0x00002000
54 
55 #define NAND_BBT_SCAN2NDPAGE 0x00004000
56 
57 #define NAND_BBT_SCAN_MAXBLOCKS 4
58 
59 #define ONENAND_BADBLOCK_POS 0
60 
61 struct bbm_info {
62  int bbt_erase_shift;
63  int badblockpos;
64  int options;
65 
66  uint8_t *bbt;
67 
68  int (*isbad_bbt)(struct mtd_info *mtd, loff_t ofs, int allowbbt);
69 
70  struct nand_bbt_descr *badblock_pattern;
71 
72  void *priv;
73 };
74 
75 #endif
76