diff options
Diffstat (limited to 'include/linux/mtd/nand.h')
| -rw-r--r-- | include/linux/mtd/nand.h | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index ccab9dfc5217..102e12c58cb3 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/include/linux/mtd/nand.h | 2 | * linux/include/linux/mtd/nand.h |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2000 David Woodhouse <dwmw2@infradead.org> | 4 | * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> |
| 5 | * Steven J. Hill <sjhill@realitydiluted.com> | 5 | * Steven J. Hill <sjhill@realitydiluted.com> |
| 6 | * Thomas Gleixner <tglx@linutronix.de> | 6 | * Thomas Gleixner <tglx@linutronix.de> |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
| @@ -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 |
| @@ -170,6 +182,12 @@ typedef enum { | |||
| 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 |
| 172 | 184 | ||
| 185 | /* Device is one of 'new' xD cards that expose fake nand command set */ | ||
| 186 | #define NAND_BROKEN_XD 0x00000400 | ||
| 187 | |||
| 188 | /* Device behaves just like nand, but is readonly */ | ||
| 189 | #define NAND_ROM 0x00000800 | ||
| 190 | |||
| 173 | /* Options valid for Samsung large page devices */ | 191 | /* Options valid for Samsung large page devices */ |
| 174 | #define NAND_SAMSUNG_LP_OPTIONS \ | 192 | #define NAND_SAMSUNG_LP_OPTIONS \ |
| 175 | (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) | 193 | (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) |
| @@ -391,6 +409,7 @@ struct nand_chip { | |||
| 391 | int subpagesize; | 409 | int subpagesize; |
| 392 | uint8_t cellinfo; | 410 | uint8_t cellinfo; |
| 393 | int badblockpos; | 411 | int badblockpos; |
| 412 | int badblockbits; | ||
| 394 | 413 | ||
| 395 | flstate_t state; | 414 | flstate_t state; |
| 396 | 415 | ||
