diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-07 12:11:16 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-07 12:11:16 -0500 |
| commit | e0d65113a70f1dc514e625cc4e7a7485a4bf72df (patch) | |
| tree | 7320a130dc304623f5cf4b5dd8f67fb1776225ca /include | |
| parent | cf5e15fbd72c13977720aa15b7b7e00e1d8fd8f2 (diff) | |
| parent | 48e546b7f281f251893baa40769581fd15f085fb (diff) | |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (226 commits)
mtd: tests: annotate as DANGEROUS in Kconfig
mtd: tests: don't use mtd0 as a default
mtd: clean up usage of MTD_DOCPROBE_ADDRESS
jffs2: add compr=lzo and compr=zlib options
jffs2: implement mount option parsing and compression overriding
mtd: nand: initialize ops.mode
mtd: provide an alias for the redboot module name
mtd: m25p80: don't probe device which has status of 'disabled'
mtd: nand_h1900 never worked
mtd: Add DiskOnChip G3 support
mtd: m25p80: add EON flash EN25Q32B into spi flash id table
mtd: mark block device queue as non-rotational
mtd: r852: make r852_pm_ops static
mtd: m25p80: add support for at25df321a spi data flash
mtd: mxc_nand: preset_v1_v2: unlock all NAND flash blocks
mtd: nand: switch `check_pattern()' to standard `memcmp()'
mtd: nand: invalidate cache on unaligned reads
mtd: nand: do not scan bad blocks with NAND_BBT_NO_OOB set
mtd: nand: wait to set BBT version
mtd: nand: scrub BBT on ECC errors
...
Fix up trivial conflicts:
- arch/arm/mach-at91/board-usb-a9260.c
Merged into board-usb-a926x.c
- drivers/mtd/maps/lantiq-flash.c
add_mtd_partitions -> mtd_device_register vs changed to use
mtd_device_parse_register.
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/mtd/bbm.h | 39 | ||||
| -rw-r--r-- | include/linux/mtd/mtd.h | 82 | ||||
| -rw-r--r-- | include/linux/mtd/nand.h | 92 | ||||
| -rw-r--r-- | include/linux/mtd/onenand.h | 4 | ||||
| -rw-r--r-- | include/linux/mtd/partitions.h | 46 | ||||
| -rw-r--r-- | include/linux/mtd/physmap.h | 17 | ||||
| -rw-r--r-- | include/mtd/mtd-abi.h | 122 |
7 files changed, 229 insertions, 173 deletions
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index 57cc0e63714f..c4eec228eef9 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h | |||
| @@ -86,24 +86,39 @@ struct nand_bbt_descr { | |||
| 86 | #define NAND_BBT_VERSION 0x00000100 | 86 | #define NAND_BBT_VERSION 0x00000100 |
| 87 | /* Create a bbt if none exists */ | 87 | /* Create a bbt if none exists */ |
| 88 | #define NAND_BBT_CREATE 0x00000200 | 88 | #define NAND_BBT_CREATE 0x00000200 |
| 89 | /* | ||
| 90 | * Create an empty BBT with no vendor information. Vendor's information may be | ||
| 91 | * unavailable, for example, if the NAND controller has a different data and OOB | ||
| 92 | * layout or if this information is already purged. Must be used in conjunction | ||
| 93 | * with NAND_BBT_CREATE. | ||
| 94 | */ | ||
| 95 | #define NAND_BBT_CREATE_EMPTY 0x00000400 | ||
| 89 | /* Search good / bad pattern through all pages of a block */ | 96 | /* Search good / bad pattern through all pages of a block */ |
| 90 | #define NAND_BBT_SCANALLPAGES 0x00000400 | 97 | #define NAND_BBT_SCANALLPAGES 0x00000800 |
| 91 | /* Scan block empty during good / bad block scan */ | 98 | /* Scan block empty during good / bad block scan */ |
| 92 | #define NAND_BBT_SCANEMPTY 0x00000800 | 99 | #define NAND_BBT_SCANEMPTY 0x00001000 |
| 93 | /* Write bbt if neccecary */ | 100 | /* Write bbt if neccecary */ |
| 94 | #define NAND_BBT_WRITE 0x00001000 | 101 | #define NAND_BBT_WRITE 0x00002000 |
| 95 | /* Read and write back block contents when writing bbt */ | 102 | /* Read and write back block contents when writing bbt */ |
| 96 | #define NAND_BBT_SAVECONTENT 0x00002000 | 103 | #define NAND_BBT_SAVECONTENT 0x00004000 |
| 97 | /* Search good / bad pattern on the first and the second page */ | 104 | /* Search good / bad pattern on the first and the second page */ |
| 98 | #define NAND_BBT_SCAN2NDPAGE 0x00004000 | 105 | #define NAND_BBT_SCAN2NDPAGE 0x00008000 |
| 99 | /* Search good / bad pattern on the last page of the eraseblock */ | 106 | /* Search good / bad pattern on the last page of the eraseblock */ |
| 100 | #define NAND_BBT_SCANLASTPAGE 0x00008000 | 107 | #define NAND_BBT_SCANLASTPAGE 0x00010000 |
| 101 | /* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */ | 108 | /* |
| 102 | #define NAND_BBT_SCANBYTE1AND6 0x00100000 | 109 | * Use a flash based bad block table. By default, OOB identifier is saved in |
| 103 | /* The nand_bbt_descr was created dynamicaly and must be freed */ | 110 | * OOB area. This option is passed to the default bad block table function. |
| 104 | #define NAND_BBT_DYNAMICSTRUCT 0x00200000 | 111 | */ |
| 105 | /* The bad block table does not OOB for marker */ | 112 | #define NAND_BBT_USE_FLASH 0x00020000 |
| 106 | #define NAND_BBT_NO_OOB 0x00400000 | 113 | /* Do not store flash based bad block table in OOB area; store it in-band */ |
| 114 | #define NAND_BBT_NO_OOB 0x00040000 | ||
| 115 | |||
| 116 | /* | ||
| 117 | * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr | ||
| 118 | * was allocated dynamicaly and must be freed in nand_release(). Has no meaning | ||
| 119 | * in nand_chip.bbt_options. | ||
| 120 | */ | ||
| 121 | #define NAND_BBT_DYNAMICSTRUCT 0x80000000 | ||
| 107 | 122 | ||
| 108 | /* The maximum number of blocks to scan for a bbt */ | 123 | /* The maximum number of blocks to scan for a bbt */ |
| 109 | #define NAND_BBT_SCAN_MAXBLOCKS 4 | 124 | #define NAND_BBT_SCAN_MAXBLOCKS 4 |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 37be05bbfbc8..9f5b312af783 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -32,17 +32,19 @@ | |||
| 32 | #define MTD_CHAR_MAJOR 90 | 32 | #define MTD_CHAR_MAJOR 90 |
| 33 | #define MTD_BLOCK_MAJOR 31 | 33 | #define MTD_BLOCK_MAJOR 31 |
| 34 | 34 | ||
| 35 | #define MTD_ERASE_PENDING 0x01 | 35 | #define MTD_ERASE_PENDING 0x01 |
| 36 | #define MTD_ERASING 0x02 | 36 | #define MTD_ERASING 0x02 |
| 37 | #define MTD_ERASE_SUSPEND 0x04 | 37 | #define MTD_ERASE_SUSPEND 0x04 |
| 38 | #define MTD_ERASE_DONE 0x08 | 38 | #define MTD_ERASE_DONE 0x08 |
| 39 | #define MTD_ERASE_FAILED 0x10 | 39 | #define MTD_ERASE_FAILED 0x10 |
| 40 | 40 | ||
| 41 | #define MTD_FAIL_ADDR_UNKNOWN -1LL | 41 | #define MTD_FAIL_ADDR_UNKNOWN -1LL |
| 42 | 42 | ||
| 43 | /* If the erase fails, fail_addr might indicate exactly which block failed. If | 43 | /* |
| 44 | fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not | 44 | * If the erase fails, fail_addr might indicate exactly which block failed. If |
| 45 | specific to any particular block. */ | 45 | * fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level |
| 46 | * or was not specific to any particular block. | ||
| 47 | */ | ||
| 46 | struct erase_info { | 48 | struct erase_info { |
| 47 | struct mtd_info *mtd; | 49 | struct mtd_info *mtd; |
| 48 | uint64_t addr; | 50 | uint64_t addr; |
| @@ -59,26 +61,12 @@ struct erase_info { | |||
| 59 | }; | 61 | }; |
| 60 | 62 | ||
| 61 | struct mtd_erase_region_info { | 63 | struct mtd_erase_region_info { |
| 62 | uint64_t offset; /* At which this region starts, from the beginning of the MTD */ | 64 | uint64_t offset; /* At which this region starts, from the beginning of the MTD */ |
| 63 | uint32_t erasesize; /* For this region */ | 65 | uint32_t erasesize; /* For this region */ |
| 64 | uint32_t numblocks; /* Number of blocks of erasesize in this region */ | 66 | uint32_t numblocks; /* Number of blocks of erasesize in this region */ |
| 65 | unsigned long *lockmap; /* If keeping bitmap of locks */ | 67 | unsigned long *lockmap; /* If keeping bitmap of locks */ |
| 66 | }; | 68 | }; |
| 67 | 69 | ||
| 68 | /* | ||
| 69 | * oob operation modes | ||
| 70 | * | ||
| 71 | * MTD_OOB_PLACE: oob data are placed at the given offset | ||
| 72 | * MTD_OOB_AUTO: oob data are automatically placed at the free areas | ||
| 73 | * which are defined by the ecclayout | ||
| 74 | * MTD_OOB_RAW: mode to read oob and data without doing ECC checking | ||
| 75 | */ | ||
| 76 | typedef enum { | ||
| 77 | MTD_OOB_PLACE, | ||
| 78 | MTD_OOB_AUTO, | ||
| 79 | MTD_OOB_RAW, | ||
| 80 | } mtd_oob_mode_t; | ||
| 81 | |||
| 82 | /** | 70 | /** |
| 83 | * struct mtd_oob_ops - oob operation operands | 71 | * struct mtd_oob_ops - oob operation operands |
| 84 | * @mode: operation mode | 72 | * @mode: operation mode |
| @@ -90,7 +78,7 @@ typedef enum { | |||
| 90 | * @ooblen: number of oob bytes to write/read | 78 | * @ooblen: number of oob bytes to write/read |
| 91 | * @oobretlen: number of oob bytes written/read | 79 | * @oobretlen: number of oob bytes written/read |
| 92 | * @ooboffs: offset of oob data in the oob area (only relevant when | 80 | * @ooboffs: offset of oob data in the oob area (only relevant when |
| 93 | * mode = MTD_OOB_PLACE) | 81 | * mode = MTD_OPS_PLACE_OOB or MTD_OPS_RAW) |
| 94 | * @datbuf: data buffer - if NULL only oob data are read/written | 82 | * @datbuf: data buffer - if NULL only oob data are read/written |
| 95 | * @oobbuf: oob data buffer | 83 | * @oobbuf: oob data buffer |
| 96 | * | 84 | * |
| @@ -99,7 +87,7 @@ typedef enum { | |||
| 99 | * OOB area. | 87 | * OOB area. |
| 100 | */ | 88 | */ |
| 101 | struct mtd_oob_ops { | 89 | struct mtd_oob_ops { |
| 102 | mtd_oob_mode_t mode; | 90 | unsigned int mode; |
| 103 | size_t len; | 91 | size_t len; |
| 104 | size_t retlen; | 92 | size_t retlen; |
| 105 | size_t ooblen; | 93 | size_t ooblen; |
| @@ -173,7 +161,7 @@ struct mtd_info { | |||
| 173 | const char *name; | 161 | const char *name; |
| 174 | int index; | 162 | int index; |
| 175 | 163 | ||
| 176 | /* ecc layout structure pointer - read only ! */ | 164 | /* ECC layout structure pointer - read only! */ |
| 177 | struct nand_ecclayout *ecclayout; | 165 | struct nand_ecclayout *ecclayout; |
| 178 | 166 | ||
| 179 | /* Data for variable erase regions. If numeraseregions is zero, | 167 | /* Data for variable erase regions. If numeraseregions is zero, |
| @@ -324,10 +312,15 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd) | |||
| 324 | /* Kernel-side ioctl definitions */ | 312 | /* Kernel-side ioctl definitions */ |
| 325 | 313 | ||
| 326 | struct mtd_partition; | 314 | struct mtd_partition; |
| 327 | 315 | struct mtd_part_parser_data; | |
| 328 | extern int mtd_device_register(struct mtd_info *master, | 316 | |
| 329 | const struct mtd_partition *parts, | 317 | extern int mtd_device_parse_register(struct mtd_info *mtd, |
| 330 | int nr_parts); | 318 | const char **part_probe_types, |
| 319 | struct mtd_part_parser_data *parser_data, | ||
| 320 | const struct mtd_partition *defparts, | ||
| 321 | int defnr_parts); | ||
| 322 | #define mtd_device_register(master, parts, nr_parts) \ | ||
| 323 | mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) | ||
| 331 | extern int mtd_device_unregister(struct mtd_info *master); | 324 | extern int mtd_device_unregister(struct mtd_info *master); |
| 332 | extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); | 325 | extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); |
| 333 | extern int __get_mtd_device(struct mtd_info *mtd); | 326 | extern int __get_mtd_device(struct mtd_info *mtd); |
| @@ -356,27 +349,16 @@ void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size); | |||
| 356 | 349 | ||
| 357 | void mtd_erase_callback(struct erase_info *instr); | 350 | void mtd_erase_callback(struct erase_info *instr); |
| 358 | |||
