1 /****************************************************************************
2 ****************************************************************************
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
10 ****************************************************************************
11 ****************************************************************************/
15 #error This is a kernel header. Perhaps include mtd-user.h instead?
17 #include <linux/types.h>
18 #include <linux/module.h>
19 #include <linux/uio.h>
20 #include <linux/notifier.h>
22 #include <linux/mtd/compatmac.h>
23 #include <mtd/mtd-abi.h>
25 #define MTD_CHAR_MAJOR 90
26 #define MTD_BLOCK_MAJOR 31
27 #define MAX_MTD_DEVICES 16
29 #define MTD_ERASE_PENDING 0x01
30 #define MTD_ERASING 0x02
31 #define MTD_ERASE_SUSPEND 0x04
32 #define MTD_ERASE_DONE 0x08
33 #define MTD_ERASE_FAILED 0x10
44 void (*callback) (struct erase_info *self);
47 struct erase_info *next;
50 struct mtd_erase_region_info {
85 #define MTD_PROGREGION_CTRLMODE_VALID(mtd) (mtd)->oobsize
86 #define MTD_PROGREGION_CTRLMODE_INVALID(mtd) (mtd)->ecctype
91 struct nand_ecclayout *ecclayout;
94 struct mtd_erase_region_info *eraseregions;
98 int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
100 int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf);
102 void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len);
104 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
105 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
107 int (*read_oob) (struct mtd_info *mtd, loff_t from,
108 struct mtd_oob_ops *ops);
109 int (*write_oob) (struct mtd_info *mtd, loff_t to,
110 struct mtd_oob_ops *ops);
112 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len);
113 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
114 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len);
115 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
116 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
117 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len);
119 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen);
121 void (*sync) (struct mtd_info *mtd);
123 int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len);
124 int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len);
126 int (*suspend) (struct mtd_info *mtd);
127 void (*resume) (struct mtd_info *mtd);
129 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs);
130 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs);
132 struct notifier_block reboot_notifier;
134 struct mtd_ecc_stats ecc_stats;
138 struct module *owner;
142 struct mtd_notifier {
143 void (*add)(struct mtd_info *mtd);
144 void (*remove)(struct mtd_info *mtd);
145 struct list_head list;
148 #define MTD_DEBUG_LEVEL0 (0)
149 #define MTD_DEBUG_LEVEL1 (1)
150 #define MTD_DEBUG_LEVEL2 (2)
151 #define MTD_DEBUG_LEVEL3 (3)
152 #define DEBUG(n, args...) do { } while(0)