aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/bast-flash.c1
-rw-r--r--drivers/mtd/maps/ceiva.c1
-rw-r--r--drivers/mtd/maps/dc21285.c1
-rw-r--r--drivers/mtd/maps/dilnetpc.c5
-rw-r--r--drivers/mtd/maps/epxa10db-flash.c5
-rw-r--r--drivers/mtd/maps/fortunet.c5
-rw-r--r--drivers/mtd/maps/ixp2000.c6
-rw-r--r--drivers/mtd/maps/ixp4xx.c7
-rw-r--r--drivers/mtd/maps/lubbock-flash.c3
-rw-r--r--drivers/mtd/maps/mainstone-flash.c3
-rw-r--r--drivers/mtd/maps/omap-toto-flash.c2
-rw-r--r--drivers/mtd/maps/omap_nor.c2
-rw-r--r--drivers/mtd/maps/pci.c1
-rw-r--r--drivers/mtd/maps/plat-ram.c1
-rw-r--r--drivers/mtd/maps/sa1100-flash.c75
-rw-r--r--drivers/mtd/maps/tqm8xxl.c4
16 files changed, 90 insertions, 32 deletions
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c
index 0ba0ff7d43b9..63104c73ca3c 100644
--- a/drivers/mtd/maps/bast-flash.c
+++ b/drivers/mtd/maps/bast-flash.c
@@ -33,6 +33,7 @@
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/ioport.h> 34#include <linux/ioport.h>
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/slab.h>
36 37
37#include <linux/mtd/mtd.h> 38#include <linux/mtd/mtd.h>
38#include <linux/mtd/map.h> 39#include <linux/mtd/map.h>
diff --git a/drivers/mtd/maps/ceiva.c b/drivers/mtd/maps/ceiva.c
index da8584a662f4..c68b31dc7e6d 100644
--- a/drivers/mtd/maps/ceiva.c
+++ b/drivers/mtd/maps/ceiva.c
@@ -20,6 +20,7 @@
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/slab.h>
23 24
24#include <linux/mtd/mtd.h> 25#include <linux/mtd/mtd.h>
25#include <linux/mtd/map.h> 26#include <linux/mtd/map.h>
diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c
index 938c41f2f056..e5b74169fde6 100644
--- a/drivers/mtd/maps/dc21285.c
+++ b/drivers/mtd/maps/dc21285.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/slab.h>
16 17
17#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
18#include <linux/mtd/map.h> 19#include <linux/mtd/map.h>
diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c
index 0bc79c93a584..f99519692cb7 100644
--- a/drivers/mtd/maps/dilnetpc.c
+++ b/drivers/mtd/maps/dilnetpc.c
@@ -30,12 +30,15 @@
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <asm/io.h> 33#include <linux/string.h>
34
34#include <linux/mtd/mtd.h> 35#include <linux/mtd/mtd.h>
35#include <linux/mtd/map.h> 36#include <linux/mtd/map.h>
36#include <linux/mtd/partitions.h> 37#include <linux/mtd/partitions.h>
37#include <linux/mtd/concat.h> 38#include <linux/mtd/concat.h>
38 39
40#include <asm/io.h>
41
39/* 42/*
40** The DIL/NetPC keeps its BIOS in two distinct flash blocks. 43** The DIL/NetPC keeps its BIOS in two distinct flash blocks.
41** Destroying any of these blocks transforms the DNPC into 44** Destroying any of these blocks transforms the DNPC into
diff --git a/drivers/mtd/maps/epxa10db-flash.c b/drivers/mtd/maps/epxa10db-flash.c
index ab6dbe2b8cce..1df6188926b3 100644
--- a/drivers/mtd/maps/epxa10db-flash.c
+++ b/drivers/mtd/maps/epxa10db-flash.c
@@ -27,12 +27,15 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <asm/io.h> 30#include <linux/slab.h>
31
31#include <linux/mtd/mtd.h> 32#include <linux/mtd/mtd.h>
32#include <linux/mtd/map.h> 33#include <linux/mtd/map.h>
33#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
34 35
36#include <asm/io.h>
35#include <asm/hardware.h> 37#include <asm/hardware.h>
38
36#ifdef CONFIG_EPXA10DB 39#ifdef CONFIG_EPXA10DB
37#define BOARD_NAME "EPXA10DB" 40#define BOARD_NAME "EPXA10DB"
38#else 41#else
diff --git a/drivers/mtd/maps/fortunet.c b/drivers/mtd/maps/fortunet.c
index 068bb6a54520..00f7bbe5479e 100644
--- a/drivers/mtd/maps/fortunet.c
+++ b/drivers/mtd/maps/fortunet.c
@@ -7,11 +7,14 @@
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <asm/io.h> 10#include <linux/string.h>
11
11#include <linux/mtd/mtd.h> 12#include <linux/mtd/mtd.h>
12#include <linux/mtd/map.h> 13#include <linux/mtd/map.h>
13#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
14 15
16#include <asm/io.h>
17
15#define MAX_NUM_REGIONS 4 18#define MAX_NUM_REGIONS 4
16#define MAX_NUM_PARTITIONS 8 19#define MAX_NUM_PARTITIONS 8
17 20
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c
index a9f86c7fbd52..1e5d6e1d05f3 100644
--- a/drivers/mtd/maps/ixp2000.c
+++ b/drivers/mtd/maps/ixp2000.c
@@ -22,11 +22,13 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/string.h> 24#include <linux/string.h>
25#include <linux/slab.h>
26#include <linux/ioport.h>
27#include <linux/device.h>
28
25#include <linux/mtd/mtd.h> 29#include <linux/mtd/mtd.h>
26#include <linux/mtd/map.h> 30#include <linux/mtd/map.h>
27#include <linux/mtd/partitions.h> 31#include <linux/mtd/partitions.h>
28#include <linux/ioport.h>
29#include <linux/device.h>
30 32
31#include <asm/io.h> 33#include <asm/io.h>
32#include <asm/hardware.h> 34#include <asm/hardware.h>
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 3fcc32884074..da316e543237 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -20,11 +20,14 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <linux/slab.h>
24#include <linux/ioport.h>
25#include <linux/device.h>
26
23#include <linux/mtd/mtd.h> 27#include <linux/mtd/mtd.h>
24#include <linux/mtd/map.h> 28#include <linux/mtd/map.h>
25#include <linux/mtd/partitions.h> 29#include <linux/mtd/partitions.h>
26#include <linux/ioport.h> 30
27#include <linux/device.h>
28#include <asm/io.h> 31#include <asm/io.h>
29#include <asm/mach/flash.h> 32#include <asm/mach/flash.h>
30 33
diff --git a/drivers/mtd/maps/lubbock-flash.c b/drivers/mtd/maps/lubbock-flash.c
index 1298de475c9a..2337e0c46750 100644
--- a/drivers/mtd/maps/lubbock-flash.c
+++ b/drivers/mtd/maps/lubbock-flash.c
@@ -15,10 +15,13 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/slab.h>
19
18#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
19#include <linux/mtd/mtd.h> 21#include <linux/mtd/mtd.h>
20#include <linux/mtd/map.h> 22#include <linux/mtd/map.h>
21#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24
22#include <asm/io.h> 25#include <asm/io.h>
23#include <asm/hardware.h> 26#include <asm/hardware.h>
24#include <asm/arch/pxa-regs.h> 27#include <asm/arch/pxa-regs.h>
diff --git a/drivers/mtd/maps/mainstone-flash.c b/drivers/mtd/maps/mainstone-flash.c
index 87e93fa60588..da0f8a692628 100644
--- a/drivers/mtd/maps/mainstone-flash.c
+++ b/drivers/mtd/maps/mainstone-flash.c
@@ -16,9 +16,12 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/dma-mapping.h> 18#include <linux/dma-mapping.h>
19#include <linux/slab.h>
20
19#include <linux/mtd/mtd.h> 21#include <linux/mtd/mtd.h>
20#include <linux/mtd/map.h> 22#include <linux/mtd/map.h>
21#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24
22#include <asm/io.h> 25#include <asm/io.h>
23#include <asm/hardware.h> 26#include <asm/hardware.h>
24#include <asm/arch/pxa-regs.h> 27#include <asm/arch/pxa-regs.h>
diff --git a/drivers/mtd/maps/omap-toto-flash.c b/drivers/mtd/maps/omap-toto-flash.c
index 496109071cb1..da36e8dddd17 100644
--- a/drivers/mtd/maps/omap-toto-flash.c
+++ b/drivers/mtd/maps/omap-toto-flash.c
@@ -12,9 +12,9 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15
16#include <linux/errno.h> 15#include <linux/errno.h>
17#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/slab.h>
18 18
19#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
20#include <linux/mtd/map.h> 20#include <linux/mtd/map.h>
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c
index b17bca657daf..fa84566245a7 100644
--- a/drivers/mtd/maps/omap_nor.c
+++ b/drivers/mtd/maps/omap_nor.c
@@ -36,6 +36,8 @@
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/ioport.h> 38#include <linux/ioport.h>
39#include <linux/slab.h>
40
39#include <linux/mtd/mtd.h> 41#include <linux/mtd/mtd.h>
40#include <linux/mtd/map.h> 42#include <linux/mtd/map.h>
41#include <linux/mtd/partitions.h> 43#include <linux/mtd/partitions.h>
diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c
index 18dbd3af1eaa..d9c64e99ee32 100644
--- a/drivers/mtd/maps/pci.c
+++ b/drivers/mtd/maps/pci.c
@@ -17,6 +17,7 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/slab.h>
20 21
21#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
22#include <linux/mtd/map.h> 23#include <linux/mtd/map.h>
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c
index 118b04544cad..a0577ea00c3c 100644
--- a/drivers/mtd/maps/plat-ram.c
+++ b/drivers/mtd/maps/plat-ram.c
@@ -30,6 +30,7 @@
30#include <linux/string.h> 30#include <linux/string.h>
31#include <linux/ioport.h> 31#include <linux/ioport.h>
32#include <linux/device.h> 32#include <linux/device.h>
33#include <linux/slab.h>
33 34
34#include <linux/mtd/mtd.h> 35#include <linux/mtd/mtd.h>
35#include <linux/mtd/map.h> 36#include <linux/mtd/map.h>
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 8dcaa357b4bb..c81bec7b14d5 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -21,6 +21,7 @@
21#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
22#include <linux/mtd/concat.h> 22#include <linux/mtd/concat.h>
23 23
24#include <asm/hardware.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/sizes.h> 26#include <asm/sizes.h>
26#include <asm/mach/flash.h> 27#include <asm/mach/flash.h>
@@ -129,20 +130,21 @@ struct sa_subdev_info {
129 char name[16]; 130 char name[16];
130 struct map_info map; 131 struct map_info map;
131 struct mtd_info *mtd; 132 struct mtd_info *mtd;
132 struct flash_platform_data *data; 133 struct flash_platform_data *plat;
133}; 134};
134 135
135struct sa_info { 136struct sa_info {
136 struct mtd_partition *parts; 137 struct mtd_partition *parts;
137 struct mtd_info *mtd; 138 struct mtd_info *mtd;
138 int num_subdev; 139 int num_subdev;
140 unsigned int nr_parts;
139 struct sa_subdev_info subdev[0]; 141 struct sa_subdev_info subdev[0];
140}; 142};
141 143
142static void sa1100_set_vpp(struct map_info *map, int on) 144static void sa1100_set_vpp(struct map_info *map, int on)
143{ 145{
144 struct sa_subdev_info *subdev = container_of(map, struct sa_subdev_info, map); 146 struct sa_subdev_info *subdev = container_of(map, struct sa_subdev_info, map);
145 subdev->data->set_vpp(on); 147 subdev->plat->set_vpp(on);
146} 148}
147 149
148static void sa1100_destroy_subdev(struct sa_subdev_info *subdev) 150static void sa1100_destroy_subdev(struct sa_subdev_info *subdev)
@@ -186,7 +188,7 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r
186 goto out; 188 goto out;
187 } 189 }
188 190
189 if (subdev->data->set_vpp) 191 if (subdev->plat->set_vpp)
190 subdev->map.set_vpp = sa1100_set_vpp; 192 subdev->map.set_vpp = sa1100_set_vpp;
191 193
192 subdev->map.phys = phys; 194 subdev->map.phys = phys;
@@ -203,7 +205,7 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r
203 * Now let's probe for the actual flash. Do it here since 205 * Now let's probe for the actual flash. Do it here since
204 * specific machine settings might have been set above. 206 * specific machine settings might have been set above.
205 */ 207 */
206 subdev->mtd = do_map_probe(subdev->data->map_name, &subdev->map); 208 subdev->mtd = do_map_probe(subdev->plat->map_name, &subdev->map);
207 if (subdev->mtd == NULL) { 209 if (subdev->mtd == NULL) {
208 ret = -ENXIO; 210 ret = -ENXIO;
209 goto err; 211 goto err;
@@ -222,13 +224,17 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r
222 return ret; 224 return ret;
223} 225}
224 226
225static void sa1100_destroy(struct sa_info *info) 227static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *plat)
226{ 228{
227 int i; 229 int i;
228 230
229 if (info->mtd) { 231 if (info->mtd) {
230 del_mtd_partitions(info->mtd); 232 if (info->nr_parts == 0)
231 233 del_mtd_device(info->mtd);
234#ifdef CONFIG_MTD_PARTITIONS
235 else
236 del_mtd_partitions(info->mtd);
237#endif
232#ifdef CONFIG_MTD_CONCAT 238#ifdef CONFIG_MTD_CONCAT
233 if (info->mtd != info->subdev[0].mtd) 239 if (info->mtd != info->subdev[0].mtd)
234 mtd_concat_destroy(info->mtd); 240 mtd_concat_destroy(info->mtd);
@@ -241,10 +247,13 @@ static void sa1100_destroy(struct sa_info *info)
241 for (i = info->num_subdev - 1; i >= 0; i--) 247 for (i = info->num_subdev - 1; i >= 0; i--)
242 sa1100_destroy_subdev(&info->subdev[i]); 248 sa1100_destroy_subdev(&info->subdev[i]);
243 kfree(info); 249 kfree(info);
250
251 if (plat->exit)
252 plat->exit();
244} 253}
245 254
246static struct sa_info *__init 255static struct sa_info *__init
247sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash) 256sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat)
248{ 257{
249 struct sa_info *info; 258 struct sa_info *info;
250 int nr, size, i, ret = 0; 259 int nr, size, i, ret = 0;
@@ -274,6 +283,12 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash
274 283
275 memset(info, 0, size); 284 memset(info, 0, size);
276 285
286 if (plat->init) {
287 ret = plat->init();
288 if (ret)
289 goto err;
290 }
291
277 /* 292 /*
278 * Claim and then map the memory regions. 293 * Claim and then map the memory regions.
279 */ 294 */
@@ -286,8 +301,8 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash
286 break; 301 break;
287 302
288 subdev->map.name = subdev->name; 303 subdev->map.name = subdev->name;
289 sprintf(subdev->name, "sa1100-%d", i); 304 sprintf(subdev->name, "%s-%d", plat->name, i);
290 subdev->data = flash; 305 subdev->plat = plat;
291 306
292 ret = sa1100_probe_subdev(subdev, res); 307 ret = sa1100_probe_subdev(subdev, res);
293 if (ret) 308 if (ret)
@@ -308,7 +323,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash
308 * otherwise fail. Either way, it'll be called "sa1100". 323 * otherwise fail. Either way, it'll be called "sa1100".
309 */ 324 */
310 if (info->num_subdev == 1) { 325 if (info->num_subdev == 1) {
311 strcpy(info->subdev[0].name, "sa1100"); 326 strcpy(info->subdev[0].name, plat->name);
312 info->mtd = info->subdev[0].mtd; 327 info->mtd = info->subdev[0].mtd;
313 ret = 0; 328 ret = 0;
314 } else if (info->num_subdev > 1) { 329 } else if (info->num_subdev > 1) {
@@ -321,7 +336,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash
321 cdev[i] = info->subdev[i].mtd; 336 cdev[i] = info->subdev[i].mtd;
322 337
323 info->mtd = mtd_concat_create(cdev, info->num_subdev, 338 info->mtd = mtd_concat_create(cdev, info->num_subdev,
324 "sa1100"); 339 plat->name);
325 if (info->mtd == NULL) 340 if (info->mtd == NULL)
326 ret = -ENXIO; 341 ret = -ENXIO;
327#else 342#else
@@ -335,7 +350,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash
335 return info; 350 return info;
336 351
337 err: 352 err:
338 sa1100_destroy(info); 353 sa1100_destroy(info, plat);
339 out: 354 out:
340 return ERR_PTR(ret); 355 return ERR_PTR(ret);
341} 356}
@@ -345,16 +360,16 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
345static int __init sa1100_mtd_probe(struct device *dev) 360static int __init sa1100_mtd_probe(struct device *dev)
346{ 361{
347 struct platform_device *pdev = to_platform_device(dev); 362 struct platform_device *pdev = to_platform_device(dev);
348 struct flash_platform_data *flash = pdev->dev.platform_data; 363 struct flash_platform_data *plat = pdev->dev.platform_data;
349 struct mtd_partition *parts; 364 struct mtd_partition *parts;
350 const char *part_type = NULL; 365 const char *part_type = NULL;
351 struct sa_info *info; 366 struct sa_info *info;
352 int err, nr_parts = 0; 367 int err, nr_parts = 0;
353 368
354 if (!flash) 369 if (!plat)
355 return -ENODEV; 370 return -ENODEV;
356 371
357 info = sa1100_setup_mtd(pdev, flash); 372 info = sa1100_setup_mtd(pdev, plat);
358 if (IS_ERR(info)) { 373 if (IS_ERR(info)) {
359 err = PTR_ERR(info); 374 err = PTR_ERR(info);
360 goto out; 375 goto out;
@@ -371,8 +386,8 @@ static int __init sa1100_mtd_probe(struct device *dev)
371 } else 386 } else
372#endif 387#endif
373 { 388 {
374 parts = flash->parts; 389 parts = plat->parts;
375 nr_parts = flash->nr_parts; 390 nr_parts = plat->nr_parts;
376 part_type = "static"; 391 part_type = "static";
377 } 392 }
378 393
@@ -386,6 +401,8 @@ static int __init sa1100_mtd_probe(struct device *dev)
386 add_mtd_partitions(info->mtd, parts, nr_parts); 401 add_mtd_partitions(info->mtd, parts, nr_parts);
387 } 402 }
388 403
404 info->nr_parts = nr_parts;
405
389 dev_set_drvdata(dev, info); 406 dev_set_drvdata(dev, info);
390 err = 0; 407 err = 0;
391 408
@@ -396,33 +413,44 @@ static int __init sa1100_mtd_probe(struct device *dev)
396static int __exit sa1100_mtd_remove(struct device *dev) 413static int __exit sa1100_mtd_remove(struct device *dev)
397{ 414{
398 struct sa_info *info = dev_get_drvdata(dev); 415 struct sa_info *info = dev_get_drvdata(dev);
416 struct flash_platform_data *plat = dev->platform_data;
417
399 dev_set_drvdata(dev, NULL); 418 dev_set_drvdata(dev, NULL);
400 sa1100_destroy(info); 419 sa1100_destroy(info, plat);
420
401 return 0; 421 return 0;
402} 422}
403 423
404#ifdef CONFIG_PM 424#ifdef CONFIG_PM
405static int sa1100_mtd_suspend(struct device *dev, pm_message_t state, u32 level) 425static int sa1100_mtd_suspend(struct device *dev, pm_message_t state)
406{ 426{
407 struct sa_info *info = dev_get_drvdata(dev); 427 struct sa_info *info = dev_get_drvdata(dev);
408 int ret = 0; 428 int ret = 0;
409 429
410 if (info && level == SUSPEND_SAVE_STATE) 430 if (info)
411 ret = info->mtd->suspend(info->mtd); 431 ret = info->mtd->suspend(info->mtd);
412 432
413 return ret; 433 return ret;
414} 434}
415 435
416static int sa1100_mtd_resume(struct device *dev, u32 level) 436static int sa1100_mtd_resume(struct device *dev)
417{ 437{
418 struct sa_info *info = dev_get_drvdata(dev); 438 struct sa_info *info = dev_get_drvdata(dev);
419 if (info && level == RESUME_RESTORE_STATE) 439 if (info)
420 info->mtd->resume(info->mtd); 440 info->mtd->resume(info->mtd);
421 return 0; 441 return 0;
422} 442}
443
444static void sa1100_mtd_shutdown(struct device *dev)
445{
446 struct sa_info *info = dev_get_drvdata(dev);
447 if (info && info->mtd->suspend(info->mtd) == 0)
448 info->mtd->resume(info->mtd);
449}
423#else 450#else
424#define sa1100_mtd_suspend NULL 451#define sa1100_mtd_suspend NULL
425#define sa1100_mtd_resume NULL 452#define sa1100_mtd_resume NULL
453#define sa1100_mtd_shutdown NULL
426#endif 454#endif
427 455
428static struct device_driver sa1100_mtd_driver = { 456static struct device_driver sa1100_mtd_driver = {
@@ -432,6 +460,7 @@ static struct device_driver sa1100_mtd_driver = {
432 .remove = __exit_p(sa1100_mtd_remove), 460 .remove = __exit_p(sa1100_mtd_remove),
433 .suspend = sa1100_mtd_suspend, 461 .suspend = sa1100_mtd_suspend,
434 .resume = sa1100_mtd_resume, 462 .resume = sa1100_mtd_resume,
463 .shutdown = sa1100_mtd_shutdown,
435}; 464};
436 465
437static int __init sa1100_mtd_init(void) 466static int __init sa1100_mtd_init(void)
diff --git a/drivers/mtd/maps/tqm8xxl.c b/drivers/mtd/maps/tqm8xxl.c
index 995e9991cb8d..4e28b977f224 100644
--- a/drivers/mtd/maps/tqm8xxl.c
+++ b/drivers/mtd/maps/tqm8xxl.c
@@ -27,12 +27,14 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <asm/io.h> 30#include <linux/slab.h>
31 31
32#include <linux/mtd/mtd.h> 32#include <linux/mtd/mtd.h>
33#include <linux/mtd/map.h> 33#include <linux/mtd/map.h>
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35 35
36#include <asm/io.h>
37
36#define FLASH_ADDR 0x40000000 38#define FLASH_ADDR 0x40000000
37#define FLASH_SIZE 0x00800000 39#define FLASH_SIZE 0x00800000
38#define FLASH_BANK_MAX 4 40#define FLASH_BANK_MAX 4