diff options
-rw-r--r-- | drivers/mtd/Kconfig | 13 | ||||
-rw-r--r-- | drivers/mtd/Makefile | 3 | ||||
-rw-r--r-- | drivers/mtd/chips/Kconfig | 1 | ||||
-rw-r--r-- | drivers/mtd/devices/Kconfig | 1 | ||||
-rw-r--r-- | drivers/mtd/mtdchar.c | 20 | ||||
-rw-r--r-- | drivers/mtd/mtdcore.c | 13 | ||||
-rw-r--r-- | drivers/mtd/mtdcore.h | 7 | ||||
-rw-r--r-- | drivers/mtd/onenand/Kconfig | 1 |
8 files changed, 19 insertions, 40 deletions
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index 557bec599f4f..5fab4e6e8301 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig | |||
@@ -157,19 +157,6 @@ config MTD_BCM47XX_PARTS | |||
157 | 157 | ||
158 | comment "User Modules And Translation Layers" | 158 | comment "User Modules And Translation Layers" |
159 | 159 | ||
160 | config MTD_CHAR | ||
161 | tristate "Direct char device access to MTD devices" | ||
162 | help | ||
163 | This provides a character device for each MTD device present in | ||
164 | the system, allowing the user to read and write directly to the | ||
165 | memory chips, and also use ioctl() to obtain information about | ||
166 | the device, or to erase parts of it. | ||
167 | |||
168 | config HAVE_MTD_OTP | ||
169 | bool | ||
170 | help | ||
171 | Enable access to OTP regions using MTD_CHAR. | ||
172 | |||
173 | config MTD_BLKDEVS | 160 | config MTD_BLKDEVS |
174 | tristate "Common interface to block layer for MTD 'translation layers'" | 161 | tristate "Common interface to block layer for MTD 'translation layers'" |
175 | depends on BLOCK | 162 | depends on BLOCK |
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile index 18a38e55b2f0..4cfb31e6c966 100644 --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | # Core functionality. | 5 | # Core functionality. |
6 | obj-$(CONFIG_MTD) += mtd.o | 6 | obj-$(CONFIG_MTD) += mtd.o |
7 | mtd-y := mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o | 7 | mtd-y := mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o mtdchar.o |
8 | 8 | ||
9 | obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o | 9 | obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o |
10 | obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o | 10 | obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o |
@@ -15,7 +15,6 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o | |||
15 | obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o | 15 | obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o |
16 | 16 | ||
17 | # 'Users' - code which presents functionality to userspace. | 17 | # 'Users' - code which presents functionality to userspace. |
18 | obj-$(CONFIG_MTD_CHAR) += mtdchar.o | ||
19 | obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o | 18 | obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o |
20 | obj-$(CONFIG_MTD_BLOCK) += mtdblock.o | 19 | obj-$(CONFIG_MTD_BLOCK) += mtdblock.o |
21 | obj-$(CONFIG_MTD_BLOCK_RO) += mtdblock_ro.o | 20 | obj-$(CONFIG_MTD_BLOCK_RO) += mtdblock_ro.o |
diff --git a/drivers/mtd/chips/Kconfig b/drivers/mtd/chips/Kconfig index c219e3d098d9..e4696b37f3de 100644 --- a/drivers/mtd/chips/Kconfig +++ b/drivers/mtd/chips/Kconfig | |||
@@ -146,7 +146,6 @@ config MTD_CFI_I8 | |||
146 | config MTD_OTP | 146 | config MTD_OTP |
147 | bool "Protection Registers aka one-time programmable (OTP) bits" | 147 | bool "Protection Registers aka one-time programmable (OTP) bits" |
148 | depends on MTD_CFI_ADV_OPTIONS | 148 | depends on MTD_CFI_ADV_OPTIONS |
149 | select HAVE_MTD_OTP | ||
150 | default n | 149 | default n |
151 | help | 150 | help |
152 | This enables support for reading, writing and locking so called | 151 | This enables support for reading, writing and locking so called |
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig index ec4a2cc3e9b5..2a4d55e4b362 100644 --- a/drivers/mtd/devices/Kconfig +++ b/drivers/mtd/devices/Kconfig | |||
@@ -71,7 +71,6 @@ config MTD_DATAFLASH_WRITE_VERIFY | |||
71 | config MTD_DATAFLASH_OTP | 71 | config MTD_DATAFLASH_OTP |
72 | bool "DataFlash OTP support (Security Register)" | 72 | bool "DataFlash OTP support (Security Register)" |
73 | depends on MTD_DATAFLASH | 73 | depends on MTD_DATAFLASH |
74 | select HAVE_MTD_OTP | ||
75 | help | 74 | help |
76 | Newer DataFlash chips (revisions C and D) support 128 bytes of | 75 | Newer DataFlash chips (revisions C and D) support 128 bytes of |
77 | one-time-programmable (OTP) data. The first half may be written | 76 | one-time-programmable (OTP) data. The first half may be written |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index c7292528c7bb..e0e59bf9b915 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -38,6 +38,8 @@ | |||
38 | 38 | ||
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | 40 | ||
41 | #include "mtdcore.h" | ||
42 | |||
41 | static DEFINE_MUTEX(mtd_mutex); | 43 | static DEFINE_MUTEX(mtd_mutex); |
42 | 44 | ||
43 | /* | 45 | /* |
@@ -365,7 +367,6 @@ static void mtdchar_erase_callback (struct erase_info *instr) | |||
365 | wake_up((wait_queue_head_t *)instr->priv); | 367 | wake_up((wait_queue_head_t *)instr->priv); |
366 | } | 368 | } |
367 | 369 | ||
368 | #ifdef CONFIG_HAVE_MTD_OTP | ||
369 | static int otp_select_filemode(struct mtd_file_info *mfi, int mode) | 370 | static int otp_select_filemode(struct mtd_file_info *mfi, int mode) |
370 | { | 371 | { |
371 | struct mtd_info *mtd = mfi->mtd; | 372 | struct mtd_info *mtd = mfi->mtd; |
@@ -395,9 +396,6 @@ static int otp_select_filemode(struct mtd_file_info *mfi, int mode) | |||
395 | 396 | ||
396 | return 0; | 397 | return 0; |
397 | } | 398 | } |
398 | #else | ||
399 | # define otp_select_filemode(f,m) -EOPNOTSUPP | ||
400 | #endif | ||
401 | 399 | ||
402 | static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd, | 400 | static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd, |
403 | uint64_t start, uint32_t length, void __user *ptr, | 401 | uint64_t start, uint32_t length, void __user *ptr, |
@@ -890,7 +888,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) | |||
890 | break; | 888 | break; |
891 | } | 889 | } |
892 | 890 | ||
893 | #ifdef CONFIG_HAVE_MTD_OTP | ||
894 | case OTPSELECT: | 891 | case OTPSELECT: |
895 | { | 892 | { |
896 | int mode; | 893 | int mode; |
@@ -946,7 +943,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) | |||
946 | ret = mtd_lock_user_prot_reg(mtd, oinfo.start, oinfo.length); | 943 | ret = mtd_lock_user_prot_reg(mtd, oinfo.start, oinfo.length); |
947 | break; | 944 | break; |
948 | } | 945 | } |
949 | #endif | ||
950 | 946 | ||
951 | /* This ioctl is being deprecated - it truncates the ECC layout */ | 947 | /* This ioctl is being deprecated - it truncates the ECC layout */ |
952 | case ECCGETLAYOUT: | 948 | case ECCGETLAYOUT: |
@@ -1242,7 +1238,7 @@ static struct file_system_type mtd_inodefs_type = { | |||
1242 | }; | 1238 | }; |
1243 | MODULE_ALIAS_FS("mtd_inodefs"); | 1239 | MODULE_ALIAS_FS("mtd_inodefs"); |
1244 | 1240 | ||
1245 | static int __init init_mtdchar(void) | 1241 | int __init init_mtdchar(void) |
1246 | { | 1242 | { |
1247 | int ret; | 1243 | int ret; |
1248 | 1244 | ||
@@ -1268,18 +1264,10 @@ err_unregister_chdev: | |||
1268 | return ret; | 1264 | return ret; |
1269 | } | 1265 | } |
1270 | 1266 | ||
1271 | static void __exit cleanup_mtdchar(void) | 1267 | void __exit cleanup_mtdchar(void) |
1272 | { | 1268 | { |
1273 | unregister_filesystem(&mtd_inodefs_type); | 1269 | unregister_filesystem(&mtd_inodefs_type); |
1274 | __unregister_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS, "mtd"); | 1270 | __unregister_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS, "mtd"); |
1275 | } | 1271 | } |
1276 | 1272 | ||
1277 | module_init(init_mtdchar); | ||
1278 | module_exit(cleanup_mtdchar); | ||
1279 | |||
1280 | MODULE_ALIAS_CHARDEV_MAJOR(MTD_CHAR_MAJOR); | ||
1281 | |||
1282 | MODULE_LICENSE("GPL"); | ||
1283 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); | ||
1284 | MODULE_DESCRIPTION("Direct character-device access to MTD devices"); | ||
1285 | MODULE_ALIAS_CHARDEV_MAJOR(MTD_CHAR_MAJOR); | 1273 | MODULE_ALIAS_CHARDEV_MAJOR(MTD_CHAR_MAJOR); |
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 91c2efd22e1f..71877ff77cbf 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/mtd/partitions.h> | 41 | #include <linux/mtd/partitions.h> |
42 | 42 | ||
43 | #include "mtdcore.h" | 43 | #include "mtdcore.h" |
44 | |||
44 | /* | 45 | /* |
45 | * backing device capabilities for non-mappable devices (such as NAND flash) | 46 | * backing device capabilities for non-mappable devices (such as NAND flash) |
46 | * - permits private mappings, copies are taken of the data | 47 | * - permits private mappings, copies are taken of the data |
@@ -96,11 +97,7 @@ EXPORT_SYMBOL_GPL(__mtd_next_device); | |||
96 | static LIST_HEAD(mtd_notifiers); | 97 | static LIST_HEAD(mtd_notifiers); |
97 | 98 | ||
98 | 99 | ||
99 | #if defined(CONFIG_MTD_CHAR) || defined(CONFIG_MTD_CHAR_MODULE) | ||
100 | #define MTD_DEVT(index) MKDEV(MTD_CHAR_MAJOR, (index)*2) | 100 | #define MTD_DEVT(index) MKDEV(MTD_CHAR_MAJOR, (index)*2) |
101 | #else | ||
102 | #define MTD_DEVT(index) 0 | ||
103 | #endif | ||
104 | 101 | ||
105 | /* REVISIT once MTD uses the driver model better, whoever allocates | 102 | /* REVISIT once MTD uses the driver model better, whoever allocates |
106 | * the mtd_info will probably want to use the release() hook... | 103 | * the mtd_info will probably want to use the release() hook... |
@@ -1185,8 +1182,15 @@ static int __init init_mtd(void) | |||
1185 | 1182 | ||
1186 | proc_mtd = proc_create("mtd", 0, NULL, &mtd_proc_ops); | 1183 | proc_mtd = proc_create("mtd", 0, NULL, &mtd_proc_ops); |
1187 | 1184 | ||
1185 | ret = init_mtdchar(); | ||
1186 | if (ret) | ||
1187 | goto out_procfs; | ||
1188 | |||
1188 | return 0; | 1189 | return 0; |
1189 | 1190 | ||
1191 | out_procfs: | ||
1192 | if (proc_mtd) | ||
1193 | remove_proc_entry("mtd", NULL); | ||
1190 | err_bdi3: | 1194 | err_bdi3: |
1191 | bdi_destroy(&mtd_bdi_ro_mappable); | 1195 | bdi_destroy(&mtd_bdi_ro_mappable); |
1192 | err_bdi2: | 1196 | err_bdi2: |
@@ -1200,6 +1204,7 @@ err_reg: | |||
1200 | 1204 | ||
1201 | static void __exit cleanup_mtd(void) | 1205 | static void __exit cleanup_mtd(void) |
1202 | { | 1206 | { |
1207 | cleanup_mtdchar(); | ||
1203 | if (proc_mtd) | 1208 | if (proc_mtd) |
1204 | remove_proc_entry("mtd", NULL); | 1209 | remove_proc_entry("mtd", NULL); |
1205 | class_unregister(&mtd_class); | 1210 | class_unregister(&mtd_class); |
diff --git a/drivers/mtd/mtdcore.h b/drivers/mtd/mtdcore.h index 9b10fed1ae2c..7b0353399a10 100644 --- a/drivers/mtd/mtdcore.h +++ b/drivers/mtd/mtdcore.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * These are exported solely for the purpose of mtd_blkdevs.c. You | 2 | * These are exported solely for the purpose of mtd_blkdevs.c and mtdchar.c. |
3 | * should not use them for _anything_ else. | 3 | * You should not use them for _anything_ else. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | extern struct mutex mtd_table_mutex; | 6 | extern struct mutex mtd_table_mutex; |
@@ -14,6 +14,9 @@ int parse_mtd_partitions(struct mtd_info *master, const char * const *types, | |||
14 | struct mtd_partition **pparts, | 14 | struct mtd_partition **pparts, |
15 | struct mtd_part_parser_data *data); | 15 | struct mtd_part_parser_data *data); |
16 | 16 | ||
17 | int __init init_mtdchar(void); | ||
18 | void __exit cleanup_mtdchar(void); | ||
19 | |||
17 | #define mtd_for_each_device(mtd) \ | 20 | #define mtd_for_each_device(mtd) \ |
18 | for ((mtd) = __mtd_next_device(0); \ | 21 | for ((mtd) = __mtd_next_device(0); \ |
19 | (mtd) != NULL; \ | 22 | (mtd) != NULL; \ |
diff --git a/drivers/mtd/onenand/Kconfig b/drivers/mtd/onenand/Kconfig index 91467bb03634..eac7bb28360d 100644 --- a/drivers/mtd/onenand/Kconfig +++ b/drivers/mtd/onenand/Kconfig | |||
@@ -40,7 +40,6 @@ config MTD_ONENAND_SAMSUNG | |||
40 | 40 | ||
41 | config MTD_ONENAND_OTP | 41 | config MTD_ONENAND_OTP |
42 | bool "OneNAND OTP Support" | 42 | bool "OneNAND OTP Support" |
43 | select HAVE_MTD_OTP | ||
44 | help | 43 | help |
45 | One Block of the NAND Flash Array memory is reserved as | 44 | One Block of the NAND Flash Array memory is reserved as |
46 | a One-Time Programmable Block memory area. | 45 | a One-Time Programmable Block memory area. |