aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/Kconfig9
-rw-r--r--drivers/mtd/maps/Makefile1
-rw-r--r--drivers/mtd/maps/bcm963xx-flash.c277
-rw-r--r--drivers/mtd/maps/bfin-async-flash.c12
-rw-r--r--drivers/mtd/maps/gpio-addr-flash.c12
-rw-r--r--drivers/mtd/maps/ixp2000.c12
-rw-r--r--drivers/mtd/maps/ixp4xx.c14
-rw-r--r--drivers/mtd/maps/lantiq-flash.c6
-rw-r--r--drivers/mtd/maps/latch-addr-flash.c12
-rw-r--r--drivers/mtd/maps/physmap.c10
-rw-r--r--drivers/mtd/maps/physmap_of.c13
-rw-r--r--drivers/mtd/maps/pxa2xx-flash.c17
-rw-r--r--drivers/mtd/maps/rbtx4939-flash.c18
-rw-r--r--drivers/mtd/maps/sa1100-flash.c17
-rw-r--r--drivers/mtd/maps/scb2_flash.c3
-rw-r--r--drivers/mtd/maps/sun_uflash.c13
16 files changed, 24 insertions, 422 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 8e0c4bf9f7fb..6c5c431c64af 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -242,15 +242,6 @@ config MTD_NETtel
242 help 242 help
243 Support for flash chips on NETtel/SecureEdge/SnapGear boards. 243 Support for flash chips on NETtel/SecureEdge/SnapGear boards.
244 244
245config MTD_BCM963XX
246 tristate "Map driver for Broadcom BCM963xx boards"
247 depends on BCM63XX
248 select MTD_MAP_BANK_WIDTH_2
249 select MTD_CFI_I1
250 help
251 Support for parsing CFE image tag and creating MTD partitions on
252 Broadcom BCM63xx boards.
253
254config MTD_LANTIQ 245config MTD_LANTIQ
255 tristate "Lantiq SoC NOR support" 246 tristate "Lantiq SoC NOR support"
256 depends on LANTIQ 247 depends on LANTIQ
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
index 45dcb8b14f22..68a9a91d344f 100644
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -55,6 +55,5 @@ obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o
55obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o 55obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o
56obj-$(CONFIG_MTD_VMU) += vmu-flash.o 56obj-$(CONFIG_MTD_VMU) += vmu-flash.o
57obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o 57obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o
58obj-$(CONFIG_MTD_BCM963XX) += bcm963xx-flash.o
59obj-$(CONFIG_MTD_LATCH_ADDR) += latch-addr-flash.o 58obj-$(CONFIG_MTD_LATCH_ADDR) += latch-addr-flash.o
60obj-$(CONFIG_MTD_LANTIQ) += lantiq-flash.o 59obj-$(CONFIG_MTD_LANTIQ) += lantiq-flash.o
diff --git a/drivers/mtd/maps/bcm963xx-flash.c b/drivers/mtd/maps/bcm963xx-flash.c
deleted file mode 100644
index 736ca10ca9f1..000000000000
--- a/drivers/mtd/maps/bcm963xx-flash.c
+++ /dev/null
@@ -1,277 +0,0 @@
1/*
2 * Copyright © 2006-2008 Florian Fainelli <florian@openwrt.org>
3 * Mike Albon <malbon@openwrt.org>
4 * Copyright © 2009-2010 Daniel Dickinson <openwrt@cshore.neomailbox.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/init.h>
22#include <linux/kernel.h>
23#include <linux/slab.h>
24#include <linux/module.h>
25#include <linux/mtd/map.h>
26#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h>
28#include <linux/vmalloc.h>
29#include <linux/platform_device.h>
30#include <linux/io.h>
31
32#include <asm/mach-bcm63xx/bcm963xx_tag.h>
33
34#define BCM63XX_BUSWIDTH 2 /* Buswidth */
35#define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
36
37#define PFX KBUILD_MODNAME ": "
38
39static struct mtd_partition *parsed_parts;
40
41static struct mtd_info *bcm963xx_mtd_info;
42
43static struct map_info bcm963xx_map = {
44 .name = "bcm963xx",
45 .bankwidth = BCM63XX_BUSWIDTH,
46};
47
48static int parse_cfe_partitions(struct mtd_info *master,
49 struct mtd_partition **pparts)
50{
51 /* CFE, NVRAM and global Linux are always present */
52 int nrparts = 3, curpart = 0;
53 struct bcm_tag *buf;
54 struct mtd_partition *parts;
55 int ret;
56 size_t retlen;
57 unsigned int rootfsaddr, kerneladdr, spareaddr;
58 unsigned int rootfslen, kernellen, sparelen, totallen;
59 int namelen = 0;
60 int i;
61 char *boardid;
62 char *tagversion;
63
64 /* Allocate memory for buffer */
65 buf = vmalloc(sizeof(struct bcm_tag));
66 if (!buf)
67 return -ENOMEM;
68
69 /* Get the tag */
70 ret = master->read(master, master->erasesize, sizeof(struct bcm_tag),
71 &retlen, (void *)buf);
72 if (retlen != sizeof(struct bcm_tag)) {
73 vfree(buf);
74 return -EIO;
75 }
76
77 sscanf(buf->kernel_address, "%u", &kerneladdr);
78 sscanf(buf->kernel_length, "%u", &kernellen);
79 sscanf(buf->total_length, "%u", &totallen);
80 tagversion = &(buf->tag_version[0]);
81 boardid = &(buf->board_id[0]);
82
83 printk(KERN_INFO PFX "CFE boot tag found with version %s "
84 "and board type %s\n", tagversion, boardid);
85
86 kerneladdr = kerneladdr - BCM63XX_EXTENDED_SIZE;
87 rootfsaddr = kerneladdr + kernellen;
88 spareaddr = roundup(totallen, master->erasesize) + master->erasesize;
89 sparelen = master->size - spareaddr - master->erasesize;
90 rootfslen = spareaddr - rootfsaddr;
91
92 /* Determine number of partitions */
93 namelen = 8;
94 if (rootfslen > 0) {
95 nrparts++;
96 namelen += 6;
97 };
98 if (kernellen > 0) {
99 nrparts++;
100 namelen += 6;
101 };
102
103 /* Ask kernel for more memory */
104 parts = kzalloc(sizeof(*parts) * nrparts + 10 * nrparts, GFP_KERNEL);
105 if (!parts) {
106 vfree(buf);
107 return -ENOMEM;
108 };
109
110 /* Start building partition list */
111 parts[curpart].name = "CFE";
112 parts[curpart].offset = 0;
113 parts[curpart].size = master->erasesize;
114 curpart++;
115
116 if (kernellen > 0) {
117 parts[curpart].name = "kernel";
118 parts[curpart].offset = kerneladdr;
119 parts[curpart].size = kernellen;
120 curpart++;
121 };
122
123 if (rootfslen > 0) {
124 parts[curpart].name = "rootfs";
125 parts[curpart].offset = rootfsaddr;
126 parts[curpart].size = rootfslen;
127 if (sparelen > 0)
128 parts[curpart].size += sparelen;
129 curpart++;
130 };
131
132 parts[curpart].name = "nvram";
133 parts[curpart].offset = master->size - master->erasesize;
134 parts[curpart].size = master->erasesize;
135
136 /* Global partition "linux" to make easy firmware upgrade */
137 curpart++;
138 parts[curpart].name = "linux";
139 parts[curpart].offset = parts[0].size;
140 parts[curpart].size = master->size - parts[0].size - parts[3].size;
141
142 for (i = 0; i < nrparts; i++)
143 printk(KERN_INFO PFX "Partition %d is %s offset %lx and "
144 "length %lx\n", i, parts[i].name,
145 (long unsigned int)(parts[i].offset),
146 (long unsigned int)(parts[i].size));
147
148 printk(KERN_INFO PFX "Spare partition is %x offset and length %x\n",
149 spareaddr, sparelen);
150 *pparts = parts;
151 vfree(buf);
152
153 return nrparts;
154};
155
156static int bcm963xx_detect_cfe(struct mtd_info *master)
157{
158 int idoffset = 0x4e0;
159 static char idstring[8] = "CFE1CFE1";
160 char buf[9];
161 int ret;
162 size_t retlen;
163
164 ret = master->read(master, idoffset, 8, &retlen, (void *)buf);
165 buf[retlen] = 0;
166 printk(KERN_INFO PFX "Read Signature value of %s\n", buf);
167
168 return strncmp(idstring, buf, 8);
169}
170
171static int bcm963xx_probe(struct platform_device *pdev)
172{
173 int err = 0;
174 int parsed_nr_parts = 0;
175 char *part_type;
176 struct resource *r;
177
178 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
179 if (!r) {
180 dev_err(&pdev->dev, "no resource supplied\n");
181 return -ENODEV;
182 }
183
184 bcm963xx_map.phys = r->start;
185 bcm963xx_map.size = resource_size(r);
186 bcm963xx_map.virt = ioremap(r->start, resource_size(r));
187 if (!bcm963xx_map.virt) {
188 dev_err(&pdev->dev, "failed to ioremap\n");
189 return -EIO;
190 }
191
192 dev_info(&pdev->dev, "0x%08lx at 0x%08x\n",
193 bcm963xx_map.size, bcm963xx_map.phys);
194
195 simple_map_init(&bcm963xx_map);
196
197 bcm963xx_mtd_info = do_map_probe("cfi_probe", &bcm963xx_map);
198 if (!bcm963xx_mtd_info) {
199 dev_err(&pdev->dev, "failed to probe using CFI\n");
200 bcm963xx_mtd_info = do_map_probe("jedec_probe", &bcm963xx_map);
201 if (bcm963xx_mtd_info)
202 goto probe_ok;
203 dev_err(&pdev->dev, "failed to probe using JEDEC\n");
204 err = -EIO;
205 goto err_probe;
206 }
207
208probe_ok:
209 bcm963xx_mtd_info->owner = THIS_MODULE;
210
211 /* This is mutually exclusive */
212 if (bcm963xx_detect_cfe(bcm963xx_mtd_info) == 0) {
213 dev_info(&pdev->dev, "CFE bootloader detected\n");
214 if (parsed_nr_parts == 0) {
215 int ret = parse_cfe_partitions(bcm963xx_mtd_info,
216 &parsed_parts);
217 if (ret > 0) {
218 part_type = "CFE";
219 parsed_nr_parts = ret;
220 }
221 }
222 } else {
223 dev_info(&pdev->dev, "unsupported bootloader\n");
224 err = -ENODEV;
225 goto err_probe;
226 }
227
228 return mtd_device_register(bcm963xx_mtd_info, parsed_parts,
229 parsed_nr_parts);
230
231err_probe:
232 iounmap(bcm963xx_map.virt);
233 return err;
234}
235
236static int bcm963xx_remove(struct platform_device *pdev)
237{
238 if (bcm963xx_mtd_info) {
239 mtd_device_unregister(bcm963xx_mtd_info);
240 map_destroy(bcm963xx_mtd_info);
241 }
242
243 if (bcm963xx_map.virt) {
244 iounmap(bcm963xx_map.virt);
245 bcm963xx_map.virt = 0;
246 }
247
248 return 0;
249}
250
251static struct platform_driver bcm63xx_mtd_dev = {
252 .probe = bcm963xx_probe,
253 .remove = bcm963xx_remove,
254 .driver = {
255 .name = "bcm963xx-flash",
256 .owner = THIS_MODULE,
257 },
258};
259
260static int __init bcm963xx_mtd_init(void)
261{
262 return platform_driver_register(&bcm63xx_mtd_dev);
263}
264
265static void __exit bcm963xx_mtd_exit(void)
266{
267 platform_driver_unregister(&bcm63xx_mtd_dev);
268}
269
270module_init(bcm963xx_mtd_init);
271module_exit(bcm963xx_mtd_exit);
272
273MODULE_LICENSE("GPL");
274MODULE_DESCRIPTION("Broadcom BCM63xx MTD driver for CFE and RedBoot");
275MODULE_AUTHOR("Daniel Dickinson <openwrt@cshore.neomailbox.net>");
276MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
277MODULE_AUTHOR("Mike Albon <malbon@openwrt.org>");
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c
index 6d6b2b5674ee..650126c361f1 100644
--- a/drivers/mtd/maps/bfin-async-flash.c
+++ b/drivers/mtd/maps/bfin-async-flash.c
@@ -190,17 +190,7 @@ static struct platform_driver bfin_flash_driver = {
190 }, 190 },
191}; 191};
192 192
193static int __init bfin_flash_init(void) 193module_platform_driver(bfin_flash_driver);
194{
195 return platform_driver_register(&bfin_flash_driver);
196}
197module_init(bfin_flash_init);
198
199static void __exit bfin_flash_exit(void)
200{
201 platform_driver_unregister(&bfin_flash_driver);
202}
203module_exit(bfin_flash_exit);
204 194
205MODULE_LICENSE("GPL"); 195MODULE_LICENSE("GPL");
206MODULE_DESCRIPTION("MTD map driver for Blackfins with flash/ethernet on same async bank"); 196MODULE_DESCRIPTION("MTD map driver for Blackfins with flash/ethernet on same async bank");
diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c
index 1ec66f031c51..33cce895859f 100644
--- a/drivers/mtd/maps/gpio-addr-flash.c
+++ b/drivers/mtd/maps/gpio-addr-flash.c
@@ -279,17 +279,7 @@ static struct platform_driver gpio_flash_driver = {
279 }, 279 },
280}; 280};
281 281
282static int __init gpio_flash_init(void) 282module_platform_driver(gpio_flash_driver);
283{
284 return platform_driver_register(&gpio_flash_driver);
285}
286module_init(gpio_flash_init);
287
288static void __exit gpio_flash_exit(void)
289{
290 platform_driver_unregister(&gpio_flash_driver);
291}
292module_exit(gpio_flash_exit);
293 283
294MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>"); 284MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>");
295MODULE_DESCRIPTION("MTD map driver for flashes addressed physically and with gpios"); 285MODULE_DESCRIPTION("MTD map driver for flashes addressed physically and with gpios");
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c
index 437fcd2f352f..fc7d4d0d9a4e 100644
--- a/drivers/mtd/maps/ixp2000.c
+++ b/drivers/mtd/maps/ixp2000.c
@@ -246,18 +246,8 @@ static struct platform_driver ixp2000_flash_driver = {
246 }, 246 },
247}; 247};
248 248
249static int __init ixp2000_flash_init(void) 249module_platform_driver(ixp2000_flash_driver);
250{
251 return platform_driver_register(&ixp2000_flash_driver);
252}
253
254static void __exit ixp2000_flash_exit(void)
255{
256 platform_driver_unregister(&ixp2000_flash_driver);
257}
258 250
259module_init(ixp2000_flash_init);
260module_exit(ixp2000_flash_exit);
261MODULE_LICENSE("GPL"); 251MODULE_LICENSE("GPL");
262MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>"); 252MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>");
263MODULE_ALIAS("platform:IXP2000-Flash"); 253MODULE_ALIAS("platform:IXP2000-Flash");
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 30409015a3de..8b5410162d70 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -270,19 +270,7 @@ static struct platform_driver ixp4xx_flash_driver = {
270 }, 270 },
271}; 271};
272 272
273static int __init ixp4xx_flash_init(void) 273module_platform_driver(ixp4xx_flash_driver);
274{
275 return platform_driver_register(&ixp4xx_flash_driver);
276}
277
278static void __exit ixp4xx_flash_exit(void)
279{
280 platform_driver_unregister(&ixp4xx_flash_driver);
281}
282
283
284module_init(ixp4xx_flash_init);
285module_exit(ixp4xx_flash_exit);
286 274
287MODULE_LICENSE("GPL"); 275MODULE_LICENSE("GPL");
288MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems"); 276MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems");
diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
index 4f10e27ada55..7b889de9477b 100644
--- a/drivers/mtd/maps/lantiq-flash.c
+++ b/drivers/mtd/maps/lantiq-flash.c
@@ -159,7 +159,7 @@ ltq_mtd_probe(struct platform_device *pdev)
159 if (!ltq_mtd->mtd) { 159 if (!ltq_mtd->mtd) {
160 dev_err(&pdev->dev, "probing failed\n"); 160 dev_err(&pdev->dev, "probing failed\n");
161 err = -ENXIO; 161 err = -ENXIO;
162 goto err_unmap; 162 goto err_free;
163 } 163 }
164 164
165 ltq_mtd->mtd->owner = THIS_MODULE; 165 ltq_mtd->mtd->owner = THIS_MODULE;
@@ -179,8 +179,6 @@ ltq_mtd_probe(struct platform_device *pdev)
179 179
180err_destroy: 180err_destroy:
181 map_destroy(ltq_mtd->mtd); 181 map_destroy(ltq_mtd->mtd);
182err_unmap:
183 iounmap(ltq_mtd->map->virt);
184err_free: 182err_free:
185 kfree(ltq_mtd->map); 183 kfree(ltq_mtd->map);
186err_out: 184err_out:
@@ -198,8 +196,6 @@ ltq_mtd_remove(struct platform_device *pdev)
198 mtd_device_unregister(ltq_mtd->mtd); 196 mtd_device_unregister(ltq_mtd->mtd);
199 map_destroy(ltq_mtd->mtd); 197 map_destroy(ltq_mtd->mtd);
200 } 198 }
201 if (ltq_mtd->map->virt)
202 iounmap(ltq_mtd->map->virt);
203 kfree(ltq_mtd->map); 199 kfree(ltq_mtd->map);
204 kfree(ltq_mtd); 200 kfree(ltq_mtd);
205 } 201 }
diff --git a/drivers/mtd/maps/latch-addr-flash.c b/drivers/mtd/maps/latch-addr-flash.c
index 119baa7d7477..8fed58e3a4a8 100644
--- a/drivers/mtd/maps/latch-addr-flash.c
+++ b/drivers/mtd/maps/latch-addr-flash.c
@@ -223,17 +223,7 @@ static struct platform_driver latch_addr_flash_driver = {
223 }, 223 },
224}; 224};
225 225
226static int __init latch_addr_flash_init(void) 226module_platform_driver(latch_addr_flash_driver);
227{
228 return platform_driver_register(&latch_addr_flash_driver);
229}
230module_init(latch_addr_flash_init);
231
232static void __exit latch_addr_flash_exit(void)
233{
234 platform_driver_unregister(&latch_addr_flash_driver);
235}
236module_exit(latch_addr_flash_exit);
237 227
238MODULE_AUTHOR("David Griego <dgriego@mvista.com>"); 228MODULE_AUTHOR("David Griego <dgriego@mvista.com>");
239MODULE_DESCRIPTION("MTD map driver for flashes addressed physically with upper " 229MODULE_DESCRIPTION("MTD map driver for flashes addressed physically with upper "
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 66e8200079c2..abc562653b31 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -85,6 +85,7 @@ static int physmap_flash_probe(struct platform_device *dev)
85 struct physmap_flash_data *physmap_data; 85 struct physmap_flash_data *physmap_data;
86 struct physmap_flash_info *info; 86 struct physmap_flash_info *info;
87 const char **probe_type; 87 const char **probe_type;
88 const char **part_types;
88 int err = 0; 89 int err = 0;
89 int i; 90 int i;
90 int devices_found = 0; 91 int devices_found = 0;
@@ -171,7 +172,9 @@ static int physmap_flash_probe(struct platform_device *dev)
171 if (err) 172 if (err)
172 goto err_out; 173 goto err_out;
173 174
174 mtd_device_parse_register(info->cmtd, part_probe_types, 0, 175 part_types = physmap_data->part_probe_types ? : part_probe_types;
176
177 mtd_device_parse_register(info->cmtd, part_types, 0,
175 physmap_data->parts, physmap_data->nr_parts); 178 physmap_data->parts, physmap_data->nr_parts);
176 return 0; 179 return 0;
177 180
@@ -187,9 +190,8 @@ static void physmap_flash_shutdown(struct platform_device *dev)
187 int i; 190 int i;
188 191
189 for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) 192 for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
190 if (info->mtd[i]->suspend && info->mtd[i]->resume) 193 if (mtd_suspend(info->mtd[i]) == 0)
191 if (info->mtd[i]->suspend(info->mtd[i]) == 0) 194 mtd_resume(info->mtd[i]);
192 info->mtd[i]->resume(info->mtd[i]);
193} 195}
194#else 196#else
195#define physmap_flash_shutdown NULL 197#define physmap_flash_shutdown NULL
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 7d65f9d3e690..2e6fb6831d55 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -338,18 +338,7 @@ static struct platform_driver of_flash_driver = {
338 .remove = of_flash_remove, 338 .remove = of_flash_remove,
339}; 339};
340 340
341static int __init of_flash_init(void) 341module_platform_driver(of_flash_driver);
342{
343 return platform_driver_register(&of_flash_driver);
344}
345
346static void __exit of_flash_exit(void)
347{
348 platform_driver_unregister(&of_flash_driver);
349}
350
351module_init(of_flash_init);
352module_exit(of_flash_exit);
353 342
354MODULE_LICENSE("GPL"); 343MODULE_LICENSE("GPL");
355MODULE_AUTHOR("Vitaly Wool <vwool@ru.mvista.com>"); 344MODULE_AUTHOR("Vitaly Wool <vwool@ru.mvista.com>");
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index 2a25b6789af4..436d121185b1 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -125,8 +125,8 @@ static void pxa2xx_flash_shutdown(struct platform_device *dev)
125{ 125{
126 struct pxa2xx_flash_info *info = platform_get_drvdata(dev); 126 struct pxa2xx_flash_info *info = platform_get_drvdata(dev);
127 127
128 if (info && info->mtd->suspend(info->mtd) == 0) 128 if (info && mtd_suspend(info->mtd) == 0)
129 info->mtd->resume(info->mtd); 129 mtd_resume(info->mtd);
130} 130}
131#else 131#else
132#define pxa2xx_flash_shutdown NULL 132#define pxa2xx_flash_shutdown NULL
@@ -142,18 +142,7 @@ static struct platform_driver pxa2xx_flash_driver = {
142 .shutdown = pxa2xx_flash_shutdown, 142 .shutdown = pxa2xx_flash_shutdown,
143}; 143};
144 144
145static int __init init_pxa2xx_flash(void) 145module_platform_driver(pxa2xx_flash_driver);
146{
147 return platform_driver_register(&pxa2xx_flash_driver);
148}
149
150static void __exit cleanup_pxa2xx_flash(void)
151{
152 platform_driver_unregister(&pxa2xx_flash_driver);
153}
154
155module_init(init_pxa2xx_flash);
156module_exit(cleanup_pxa2xx_flash);
157 146
158MODULE_LICENSE("GPL"); 147MODULE_LICENSE("GPL");
159MODULE_AUTHOR("Nicolas Pitre <nico@fluxnic.net>"); 148MODULE_AUTHOR("Nicolas Pitre <nico@fluxnic.net>");
diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c
index 0237f197fd12..3da63fc6f16e 100644
--- a/drivers/mtd/maps/rbtx4939-flash.c
+++ b/drivers/mtd/maps/rbtx4939-flash.c
@@ -119,9 +119,8 @@ static void rbtx4939_flash_shutdown(struct platform_device *dev)
119{ 119{
120 struct rbtx4939_flash_info *info = platform_get_drvdata(dev); 120 struct rbtx4939_flash_info *info = platform_get_drvdata(dev);
121 121
122 if (info->mtd->suspend && info->mtd->resume) 122 if (mtd_suspend(info->mtd) == 0)
123 if (info->mtd->suspend(info->mtd) == 0) 123 mtd_resume(info->mtd);
124 info->mtd->resume(info->mtd);
125} 124}
126#else 125#else
127#define rbtx4939_flash_shutdown NULL 126#define rbtx4939_flash_shutdown NULL
@@ -137,18 +136,7 @@ static struct platform_driver rbtx4939_flash_driver = {
137 }, 136 },
138}; 137};
139 138
140static int __init rbtx4939_flash_init(void) 139module_platform_driver(rbtx4939_flash_driver);
141{
142 return platform_driver_register(&rbtx4939_flash_driver);
143}
144
145static void __exit rbtx4939_flash_exit(void)
146{
147 platform_driver_unregister(&rbtx4939_flash_driver);
148}
149
150module_init(rbtx4939_flash_init);
151module_exit(rbtx4939_flash_exit);
152 140
153MODULE_LICENSE("GPL"); 141MODULE_LICENSE("GPL");
154MODULE_DESCRIPTION("RBTX4939 MTD map driver"); 142MODULE_DESCRIPTION("RBTX4939 MTD map driver");
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index fa9c0a9670cd..502821997707 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -377,8 +377,8 @@ static int __exit sa1100_mtd_remove(struct platform_device *pdev)
377static void sa1100_mtd_shutdown(struct platform_device *dev) 377static void sa1100_mtd_shutdown(struct platform_device *dev)
378{ 378{
379 struct sa_info *info = platform_get_drvdata(dev); 379 struct sa_info *info = platform_get_drvdata(dev);
380 if (info && info->mtd->suspend(info->mtd) == 0) 380 if (info && mtd_suspend(info->mtd) == 0)
381 info->mtd->resume(info->mtd); 381 mtd_resume(info->mtd);
382} 382}
383#else 383#else
384#define sa1100_mtd_shutdown NULL 384#define sa1100_mtd_shutdown NULL
@@ -394,18 +394,7 @@ static struct platform_driver sa1100_mtd_driver = {
394 }, 394 },
395}; 395};
396 396
397static int __init sa1100_mtd_init(void) 397module_platform_driver(sa1100_mtd_driver);
398{
399 return platform_driver_register(&sa1100_mtd_driver);
400}
401
402static void __exit sa1100_mtd_exit(void)
403{
404 platform_driver_unregister(&sa1100_mtd_driver);
405}
406
407module_init(sa1100_mtd_init);
408module_exit(sa1100_mtd_exit);
409 398
410MODULE_AUTHOR("Nicolas Pitre"); 399MODULE_AUTHOR("Nicolas Pitre");
411MODULE_DESCRIPTION("SA1100 CFI map driver"); 400MODULE_DESCRIPTION("SA1100 CFI map driver");
diff --git a/drivers/mtd/maps/scb2_flash.c b/drivers/mtd/maps/scb2_flash.c
index d88c8426bb0f..934a72c80078 100644
--- a/drivers/mtd/maps/scb2_flash.c
+++ b/drivers/mtd/maps/scb2_flash.c
@@ -204,8 +204,7 @@ scb2_flash_remove(struct pci_dev *dev)
204 return; 204 return;
205 205
206 /* disable flash writes */ 206 /* disable flash writes */
207 if (scb2_mtd->lock) 207 mtd_lock(scb2_mtd, 0, scb2_mtd->size);
208 scb2_mtd->lock(scb2_mtd, 0, scb2_mtd->size);
209 208
210 mtd_device_unregister(scb2_mtd); 209 mtd_device_unregister(scb2_mtd);
211 map_destroy(scb2_mtd); 210 map_destroy(scb2_mtd);
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 2d66234f57cb..175e537b444f 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -158,15 +158,4 @@ static struct platform_driver uflash_driver = {
158 .remove = __devexit_p(uflash_remove), 158 .remove = __devexit_p(uflash_remove),
159}; 159};
160 160
161static int __init uflash_init(void) 161module_platform_driver(uflash_driver);
162{
163 return platform_driver_register(&uflash_driver);
164}
165
166static void __exit uflash_exit(void)
167{
168 platform_driver_unregister(&uflash_driver);
169}
170
171module_init(uflash_init);
172module_exit(uflash_exit);