aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/maps/Kconfig7
-rw-r--r--drivers/mtd/maps/Makefile1
-rw-r--r--drivers/mtd/maps/autcpu12-nvram.c129
-rw-r--r--drivers/mtd/mtdchar.c20
-rw-r--r--drivers/mtd/mtdcore.c2
-rw-r--r--drivers/mtd/nand/Kconfig2
-rw-r--r--drivers/mtd/nand/lpc32xx_mlc.c5
-rw-r--r--drivers/mtd/ubi/build.c2
-rw-r--r--drivers/mtd/ubi/cdev.c26
9 files changed, 5 insertions, 189 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index bed9d58d5741..8b27ca054c59 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -297,13 +297,6 @@ config MTD_IXP4XX
297 IXDP425 and Coyote. If you have an IXP4xx based board and 297 IXDP425 and Coyote. If you have an IXP4xx based board and
298 would like to use the flash chips on it, say 'Y'. 298 would like to use the flash chips on it, say 'Y'.
299 299
300config MTD_AUTCPU12
301 bool "NV-RAM mapping AUTCPU12 board"
302 depends on ARCH_AUTCPU12
303 help
304 This enables access to the NV-RAM on autronix autcpu12 board.
305 If you have such a board, say 'Y'.
306
307config MTD_IMPA7 300config MTD_IMPA7
308 tristate "JEDEC Flash device mapped on impA7" 301 tristate "JEDEC Flash device mapped on impA7"
309 depends on ARM && MTD_JEDECPROBE 302 depends on ARM && MTD_JEDECPROBE
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
index 395a12444048..9fdbd4ba6441 100644
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -32,7 +32,6 @@ obj-$(CONFIG_MTD_VMAX) += vmax301.o
32obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o 32obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o
33obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o 33obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
34obj-$(CONFIG_MTD_PCI) += pci.o 34obj-$(CONFIG_MTD_PCI) += pci.o
35obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o
36obj-$(CONFIG_MTD_IMPA7) += impa7.o 35obj-$(CONFIG_MTD_IMPA7) += impa7.o
37obj-$(CONFIG_MTD_UCLINUX) += uclinux.o 36obj-$(CONFIG_MTD_UCLINUX) += uclinux.o
38obj-$(CONFIG_MTD_NETtel) += nettel.o 37obj-$(CONFIG_MTD_NETtel) += nettel.o
diff --git a/drivers/mtd/maps/autcpu12-nvram.c b/drivers/mtd/maps/autcpu12-nvram.c
deleted file mode 100644
index c3525d2a2fa8..000000000000
--- a/drivers/mtd/maps/autcpu12-nvram.c
+++ /dev/null
@@ -1,129 +0,0 @@
1/*
2 * NV-RAM memory access on autcpu12
3 * (C) 2002 Thomas Gleixner (gleixner@autronix.de)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#include <linux/err.h>
20#include <linux/sizes.h>
21
22#include <linux/types.h>
23#include <linux/kernel.h>
24#include <linux/init.h>
25#include <linux/device.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28
29#include <linux/mtd/mtd.h>
30#include <linux/mtd/map.h>
31
32struct autcpu12_nvram_priv {
33 struct mtd_info *mtd;
34 struct map_info map;
35};
36
37static int autcpu12_nvram_probe(struct platform_device *pdev)
38{
39 map_word tmp, save0, save1;
40 struct resource *res;
41 struct autcpu12_nvram_priv *priv;
42
43 priv = devm_kzalloc(&pdev->dev,
44 sizeof(struct autcpu12_nvram_priv), GFP_KERNEL);
45 if (!priv)
46 return -ENOMEM;
47
48 platform_set_drvdata(pdev, priv);
49
50 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
51 if (!res) {
52 dev_err(&pdev->dev, "failed to get memory resource\n");
53 return -ENOENT;
54 }
55
56 priv->map.bankwidth = 4;
57 priv->map.phys = res->start;
58 priv->map.size = resource_size(res);
59 priv->map.virt = devm_ioremap_resource(&pdev->dev, res);
60 strcpy((char *)priv->map.name, res->name);
61 if (IS_ERR(priv->map.virt))
62 return PTR_ERR(priv->map.virt);
63
64 simple_map_init(&priv->map);
65
66 /*
67 * Check for 32K/128K
68 * read ofs 0
69 * read ofs 0x10000
70 * Write complement to ofs 0x100000
71 * Read and check result on ofs 0x0
72 * Restore contents
73 */
74 save0 = map_read(&priv->map, 0);
75 save1 = map_read(&priv->map, 0x10000);
76 tmp.x[0] = ~save0.x[0];
77 map_write(&priv->map, tmp, 0x10000);
78 tmp = map_read(&priv->map, 0);
79 /* if we find this pattern on 0x0, we have 32K size */
80 if (!map_word_equal(&priv->map, tmp, save0)) {
81 map_write(&priv->map, save0, 0x0);
82 priv->map.size = SZ_32K;
83 } else
84 map_write(&priv->map, save1, 0x10000);
85
86 priv->mtd = do_map_probe("map_ram", &priv->map);
87 if (!priv->mtd) {
88 dev_err(&pdev->dev, "probing failed\n");
89 return -ENXIO;
90 }
91
92 priv->mtd->owner = THIS_MODULE;
93 priv->mtd->erasesize = 16;
94 priv->mtd->dev.parent = &pdev->dev;
95 if (!mtd_device_register(priv->mtd, NULL, 0)) {
96 dev_info(&pdev->dev,
97 "NV-RAM device size %ldKiB registered on AUTCPU12\n",
98 priv->map.size / SZ_1K);
99 return 0;
100 }
101
102 map_destroy(priv->mtd);
103 dev_err(&pdev->dev, "NV-RAM device addition failed\n");
104 return -ENOMEM;
105}
106
107static int autcpu12_nvram_remove(struct platform_device *pdev)
108{
109 struct autcpu12_nvram_priv *priv = platform_get_drvdata(pdev);
110
111 mtd_device_unregister(priv->mtd);
112 map_destroy(priv->mtd);
113
114 return 0;
115}
116
117static struct platform_driver autcpu12_nvram_driver = {
118 .driver = {
119 .name = "autcpu12_nvram",
120 .owner = THIS_MODULE,
121 },
122 .probe = autcpu12_nvram_probe,
123 .remove = autcpu12_nvram_remove,
124};
125module_platform_driver(autcpu12_nvram_driver);
126
127MODULE_AUTHOR("Thomas Gleixner");
128MODULE_DESCRIPTION("autcpu12 NVRAM map driver");
129MODULE_LICENSE("GPL");
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index c719879284bd..684bfa39e4ee 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -55,25 +55,7 @@ struct mtd_file_info {
55static loff_t mtdchar_lseek(struct file *file, loff_t offset, int orig) 55static loff_t mtdchar_lseek(struct file *file, loff_t offset, int orig)
56{ 56{
57 struct mtd_file_info *mfi = file->private_data; 57 struct mtd_file_info *mfi = file->private_data;
58 struct mtd_info *mtd = mfi->mtd; 58 return fixed_size_llseek(file, offset, orig, mfi->mtd->size);
59
60 switch (orig) {
61 case SEEK_SET:
62 break;
63 case SEEK_CUR:
64 offset += file->f_pos;
65 break;
66 case SEEK_END:
67 offset += mtd->size;
68 break;
69 default:
70 return -EINVAL;
71 }
72
73 if (offset >= 0 && offset <= mtd->size)
74 return file->f_pos = offset;
75
76 return -EINVAL;
77} 59}
78 60
79static int count; 61static int count;
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index c400c57c394a..048c823f5c51 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -1151,7 +1151,7 @@ static int __init mtd_bdi_init(struct backing_dev_info *bdi, const char *name)
1151 1151
1152 ret = bdi_init(bdi); 1152 ret = bdi_init(bdi);
1153 if (!ret) 1153 if (!ret)
1154 ret = bdi_register(bdi, NULL, name); 1154 ret = bdi_register(bdi, NULL, "%s", name);
1155 1155
1156 if (ret) 1156 if (ret)
1157 bdi_destroy(bdi); 1157 bdi_destroy(bdi);
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index a60f6c17f57b..50543f166215 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -95,7 +95,7 @@ config MTD_NAND_OMAP2
95 95
96config MTD_NAND_OMAP_BCH 96config MTD_NAND_OMAP_BCH
97 depends on MTD_NAND && MTD_NAND_OMAP2 && ARCH_OMAP3 97 depends on MTD_NAND && MTD_NAND_OMAP2 && ARCH_OMAP3
98 bool "Enable support for hardware BCH error correction" 98 tristate "Enable support for hardware BCH error correction"
99 default n 99 default n
100 select BCH 100 select BCH
101 select BCH_CONST_PARAMS 101 select BCH_CONST_PARAMS
diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
index a94facb46e5c..fd1df5e13ae4 100644
--- a/drivers/mtd/nand/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/lpc32xx_mlc.c
@@ -672,11 +672,6 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
672 } 672 }
673 673
674 rc = platform_get_resource(pdev, IORESOURCE_MEM, 0); 674 rc = platform_get_resource(pdev, IORESOURCE_MEM, 0);
675 if (rc == NULL) {
676 dev_err(&pdev->dev, "No memory resource found for device!\r\n");
677 return -ENXIO;
678 }
679
680 host->io_base = devm_ioremap_resource(&pdev->dev, rc); 675 host->io_base = devm_ioremap_resource(&pdev->dev, rc);
681 if (IS_ERR(host->io_base)) 676 if (IS_ERR(host->io_base))
682 return PTR_ERR(host->io_base); 677 return PTR_ERR(host->io_base);
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index a3503821d0c7..315dcc6ec1f5 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -1006,7 +1006,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
1006 if (err) 1006 if (err)
1007 goto out_uif; 1007 goto out_uif;
1008 1008
1009 ubi->bgt_thread = kthread_create(ubi_thread, ubi, ubi->bgt_name); 1009 ubi->bgt_thread = kthread_create(ubi_thread, ubi, "%s", ubi->bgt_name);
1010 if (IS_ERR(ubi->bgt_thread)) { 1010 if (IS_ERR(ubi->bgt_thread)) {
1011 err = PTR_ERR(ubi->bgt_thread); 1011 err = PTR_ERR(ubi->bgt_thread);
1012 ubi_err("cannot spawn \"%s\", error %d", ubi->bgt_name, 1012 ubi_err("cannot spawn \"%s\", error %d", ubi->bgt_name,
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 4f02848bb2bc..8ca49f2043e4 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -155,7 +155,6 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
155{ 155{
156 struct ubi_volume_desc *desc = file->private_data; 156 struct ubi_volume_desc *desc = file->private_data;
157 struct ubi_volume *vol = desc->vol; 157 struct ubi_volume *vol = desc->vol;
158 loff_t new_offset;
159 158
160 if (vol->updating) { 159 if (vol->updating) {
161 /* Update is in progress, seeking is prohibited */ 160 /* Update is in progress, seeking is prohibited */
@@ -163,30 +162,7 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
163 return -EBUSY; 162 return -EBUSY;
164 } 163 }
165 164
166 switch (origin) { 165 return fixed_size_llseek(file, offset, origin, vol->used_bytes);
167 case 0: /* SEEK_SET */
168 new_offset = offset;
169 break;
170 case 1: /* SEEK_CUR */
171 new_offset = file->f_pos + offset;
172 break;
173 case 2: /* SEEK_END */
174 new_offset = vol->used_bytes + offset;
175 break;
176 default:
177 return -EINVAL;
178 }
179
180 if (new_offset < 0 || new_offset > vol->used_bytes) {
181 ubi_err("bad seek %lld", new_offset);
182 return -EINVAL;
183 }
184
185 dbg_gen("seek volume %d, offset %lld, origin %d, new offset %lld",
186 vol->vol_id, offset, origin, new_offset);
187
188 file->f_pos = new_offset;
189 return new_offset;
190} 166}
191 167
192static int vol_cdev_fsync(struct file *file, loff_t start, loff_t end, 168static int vol_cdev_fsync(struct file *file, loff_t start, loff_t end,