aboutsummaryrefslogtreecommitdiffstats
path: root/include/mtd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-20 17:50:31 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-20 17:50:31 -0400
commitbe967b7e2f7747a5ebf2a07ee627d9338491e784 (patch)
treef42b82601209a52b8ee478e36d8b21543ab03060 /include/mtd
parenteef11427edcb821b63920219f89379fab84198b9 (diff)
parent7bc3312bef4d6f220812500c0de7868fb7625a41 (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/mtd')
-rw-r--r--include/mtd/mtd-abi.h90
-rw-r--r--include/mtd/mtd-user.h1
2 files changed, 65 insertions, 26 deletions
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index b5994ea56a5a..ee2afbaefe1b 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -28,28 +28,17 @@ struct mtd_oob_buf {
28#define MTD_ROM 2 28#define MTD_ROM 2
29#define MTD_NORFLASH 3 29#define MTD_NORFLASH 3
30#define MTD_NANDFLASH 4 30#define MTD_NANDFLASH 4
31#define MTD_PEROM 5
32#define MTD_DATAFLASH 6 31#define MTD_DATAFLASH 6
33#define MTD_OTHER 14 32
34#define MTD_UNKNOWN 15 33#define MTD_WRITEABLE 0x400 /* Device is writeable */
35 34#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
36#define MTD_CLEAR_BITS 1 // Bits can be cleared (flash) 35#define MTD_NO_ERASE 0x1000 /* No erase necessary */
37#define MTD_SET_BITS 2 // Bits can be set
38#define MTD_ERASEABLE 4 // Has an erase function
39#define MTD_WRITEB_WRITEABLE 8 // Direct IO is possible
40#define MTD_VOLATILE 16 // Set for RAMs
41#define MTD_XIP 32 // eXecute-In-Place possible
42#define MTD_OOB 64 // Out-of-band data (NAND flash)
43#define MTD_ECC 128 // Device capable of automatic ECC
44#define MTD_NO_VIRTBLOCKS 256 // Virtual blocks not allowed
45#define MTD_PROGRAM_REGIONS 512 // Configurable Programming Regions
46 36
47// Some common devices / combinations of capabilities 37// Some common devices / combinations of capabilities
48#define MTD_CAP_ROM 0 38#define MTD_CAP_ROM 0
49#define MTD_CAP_RAM (MTD_CLEAR_BITS|MTD_SET_BITS|MTD_WRITEB_WRITEABLE) 39#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
50#define MTD_CAP_NORFLASH (MTD_CLEAR_BITS|MTD_ERASEABLE) 40#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
51#define MTD_CAP_NANDFLASH (MTD_CLEAR_BITS|MTD_ERASEABLE|MTD_OOB) 41#define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
52#define MTD_WRITEABLE (MTD_CLEAR_BITS|MTD_SET_BITS)
53 42
54 43
55// Types of automatic ECC/Checksum available 44// Types of automatic ECC/Checksum available
@@ -74,7 +63,7 @@ struct mtd_info_user {
74 uint32_t flags; 63 uint32_t flags;
75 uint32_t size; // Total size of the MTD 64 uint32_t size; // Total size of the MTD
76 uint32_t erasesize; 65 uint32_t erasesize;
77 uint32_t oobblock; // Size of OOB blocks (e.g. 512) 66 uint32_t writesize;
78 uint32_t oobsize; // Amount of OOB data per block (e.g. 16) 67 uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
79 uint32_t ecctype; 68 uint32_t ecctype;
80 uint32_t eccsize; 69 uint32_t eccsize;
@@ -94,12 +83,12 @@ struct otp_info {
94 uint32_t locked; 83 uint32_t locked;
95}; 84};
96 85
97#define MEMGETINFO _IOR('M', 1, struct mtd_info_user) 86#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
98#define MEMERASE _IOW('M', 2, struct erase_info_user) 87#define MEMERASE _IOW('M', 2, struct erase_info_user)
99#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) 88#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf)
100#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf) 89#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf)
101#define MEMLOCK _IOW('M', 5, struct erase_info_user) 90#define MEMLOCK _IOW('M', 5, struct erase_info_user)
102#define MEMUNLOCK _IOW('M', 6, struct erase_info_user) 91#define MEMUNLOCK _IOW('M', 6, struct erase_info_user)
103#define MEMGETREGIONCOUNT _IOR('M', 7, int) 92#define MEMGETREGIONCOUNT _IOR('M', 7, int)
104#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) 93#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
105#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo) 94#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo)
@@ -109,8 +98,15 @@ struct otp_info {
109#define OTPSELECT _IOR('M', 13, int) 98#define OTPSELECT _IOR('M', 13, int)
110#define OTPGETREGIONCOUNT _IOW('M', 14, int) 99#define OTPGETREGIONCOUNT _IOW('M', 14, int)
111#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info) 100#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
112#define OTPLOCK _IOR('M', 16, struct otp_info) 101#define OTPLOCK _IOR('M', 16, struct otp_info)
102#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout)
103#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
104#define MTDFILEMODE _IO('M', 19)
113 105
106/*
107 * Obsolete legacy interface. Keep it in order not to break userspace
108 * interfaces
109 */
114struct nand_oobinfo { 110struct nand_oobinfo {
115 uint32_t useecc; 111 uint32_t useecc;
116 uint32_t eccbytes; 112 uint32_t eccbytes;
@@ -118,4 +114,46 @@ struct nand_oobinfo {
118 uint32_t eccpos[32]; 114 uint32_t eccpos[32];
119}; 115};
120 116
117struct nand_oobfree {
118 uint32_t offset;
119 uint32_t length;
120};
121
122#define MTD_MAX_OOBFREE_ENTRIES 8
123/*
124 * ECC layout control structure. Exported to userspace for
125 * diagnosis and to allow creation of raw images
126 */
127struct nand_ecclayout {
128 uint32_t eccbytes;
129 uint32_t eccpos[64];
130 uint32_t oobavail;
131 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
132};
133
134/**
135 * struct mtd_ecc_stats - error correction status
136 *
137 * @corrected: number of corrected bits
138 * @failed: number of uncorrectable errors
139 * @badblocks: number of bad blocks in this partition
140 * @bbtblocks: number of blocks reserved for bad block tables
141 */
142struct mtd_ecc_stats {
143 uint32_t corrected;
144 uint32_t failed;
145 uint32_t badblocks;
146 uint32_t bbtblocks;
147};
148
149/*
150 * Read/write file modes for access to MTD
151 */
152enum mtd_file_modes {
153 MTD_MODE_NORMAL = MTD_OTP_OFF,
154 MTD_MODE_OTP_FACTORY = MTD_OTP_FACTORY,
155 MTD_MODE_OTP_USER = MTD_OTP_USER,
156 MTD_MODE_RAW,
157};
158
121#endif /* __MTD_ABI_H__ */ 159#endif /* __MTD_ABI_H__ */
diff --git a/include/mtd/mtd-user.h b/include/mtd/mtd-user.h
index 1c13fc7161fe..713f34d3e62e 100644
--- a/include/mtd/mtd-user.h
+++ b/include/mtd/mtd-user.h
@@ -16,5 +16,6 @@ typedef struct mtd_info_user mtd_info_t;
16typedef struct erase_info_user erase_info_t; 16typedef struct erase_info_user erase_info_t;
17typedef struct region_info_user region_info_t; 17typedef struct region_info_user region_info_t;
18typedef struct nand_oobinfo nand_oobinfo_t; 18typedef struct nand_oobinfo nand_oobinfo_t;
19typedef struct nand_ecclayout nand_ecclayout_t;
19 20
20#endif /* __MTD_USER_H__ */ 21#endif /* __MTD_USER_H__ */