diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-20 17:50:31 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-20 17:50:31 -0400 |
| commit | be967b7e2f7747a5ebf2a07ee627d9338491e784 (patch) | |
| tree | f42b82601209a52b8ee478e36d8b21543ab03060 /include/linux/mtd | |
| parent | eef11427edcb821b63920219f89379fab84198b9 (diff) | |
| parent | 7bc3312bef4d6f220812500c0de7868fb7625a41 (diff) | |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (199 commits)
[MTD] NAND: Fix breakage all over the place
[PATCH] NAND: fix remaining OOB length calculation
[MTD] NAND Fixup NDFC merge brokeness
[MTD NAND] S3C2410 driver cleanup
[MTD NAND] s3c24x0 board: Fix clock handling, ensure proper initialisation.
[JFFS2] Check CRC32 on dirent and data nodes each time they're read
[JFFS2] When retiring nextblock, allocate a node_ref for the wasted space
[JFFS2] Mark XATTR support as experimental, for now
[JFFS2] Don't trust node headers before the CRC is checked.
[MTD] Restore MTD_ROM and MTD_RAM types
[MTD] assume mtd->writesize is 1 for NOR flashes
[MTD NAND] Fix s3c2410 NAND driver so it at least _looks_ like it compiles
[MTD] Prepare physmap for 64-bit-resources
[JFFS2] Fix more breakage caused by janitorial meddling.
[JFFS2] Remove stray __exit from jffs2_compressors_exit()
[MTD] Allow alternate JFFS2 mount variant for root filesystem.
[MTD] Disconnect struct mtd_info from ABI
[MTD] replace MTD_RAM with MTD_GENERIC_TYPE
[MTD] replace MTD_ROM with MTD_GENERIC_TYPE
[MTD] remove a forgotten MTD_XIP
...
Diffstat (limited to 'include/linux/mtd')
| -rw-r--r-- | include/linux/mtd/inftl.h | 2 | ||||
| -rw-r--r-- | include/linux/mtd/mtd.h | 97 | ||||
| -rw-r--r-- | include/linux/mtd/nand.h | 354 | ||||
| -rw-r--r-- | include/linux/mtd/ndfc.h | 67 | ||||
| -rw-r--r-- | include/linux/mtd/nftl.h | 2 | ||||
| -rw-r--r-- | include/linux/mtd/onenand.h | 11 | ||||
| -rw-r--r-- | include/linux/mtd/onenand_regs.h | 8 | ||||
| -rw-r--r-- | include/linux/mtd/partitions.h | 2 | ||||
| -rw-r--r-- | include/linux/mtd/physmap.h | 29 |
9 files changed, 366 insertions, 206 deletions
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h index d7eaa40e5ab0..6977780e548f 100644 --- a/include/linux/mtd/inftl.h +++ b/include/linux/mtd/inftl.h | |||
| @@ -46,7 +46,7 @@ struct INFTLrecord { | |||
| 46 | unsigned int nb_blocks; /* number of physical blocks */ | 46 | unsigned int nb_blocks; /* number of physical blocks */ |
| 47 | unsigned int nb_boot_blocks; /* number of blocks used by the bios */ | 47 | unsigned int nb_boot_blocks; /* number of blocks used by the bios */ |
| 48 | struct erase_info instr; | 48 | struct erase_info instr; |
| 49 | struct nand_oobinfo oobinfo; | 49 | struct nand_ecclayout oobinfo; |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | int INFTL_mount(struct INFTLrecord *s); | 52 | int INFTL_mount(struct INFTLrecord *s); |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index b6f2fdae65c6..e1d2a3d56546 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -56,18 +56,69 @@ struct mtd_erase_region_info { | |||
| 56 | u_int32_t numblocks; /* Number of blocks of erasesize in this region */ | 56 | u_int32_t numblocks; /* Number of blocks of erasesize in this region */ |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | /* | ||
| 60 | * oob operation modes | ||
| 61 | * | ||
| 62 | * MTD_OOB_PLACE: oob data are placed at the given offset | ||
| 63 | * MTD_OOB_AUTO: oob data are automatically placed at the free areas | ||
| 64 | * which are defined by the ecclayout | ||
| 65 | * MTD_OOB_RAW: mode to read raw data+oob in one chunk. The oob data | ||
| 66 | * is inserted into the data. Thats a raw image of the | ||
| 67 | * flash contents. | ||
| 68 | */ | ||
| 69 | typedef enum { | ||
| 70 | MTD_OOB_PLACE, | ||
| 71 | MTD_OOB_AUTO, | ||
| 72 | MTD_OOB_RAW, | ||
| 73 | } mtd_oob_mode_t; | ||
| 74 | |||
| 75 | /** | ||
| 76 | * struct mtd_oob_ops - oob operation operands | ||
| 77 | * @mode: operation mode | ||
| 78 | * | ||
| 79 | * @len: number of bytes to write/read. When a data buffer is given | ||
| 80 | * (datbuf != NULL) this is the number of data bytes. When | ||
| 81 | + no data buffer is available this is the number of oob bytes. | ||
| 82 | * | ||
| 83 | * @retlen: number of bytes written/read. When a data buffer is given | ||
| 84 | * (datbuf != NULL) this is the number of data bytes. When | ||
| 85 | + no data buffer is available this is the number of oob bytes. | ||
| 86 | * | ||
| 87 | * @ooblen: number of oob bytes per page | ||
| 88 | * @ooboffs: offset of oob data in the oob area (only relevant when | ||
| 89 | * mode = MTD_OOB_PLACE) | ||
| 90 | * @datbuf: data buffer - if NULL only oob data are read/written | ||
| 91 | * @oobbuf: oob data buffer | ||
| 92 | */ | ||
| 93 | struct mtd_oob_ops { | ||
| 94 | mtd_oob_mode_t mode; | ||
| 95 | size_t len; | ||
| 96 | size_t retlen; | ||
| 97 | size_t ooblen; | ||
| 98 | uint32_t ooboffs; | ||
| 99 | uint8_t *datbuf; | ||
| 100 | uint8_t *oobbuf; | ||
| 101 | }; | ||
| 102 | |||
| 59 | struct mtd_info { | 103 | struct mtd_info { |
| 60 | u_char type; | 104 | u_char type; |
| 61 | u_int32_t flags; | 105 | u_int32_t flags; |
| 62 | u_int32_t size; // Total size of the MTD | 106 | u_int32_t size; // Total size of the MTD |
| 63 | 107 | ||
| 64 | /* "Major" erase size for the device. Naïve users may take this | 108 | /* "Major" erase size for the device. Naïve users may take this |
| 65 | * to be the only erase size available, or may use the more detailed | 109 | * to be the only erase size available, or may use the more detailed |
| 66 | * information below if they desire | 110 | * information below if they desire |
| 67 | */ | 111 | */ |
| 68 | u_int32_t erasesize; | 112 | u_int32_t erasesize; |
| 113 | /* Minimal writable flash unit size. In case of NOR flash it is 1 (even | ||
| 114 | * though individual bits can be cleared), in case of NAND flash it is | ||
| 115 | * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR | ||
| 116 | * it is of ECC block size, etc. It is illegal to have writesize = 0. | ||
| 117 | * Any driver registering a struct mtd_info must ensure a writesize of | ||
| 118 | * 1 or larger. | ||
| 119 | */ | ||
| 120 | u_int32_t writesize; | ||
| 69 | 121 | ||
| 70 | u_int32_t oobblock; // Size of OOB blocks (e.g. 512) | ||
| 71 | u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) | 122 | u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) |
| 72 | u_int32_t ecctype; | 123 | u_int32_t ecctype; |
| 73 | u_int32_t eccsize; | 124 | u_int32_t eccsize; |
| @@ -79,7 +130,6 @@ struct mtd_info { | |||
| 79 | * MTD_PROGRAM_REGIONS flag is set. | 130 | * MTD_PROGRAM_REGIONS flag is set. |
| 80 | * (Maybe we should have an union for those?) | 131 | * (Maybe we should have an union for those?) |
| 81 | */ | 132 | */ |
| 82 | #define MTD_PROGREGION_SIZE(mtd) (mtd)->oobblock | ||
| 83 | #define MTD_PROGREGION_CTRLMODE_VALID(mtd) (mtd)->oobsize | 133 | #define MTD_PROGREGION_CTRLMODE_VALID(mtd) (mtd)->oobsize |
| 84 | #define MTD_PROGREGION_CTRLMODE_INVALID(mtd) (mtd)->ecctype | 134 | #define MTD_PROGREGION_CTRLMODE_INVALID(mtd) (mtd)->ecctype |
| 85 | 135 | ||
| @@ -87,9 +137,8 @@ struct mtd_info { | |||
| 87 | char *name; | 137 | char *name; |
| 88 | int index; | 138 | int index; |
| 89 | 139 | ||
| 90 | // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) | 140 | /* ecc layout structure pointer - read only ! */ |
| 91 | struct nand_oobinfo oobinfo; | 141 | struct nand_ecclayout *ecclayout; |
| 92 | u_int32_t oobavail; // Number of bytes in OOB area available for fs | ||
| 93 | 142 | ||
| 94 | /* Data for variable erase regions. If numeraseregions is zero, | 143 | /* Data for variable erase regions. If numeraseregions is zero, |
| 95 | * it means that the whole device has erasesize as given above. | 144 | * it means that the whole device has erasesize as given above. |
| @@ -112,11 +161,10 @@ struct mtd_info { | |||
| 112 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 161 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
| 113 | int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); | 162 | int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); |
| 114 | 163 | ||
| 115 | int (*read_ecc) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); | 164 | int (*read_oob) (struct mtd_info *mtd, loff_t from, |
| 116 | int (*write_ecc) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); | 165 | struct mtd_oob_ops *ops); |
| 117 | 166 | int (*write_oob) (struct mtd_info *mtd, loff_t to, | |
| 118 | int (*read_oob) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 167 | struct mtd_oob_ops *ops); |
| 119 | int (*write_oob) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); | ||
| 120 | 168 | ||
| 121 | /* | 169 | /* |
| 122 | * Methods to access the protection register area, present in some | 170 | * Methods to access the protection register area, present in some |
| @@ -130,17 +178,11 @@ struct mtd_info { | |||
| 130 | int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 178 | int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
| 131 | int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); | 179 | int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); |
| 132 | 180 | ||
| 133 | /* kvec-based read/write methods. We need these especially for NAND flash, | 181 | /* kvec-based read/write methods. |
| 134 | with its limited number of write cycles per erase. | ||
| 135 | NB: The 'count' parameter is the number of _vectors_, each of | 182 | NB: The 'count' parameter is the number of _vectors_, each of |
| 136 | which contains an (ofs, len) tuple. | 183 | which contains an (ofs, len) tuple. |
| 137 | */ | 184 | */ |
| 138 | int (*readv) (struct mtd_info *mtd, struct kvec *vecs, unsigned long count, loff_t from, size_t *retlen); | ||
| 139 | int (*readv_ecc) (struct mtd_info *mtd, struct kvec *vecs, unsigned long count, loff_t from, | ||
| 140 | size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel); | ||
| 141 | int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen); | 185 | int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen); |
| 142 | int (*writev_ecc) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, | ||
| 143 | size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel); | ||
| 144 | 186 | ||
| 145 | /* Sync */ | 187 | /* Sync */ |
| 146 | void (*sync) (struct mtd_info *mtd); | 188 | void (*sync) (struct mtd_info *mtd); |
| @@ -159,6 +201,9 @@ struct mtd_info { | |||
| 159 | 201 | ||
| 160 | struct notifier_block reboot_notifier; /* default mode before reboot */ | 202 | struct notifier_block reboot_notifier; /* default mode before reboot */ |
| 161 | 203 | ||
| 204 | /* ECC status information */ | ||
| 205 | struct mtd_ecc_stats ecc_stats; | ||
| 206 | |||
| 162 | void *priv; | 207 | void *priv; |
| 163 | 208 | ||
| 164 | struct module *owner; | 209 | struct module *owner; |
| @@ -192,20 +237,6 @@ int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, | |||
| 192 | int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs, | 237 | int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs, |
| 193 | unsigned long count, loff_t from, size_t *retlen); | 238 | unsigned long count, loff_t from, size_t *retlen); |
| 194 | 239 | ||
| 195 | #define MTD_ERASE(mtd, args...) (*(mtd->erase))(mtd, args) | ||
| 196 | #define MTD_POINT(mtd, a,b,c,d) (*(mtd->point))(mtd, a,b,c, (u_char **)(d)) | ||
| 197 | #define MTD_UNPOINT(mtd, arg) (*(mtd->unpoint))(mtd, (u_char *)arg) | ||
| 198 | #define MTD_READ(mtd, args...) (*(mtd->read))(mtd, args) | ||
| 199 | #define MTD_WRITE(mtd, args...) (*(mtd->write))(mtd, args) | ||
| 200 | #define MTD_READV(mtd, args...) (*(mtd->readv))(mtd, args) | ||
| 201 | #define MTD_WRITEV(mtd, args...) (*(mtd->writev))(mtd, args) | ||
| 202 | |||
