mtd.h (4b0708093e15b412296328bf81325cf9b69fe512) mtd.h (c45912d8abc52de796b9059a58faf7c4166eab58)
1/*
1/*
2 * $Id: mtd.h,v 1.61 2005/11/07 11:14:54 gleixner Exp $
3 *
4 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al.
5 *
6 * Released under GPL
7 */
8
9#ifndef __MTD_MTD_H__
10#define __MTD_MTD_H__
11

--- 115 unchanged lines hidden (view full) ---

127 * 1 or larger.
128 */
129 u_int32_t writesize;
130
131 u_int32_t oobsize; /* Amount of OOB data per block (e.g. 16) */
132 u_int32_t oobavail; /* Available OOB bytes per block */
133
134 /* Kernel-only stuff starts here. */
2 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al.
3 *
4 * Released under GPL
5 */
6
7#ifndef __MTD_MTD_H__
8#define __MTD_MTD_H__
9

--- 115 unchanged lines hidden (view full) ---

125 * 1 or larger.
126 */
127 u_int32_t writesize;
128
129 u_int32_t oobsize; /* Amount of OOB data per block (e.g. 16) */
130 u_int32_t oobavail; /* Available OOB bytes per block */
131
132 /* Kernel-only stuff starts here. */
135 char *name;
133 const char *name;
136 int index;
137
138 /* ecc layout structure pointer - read only ! */
139 struct nand_ecclayout *ecclayout;
140
141 /* Data for variable erase regions. If numeraseregions is zero,
142 * it means that the whole device has erasesize as given above.
143 */
144 int numeraseregions;
145 struct mtd_erase_region_info *eraseregions;
146
134 int index;
135
136 /* ecc layout structure pointer - read only ! */
137 struct nand_ecclayout *ecclayout;
138
139 /* Data for variable erase regions. If numeraseregions is zero,
140 * it means that the whole device has erasesize as given above.
141 */
142 int numeraseregions;
143 struct mtd_erase_region_info *eraseregions;
144
145 /*
146 * Erase is an asynchronous operation. Device drivers are supposed
147 * to call instr->callback() whenever the operation completes, even
148 * if it completes with a failure.
149 * Callers are supposed to pass a callback function and wait for it
150 * to be called before writing to the block.
151 */
147 int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
148
149 /* This stuff for eXecute-In-Place */
152 int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
153
154 /* This stuff for eXecute-In-Place */
150 int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf);
155 /* phys is optional and may be set to NULL */
156 int (*point) (struct mtd_info *mtd, loff_t from, size_t len,
157 size_t *retlen, void **virt, phys_addr_t *phys);
151
152 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
158
159 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
153 void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len);
160 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
154
155
156 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
157 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
158
161
162
163 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
164 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
165
166 /* In blackbox flight recorder like scenarios we want to make successful
167 writes in interrupt context. panic_write() is only intended to be
168 called when its known the kernel is about to panic and we need the
169 write to succeed. Since the kernel is not going to be running for much
170 longer, this function can break locks and delay to ensure the write
171 succeeds (but not sleep). */
172
173 int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
174
159 int (*read_oob) (struct mtd_info *mtd, loff_t from,
160 struct mtd_oob_ops *ops);
161 int (*write_oob) (struct mtd_info *mtd, loff_t to,
162 struct mtd_oob_ops *ops);
163
164 /*
165 * Methods to access the protection register area, present in some
166 * flash devices. The user data is one time programmable but the

--- 102 unchanged lines hidden (view full) ---

269
270#ifdef CONFIG_MTD_DEBUG
271#define MTDDEBUG(n, args...) \
272 do { \
273 if (n <= CONFIG_MTD_DEBUG_VERBOSE) \
274 printk(KERN_INFO args); \
275 } while(0)
276#else /* CONFIG_MTD_DEBUG */
175 int (*read_oob) (struct mtd_info *mtd, loff_t from,
176 struct mtd_oob_ops *ops);
177 int (*write_oob) (struct mtd_info *mtd, loff_t to,
178 struct mtd_oob_ops *ops);
179
180 /*
181 * Methods to access the protection register area, present in some
182 * flash devices. The user data is one time programmable but the

--- 102 unchanged lines hidden (view full) ---

285
286#ifdef CONFIG_MTD_DEBUG
287#define MTDDEBUG(n, args...) \
288 do { \
289 if (n <= CONFIG_MTD_DEBUG_VERBOSE) \
290 printk(KERN_INFO args); \
291 } while(0)
292#else /* CONFIG_MTD_DEBUG */
277#define MTDDEBUG(n, args...) do { } while(0)
293#define MTDDEBUG(n, args...) \
294 do { \
295 if (0) \
296 printk(KERN_INFO args); \
297 } while(0)
278#endif /* CONFIG_MTD_DEBUG */
279
280#endif /* __MTD_MTD_H__ */
298#endif /* CONFIG_MTD_DEBUG */
299
300#endif /* __MTD_MTD_H__ */