diff options
Diffstat (limited to 'include/linux/mtd/nand.h')
-rw-r--r-- | include/linux/mtd/nand.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index ccab9dfc5217..a81b185e23a7 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -25,11 +25,13 @@ | |||
25 | #include <linux/mtd/bbm.h> | 25 | #include <linux/mtd/bbm.h> |
26 | 26 | ||
27 | struct mtd_info; | 27 | struct mtd_info; |
28 | struct nand_flash_dev; | ||
28 | /* Scan and identify a NAND device */ | 29 | /* Scan and identify a NAND device */ |
29 | extern int nand_scan (struct mtd_info *mtd, int max_chips); | 30 | extern int nand_scan (struct mtd_info *mtd, int max_chips); |
30 | /* Separate phases of nand_scan(), allowing board driver to intervene | 31 | /* Separate phases of nand_scan(), allowing board driver to intervene |
31 | * and override command or ECC setup according to flash type */ | 32 | * and override command or ECC setup according to flash type */ |
32 | extern int nand_scan_ident(struct mtd_info *mtd, int max_chips); | 33 | extern int nand_scan_ident(struct mtd_info *mtd, int max_chips, |
34 | struct nand_flash_dev *table); | ||
33 | extern int nand_scan_tail(struct mtd_info *mtd); | 35 | extern int nand_scan_tail(struct mtd_info *mtd); |
34 | 36 | ||
35 | /* Free resources held by the NAND device */ | 37 | /* Free resources held by the NAND device */ |
@@ -38,6 +40,12 @@ extern void nand_release (struct mtd_info *mtd); | |||
38 | /* Internal helper for board drivers which need to override command function */ | 40 | /* Internal helper for board drivers which need to override command function */ |
39 | extern void nand_wait_ready(struct mtd_info *mtd); | 41 | extern void nand_wait_ready(struct mtd_info *mtd); |
40 | 42 | ||
43 | /* locks all blockes present in the device */ | ||
44 | extern int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | ||
45 | |||
46 | /* unlocks specified locked blockes */ | ||
47 | extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | ||
48 | |||
41 | /* The maximum number of NAND chips in an array */ | 49 | /* The maximum number of NAND chips in an array */ |
42 | #define NAND_MAX_CHIPS 8 | 50 | #define NAND_MAX_CHIPS 8 |
43 | 51 | ||
@@ -45,7 +53,7 @@ extern void nand_wait_ready(struct mtd_info *mtd); | |||
45 | * is supported now. If you add a chip with bigger oobsize/page | 53 | * is supported now. If you add a chip with bigger oobsize/page |
46 | * adjust this accordingly. | 54 | * adjust this accordingly. |
47 | */ | 55 | */ |
48 | #define NAND_MAX_OOBSIZE 128 | 56 | #define NAND_MAX_OOBSIZE 256 |
49 | #define NAND_MAX_PAGESIZE 4096 | 57 | #define NAND_MAX_PAGESIZE 4096 |
50 | 58 | ||
51 | /* | 59 | /* |
@@ -82,6 +90,10 @@ extern void nand_wait_ready(struct mtd_info *mtd); | |||
82 | #define NAND_CMD_ERASE2 0xd0 | 90 | #define NAND_CMD_ERASE2 0xd0 |
83 | #define NAND_CMD_RESET 0xff | 91 | #define NAND_CMD_RESET 0xff |
84 | 92 | ||
93 | #define NAND_CMD_LOCK 0x2a | ||
94 | #define NAND_CMD_UNLOCK1 0x23 | ||
95 | #define NAND_CMD_UNLOCK2 0x24 | ||
96 | |||
85 | /* Extended commands for large page devices */ | 97 | /* Extended commands for large page devices */ |
86 | #define NAND_CMD_READSTART 0x30 | 98 | #define NAND_CMD_READSTART 0x30 |
87 | #define NAND_CMD_RNDOUTSTART 0xE0 | 99 | #define NAND_CMD_RNDOUTSTART 0xE0 |
@@ -169,6 +181,14 @@ typedef enum { | |||
169 | #define NAND_NO_READRDY 0x00000100 | 181 | #define NAND_NO_READRDY 0x00000100 |
170 | /* Chip does not allow subpage writes */ | 182 | /* Chip does not allow subpage writes */ |
171 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 | 183 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 |
184 | /* Chip stores bad block marker on the last page of the eraseblock */ | ||
185 | #define NAND_BB_LAST_PAGE 0x00000400 | ||
186 | |||
187 | /* Device is one of 'new' xD cards that expose fake nand command set */ | ||
188 | #define NAND_BROKEN_XD 0x00000400 | ||
189 | |||
190 | /* Device behaves just like nand, but is readonly */ | ||
191 | #define NAND_ROM 0x00000800 | ||
172 | 192 | ||
173 | /* Options valid for Samsung large page devices */ | 193 | /* Options valid for Samsung large page devices */ |
174 | #define NAND_SAMSUNG_LP_OPTIONS \ | 194 | #define NAND_SAMSUNG_LP_OPTIONS \ |
@@ -391,6 +411,7 @@ struct nand_chip { | |||
391 | int subpagesize; | 411 | int subpagesize; |
392 | uint8_t cellinfo; | 412 | uint8_t cellinfo; |
393 | int badblockpos; | 413 | int badblockpos; |
414 | int badblockbits; | ||
394 | 415 | ||
395 | flstate_t state; | 416 | flstate_t state; |
396 | 417 | ||