aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ftl.c24
-rw-r--r--drivers/mtd/maps/amd76xrom.c1
-rw-r--r--drivers/mtd/maps/ck804xrom.c1
-rw-r--r--drivers/mtd/maps/esb2rom.c1
-rw-r--r--drivers/mtd/maps/pcmciamtd.c34
-rw-r--r--drivers/mtd/maps/sun_uflash.c75
-rw-r--r--drivers/mtd/mtd_blkdevs.c16
-rw-r--r--drivers/mtd/mtdchar.c26
-rw-r--r--drivers/mtd/mtdpart.c2
-rw-r--r--drivers/mtd/nand/alauda.c4
-rw-r--r--drivers/mtd/nand/ams-delta.c4
-rw-r--r--drivers/mtd/nand/atmel_nand_ecc.h3
-rw-r--r--drivers/mtd/nand/au1550nd.c1
-rw-r--r--drivers/mtd/nand/cafe_nand.c6
-rw-r--r--drivers/mtd/nand/cmx270_nand.c2
-rw-r--r--drivers/mtd/nand/tmio_nand.c8
16 files changed, 116 insertions, 92 deletions
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index f34f20c78911..9bf581c4f740 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -1005,6 +1005,29 @@ static int ftl_writesect(struct mtd_blktrans_dev *dev,
1005 return ftl_write((void *)dev, buf, block, 1); 1005 return ftl_write((void *)dev, buf, block, 1);
1006} 1006}
1007 1007
1008static int ftl_discardsect(struct mtd_blktrans_dev *dev,
1009 unsigned long sector, unsigned nr_sects)
1010{
1011 partition_t *part = (void *)dev;
1012 uint32_t bsize = 1 << part->header.EraseUnitSize;
1013
1014 DEBUG(1, "FTL erase sector %ld for %d sectors\n",
1015 sector, nr_sects);
1016
1017 while (nr_sects) {
1018 uint32_t old_addr = part->VirtualBlockMap[sector];
1019 if (old_addr != 0xffffffff) {
1020 part->VirtualBlockMap[sector] = 0xffffffff;
1021 part->EUNInfo[old_addr/bsize].Deleted++;
1022 if (set_bam_entry(part, old_addr, 0))
1023 return -EIO;
1024 }
1025 nr_sects--;
1026 sector++;
1027 }
1028
1029 return 0;
1030}
1008/*====================================================================*/ 1031/*====================================================================*/
1009 1032
1010static void ftl_freepart(partition_t *part) 1033static void ftl_freepart(partition_t *part)
@@ -1069,6 +1092,7 @@ static struct mtd_blktrans_ops ftl_tr = {
1069 .blksize = SECTOR_SIZE, 1092 .blksize = SECTOR_SIZE,
1070 .readsect = ftl_readsect, 1093 .readsect = ftl_readsect,
1071 .writesect = ftl_writesect, 1094 .writesect = ftl_writesect,
1095 .discard = ftl_discardsect,
1072 .getgeo = ftl_getgeo, 1096 .getgeo = ftl_getgeo,
1073 .add_mtd = ftl_add_mtd, 1097 .add_mtd = ftl_add_mtd,
1074 .remove_dev = ftl_remove_dev, 1098 .remove_dev = ftl_remove_dev,
diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c
index 948b86f35ef4..d1eec7d3243f 100644
--- a/drivers/mtd/maps/amd76xrom.c
+++ b/drivers/mtd/maps/amd76xrom.c
@@ -6,7 +6,6 @@
6 6
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/version.h>
10#include <linux/kernel.h> 9#include <linux/kernel.h>
11#include <linux/init.h> 10#include <linux/init.h>
12#include <asm/io.h> 11#include <asm/io.h>
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index effaf7cdefab..1a6feb4474de 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -9,7 +9,6 @@
9 9
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/version.h>
13#include <linux/kernel.h> 12#include <linux/kernel.h>
14#include <linux/init.h> 13#include <linux/init.h>
15#include <asm/io.h> 14#include <asm/io.h>
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index aa64a4752781..bbbcdd4c8d13 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/version.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/init.h> 16#include <linux/init.h>
18#include <asm/io.h> 17#include <asm/io.h>
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index 90924fb00481..d600c2deff73 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -118,7 +118,8 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
118 DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", 118 DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x",
119 dev->offset, mrq.CardOffset); 119 dev->offset, mrq.CardOffset);
120 mrq.Page = 0; 120 mrq.Page = 0;
121 if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) { 121 ret = pcmcia_map_mem_page(win, &mrq);
122 if (ret != 0) {
122 cs_error(dev->p_dev, MapMemPage, ret); 123 cs_error(dev->p_dev, MapMemPage, ret);
123 return NULL; 124 return NULL;
124 } 125 }
@@ -326,9 +327,8 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on)
326 327
327 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); 328 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp);
328 ret = pcmcia_modify_configuration(link, &mod); 329 ret = pcmcia_modify_configuration(link, &mod);
329 if(ret != CS_SUCCESS) { 330 if (ret != 0)
330 cs_error(link, ModifyConfiguration, ret); 331 cs_error(link, ModifyConfiguration, ret);
331 }
332} 332}
333 333
334 334
@@ -368,14 +368,14 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link,
368 tuple.DesiredTuple = RETURN_FIRST_TUPLE; 368 tuple.DesiredTuple = RETURN_FIRST_TUPLE;
369 369
370 rc = pcmcia_get_first_tuple(link, &tuple); 370 rc = pcmcia_get_first_tuple(link, &tuple);
371 while(rc == CS_SUCCESS) { 371 while (rc == 0) {
372 rc = pcmcia_get_tuple_data(link, &tuple); 372 rc = pcmcia_get_tuple_data(link, &tuple);
373 if(rc != CS_SUCCESS) { 373 if (rc != 0) {
374 cs_error(link, GetTupleData, rc); 374 cs_error(link, GetTupleData, rc);
375 break; 375 break;
376 } 376 }
377 rc = pcmcia_parse_tuple(link, &tuple, &parse); 377 rc = pcmcia_parse_tuple(&tuple, &parse);
378 if(rc != CS_SUCCESS) { 378 if (rc != 0) {
379 cs_error(link, ParseTuple, rc); 379 cs_error(link, ParseTuple, rc);
380 break; 380 break;
381 } 381 }
@@ -493,18 +493,11 @@ static int pcmciamtd_config(struct pcmcia_device *link)
493 int last_ret = 0, last_fn = 0; 493 int last_ret = 0, last_fn = 0;
494 int ret; 494 int ret;
495 int i; 495 int i;
496 config_info_t t;
497 static char *probes[] = { "jedec_probe", "cfi_probe" }; 496 static char *probes[] = { "jedec_probe", "cfi_probe" };
498 int new_name = 0; 497 int new_name = 0;
499 498
500 DEBUG(3, "link=0x%p", link); 499 DEBUG(3, "link=0x%p", link);
501 500
502 DEBUG(2, "Validating CIS");
503 ret = pcmcia_validate_cis(link, NULL);
504 if(ret != CS_SUCCESS) {
505 cs_error(link, GetTupleData, ret);
506 }
507
508 card_settings(dev, link, &new_name); 501 card_settings(dev, link, &new_name);
509 502
510 dev->pcmcia_map.phys = NO_XIP; 503 dev->pcmcia_map.phys = NO_XIP;
@@ -571,10 +564,7 @@ static int pcmciamtd_config(struct pcmcia_device *link)
571 dev->pcmcia_map.map_priv_1 = (unsigned long)dev; 564 dev->pcmcia_map.map_priv_1 = (unsigned long)dev;
572 dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; 565 dev->pcmcia_map.map_priv_2 = (unsigned long)link->win;
573 566
574 DEBUG(2, "Getting configuration"); 567 dev->vpp = (vpp) ? vpp : link->socket.socket.Vpp;
575 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &t));
576 DEBUG(2, "Vcc = %d Vpp1 = %d Vpp2 = %d", t.Vcc, t.Vpp1, t.Vpp2);
577 dev->vpp = (vpp) ? vpp : t.Vpp1;
578 link->conf.Attributes = 0; 568 link->conf.Attributes = 0;
579 if(setvpp == 2) { 569 if(setvpp == 2) {
580 link->conf.Vpp = dev->vpp; 570 link->conf.Vpp = dev->vpp;
@@ -583,16 +573,10 @@ static int pcmciamtd_config(struct pcmcia_device *link)
583 } 573 }
584 574
585 link->conf.IntType = INT_MEMORY; 575 link->conf.IntType = INT_MEMORY;
586 link->conf.ConfigBase = t.ConfigBase;
587 link->conf.Status = t.Status;
588 link->conf.Pin = t.Pin;
589 link->conf.Copy = t.Copy;
590 link->conf.ExtStatus = t.ExtStatus;
591 link->conf.ConfigIndex = 0; 576 link->conf.ConfigIndex = 0;
592 link->conf.Present = t.Present;
593 DEBUG(2, "Setting Configuration"); 577 DEBUG(2, "Setting Configuration");
594 ret = pcmcia_request_configuration(link, &link->conf); 578 ret = pcmcia_request_configuration(link, &link->conf);
595 if(ret != CS_SUCCESS) { 579 if (ret != 0) {
596 cs_error(link, RequestConfiguration, ret); 580 cs_error(link, RequestConfiguration, ret);
597 if (dev->win_base) { 581 if (dev->win_base) {
598 iounmap(dev->win_base); 582 iounmap(dev->win_base);
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 0d7c88396c88..fd7a1017399a 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -1,13 +1,10 @@
1/* 1/* sun_uflash.c - Driver for user-programmable flash on
2 * 2 * Sun Microsystems SME boardsets.
3 * sun_uflash - Driver implementation for user-programmable flash
4 * present on many Sun Microsystems SME boardsets.
5 * 3 *
6 * This driver does NOT provide access to the OBP-flash for 4 * This driver does NOT provide access to the OBP-flash for
7 * safety reasons-- use <linux>/drivers/sbus/char/flash.c instead. 5 * safety reasons-- use <linux>/drivers/sbus/char/flash.c instead.
8 * 6 *
9 * Copyright (c) 2001 Eric Brower (ebrower@usa.net) 7 * Copyright (c) 2001 Eric Brower (ebrower@usa.net)
10 *
11 */ 8 */
12 9
13#include <linux/kernel.h> 10#include <linux/kernel.h>
@@ -16,8 +13,8 @@
16#include <linux/errno.h> 13#include <linux/errno.h>
17#include <linux/init.h> 14#include <linux/init.h>
18#include <linux/ioport.h> 15#include <linux/ioport.h>
19#include <asm/ebus.h> 16#include <linux/of.h>
20#include <asm/oplib.h> 17#include <linux/of_device.h>
21#include <asm/prom.h> 18#include <asm/prom.h>
22#include <asm/uaccess.h> 19#include <asm/uaccess.h>
23#include <asm/io.h> 20#include <asm/io.h>
@@ -26,67 +23,65 @@
26#include <linux/mtd/map.h> 23#include <linux/mtd/map.h>
27 24
28#define UFLASH_OBPNAME "flashprom" 25#define UFLASH_OBPNAME "flashprom"
29#define UFLASH_DEVNAME "userflash" 26#define DRIVER_NAME "sun_uflash"
27#define PFX DRIVER_NAME ": "
30 28
31#define UFLASH_WINDOW_SIZE 0x200000 29#define UFLASH_WINDOW_SIZE 0x200000
32#define UFLASH_BUSWIDTH 1 /* EBus is 8-bit */ 30#define UFLASH_BUSWIDTH 1 /* EBus is 8-bit */
33 31
34MODULE_AUTHOR("Eric Brower <ebrower@usa.net>"); 32MODULE_AUTHOR("Eric Brower <ebrower@usa.net>");
35MODULE_DESCRIPTION("User-programmable flash device on Sun Microsystems boardsets"); 33MODULE_DESCRIPTION("User-programmable flash device on Sun Microsystems boardsets");
36MODULE_SUPPORTED_DEVICE("userflash"); 34MODULE_SUPPORTED_DEVICE(DRIVER_NAME);
37MODULE_LICENSE("GPL"); 35MODULE_LICENSE("GPL");
38MODULE_VERSION("2.0"); 36MODULE_VERSION("2.1");
39 37
40static LIST_HEAD(device_list);
41struct uflash_dev { 38struct uflash_dev {
42 const char *name; /* device name */ 39 const char *name; /* device name */
43 struct map_info map; /* mtd map info */ 40 struct map_info map; /* mtd map info */
44 struct mtd_info *mtd; /* mtd info */ 41 struct mtd_info *mtd; /* mtd info */
45}; 42};
46 43
47
48struct map_info uflash_map_templ = { 44struct map_info uflash_map_templ = {
49 .name = "SUNW,???-????", 45 .name = "SUNW,???-????",
50 .size = UFLASH_WINDOW_SIZE, 46 .size = UFLASH_WINDOW_SIZE,
51 .bankwidth = UFLASH_BUSWIDTH, 47 .bankwidth = UFLASH_BUSWIDTH,
52}; 48};
53 49
54int uflash_devinit(struct linux_ebus_device *edev, struct device_node *dp) 50int uflash_devinit(struct of_device *op, struct device_node *dp)
55{ 51{
56 struct uflash_dev *up; 52 struct uflash_dev *up;
57 struct resource *res;
58 53
59 res = &edev->resource[0]; 54 if (op->resource[1].flags) {
60
61 if (edev->num_addrs != 1) {
62 /* Non-CFI userflash device-- once I find one we 55 /* Non-CFI userflash device-- once I find one we
63 * can work on supporting it. 56 * can work on supporting it.
64 */ 57 */
65 printk("%s: unsupported device at 0x%llx (%d regs): " \ 58 printk(KERN_ERR PFX "Unsupported device at %s, 0x%llx\n",
66 "email ebrower@usa.net\n", 59 dp->full_name, (unsigned long long)op->resource[0].start);
67 dp->full_name, (unsigned long long)res->start,
68 edev->num_addrs);
69 60
70 return -ENODEV; 61 return -ENODEV;
71 } 62 }
72 63
73 up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL); 64 up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL);
74 if (!up) 65 if (!up) {
66 printk(KERN_ERR PFX "Cannot allocate struct uflash_dev\n");
75 return -ENOMEM; 67 return -ENOMEM;
68 }
76 69
77 /* copy defaults and tweak parameters */ 70 /* copy defaults and tweak parameters */
78 memcpy(&up->map, &uflash_map_templ, sizeof(uflash_map_templ)); 71 memcpy(&up->map, &uflash_map_templ, sizeof(uflash_map_templ));
79 up->map.size = (res->end - res->start) + 1UL; 72
73 up->map.size = resource_size(&op->resource[0]);
80 74
81 up->name = of_get_property(dp, "model", NULL); 75 up->name = of_get_property(dp, "model", NULL);
82 if (up->name && 0 < strlen(up->name)) 76 if (up->name && 0 < strlen(up->name))
83 up->map.name = (char *)up->name; 77 up->map.name = (char *)up->name;
84 78
85 up->map.phys = res->start; 79 up->map.phys = op->resource[0].start;
86 80
87 up->map.virt = ioremap_nocache(res->start, up->map.size); 81 up->map.virt = of_ioremap(&op->resource[0], 0, up->map.size,
82 DRIVER_NAME);
88 if (!up->map.virt) { 83 if (!up->map.virt) {
89 printk("%s: Failed to map device.\n", dp->full_name); 84 printk(KERN_ERR PFX "Failed to map device.\n");
90 kfree(up); 85 kfree(up);
91 86
92 return -EINVAL; 87 return -EINVAL;
@@ -97,7 +92,7 @@ int uflash_devinit(struct linux_ebus_device *edev, struct device_node *dp)
97 /* MTD registration */ 92 /* MTD registration */
98 up->mtd = do_map_probe("cfi_probe", &up->map); 93 up->mtd = do_map_probe("cfi_probe", &up->map);
99 if (!up->mtd) { 94 if (!up->mtd) {
100 iounmap(up->map.virt); 95 of_iounmap(&op->resource[0], up->map.virt, up->map.size);
101 kfree(up); 96 kfree(up);
102 97
103 return -ENXIO; 98 return -ENXIO;
@@ -107,32 +102,34 @@ int uflash_devinit(struct linux_ebus_device *edev, struct device_node *dp)
107 102
108 add_mtd_device(up->mtd); 103 add_mtd_device(up->mtd);
109 104
110 dev_set_drvdata(&edev->ofdev.dev, up); 105 dev_set_drvdata(&op->dev, up);
111 106
112 return 0; 107 return 0;
113} 108}
114 109
115static int __devinit uflash_probe(struct of_device *dev, const struct of_device_id *match) 110static int __devinit uflash_probe(struct of_device *op, const struct of_device_id *match)
116{ 111{
117 struct linux_ebus_device *edev = to_ebus_device(&dev->dev); 112 struct device_node *dp = op->node;
118 struct device_node *dp = dev->node;
119 113
120 if (of_find_property(dp, "user", NULL)) 114 /* Flashprom must have the "user" property in order to
115 * be used by this driver.
116 */
117 if (!of_find_property(dp, "user", NULL))
121 return -ENODEV; 118 return -ENODEV;
122 119
123 return uflash_devinit(edev, dp); 120 return uflash_devinit(op, dp);
124} 121}
125 122
126static int __devexit uflash_remove(struct of_device *dev) 123static int __devexit uflash_remove(struct of_device *op)
127{ 124{
128 struct uflash_dev *up = dev_get_drvdata(&dev->dev); 125 struct uflash_dev *up = dev_get_drvdata(&op->dev);
129 126
130 if (up->mtd) { 127 if (up->mtd) {
131 del_mtd_device(up->mtd); 128 del_mtd_device(up->mtd);
132 map_destroy(up->mtd); 129 map_destroy(up->mtd);
133 } 130 }
134 if (up->map.virt) { 131 if (up->map.virt) {
135 iounmap(up->map.virt); 132 of_iounmap(&op->resource[0], up->map.virt, up->map.size);
136 up->map.virt = NULL; 133 up->map.virt = NULL;
137 } 134 }
138 135
@@ -141,7 +138,7 @@ static int __devexit uflash_remove(struct of_device *dev)
141 return 0; 138 return 0;
142} 139}
143 140
144static struct of_device_id uflash_match[] = { 141static const struct of_device_id uflash_match[] = {
145 { 142 {
146 .name = UFLASH_OBPNAME, 143 .name = UFLASH_OBPNAME,
147 }, 144 },
@@ -151,7 +148,7 @@ static struct of_device_id uflash_match[] = {
151MODULE_DEVICE_TABLE(of, uflash_match); 148MODULE_DEVICE_TABLE(of, uflash_match);
152 149
153static struct of_platform_driver uflash_driver = { 150static struct of_platform_driver uflash_driver = {
154 .name = UFLASH_DEVNAME, 151 .name = DRIVER_NAME,
155 .match_table = uflash_match, 152 .match_table = uflash_match,
156 .probe = uflash_probe, 153 .probe = uflash_probe,
157 .remove = __devexit_p(uflash_remove), 154 .remove = __devexit_p(uflash_remove),
@@ -159,7 +156,7 @@ static struct of_platform_driver uflash_driver = {
159 156
160static int __init uflash_init(void) 157static int __init uflash_init(void)
161{ 158{
162 return of_register_driver(&uflash_driver, &ebus_bus_type); 159 return of_register_driver(&uflash_driver, &of_bus_type);
163} 160}
164 161
165static void __exit uflash_exit(void) 162static void __exit uflash_exit(void)
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 9ff007c4962c..681d5aca2af4 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -32,6 +32,14 @@ struct mtd_blkcore_priv {
32 spinlock_t queue_lock; 32 spinlock_t queue_lock;
33}; 33};
34 34
35static int blktrans_discard_request(struct request_queue *q,
36 struct request *req)
37{
38 req->cmd_type = REQ_TYPE_LINUX_BLOCK;
39 req->cmd[0] = REQ_LB_OP_DISCARD;
40 return 0;
41}
42
35static int do_blktrans_request(struct mtd_blktrans_ops *tr, 43static int do_blktrans_request(struct mtd_blktrans_ops *tr,
36 struct mtd_blktrans_dev *dev, 44 struct mtd_blktrans_dev *dev,
37 struct request *req) 45 struct request *req)
@@ -44,6 +52,10 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
44 52
45 buf = req->buffer; 53 buf = req->buffer;
46 54
55 if (req->cmd_type == REQ_TYPE_LINUX_BLOCK &&
56 req->cmd[0] == REQ_LB_OP_DISCARD)
57 return !tr->discard(dev, block, nsect);
58
47 if (!blk_fs_request(req)) 59 if (!blk_fs_request(req))
48 return 0; 60 return 0;
49 61
@@ -367,6 +379,10 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
367 379
368 tr->blkcore_priv->rq->queuedata = tr; 380 tr->blkcore_priv->rq->queuedata = tr;
369 blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize); 381 blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize);
382 if (tr->discard)
383 blk_queue_set_discard(tr->blkcore_priv->rq,
384 blktrans_discard_request);
385
370 tr->blkshift = ffs(tr->blksize) - 1; 386 tr->blkshift = ffs(tr->blksize) - 1;
371 387
372 tr->blkcore_priv->thread = kthread_run(mtd_blktrans_thread, tr, 388 tr->blkcore_priv->thread = kthread_run(mtd_blktrans_thread, tr,
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index d2f331876e4c..1c74762dec89 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -26,13 +26,11 @@ static void mtd_notify_add(struct mtd_info* mtd)
26 if (!mtd) 26 if (!mtd)
27 return; 27 return;
28 28
29 device_create_drvdata(mtd_class, NULL, 29 device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
30 MKDEV(MTD_CHAR_MAJOR, mtd->index*2), 30 NULL, "mtd%d", mtd->index);
31 NULL, "mtd%d", mtd->index);
32 31
33 device_create_drvdata(mtd_class, NULL, 32 device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
34 MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1), 33 NULL, "mtd%dro", mtd->index);
35 NULL, "mtd%dro", mtd->index);
36} 34}
37 35
38static void mtd_notify_remove(struct mtd_info* mtd) 36static void mtd_notify_remove(struct mtd_info* mtd)
@@ -410,16 +408,20 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
410 408
411 case MEMGETREGIONINFO: 409 case MEMGETREGIONINFO:
412 { 410 {
413 struct region_info_user ur; 411 uint32_t ur_idx;
412 struct mtd_erase_region_info *kr;
413 struct region_info_user *ur = (struct region_info_user *) argp;
414 414
415 if (copy_from_user(&ur, argp, sizeof(struct region_info_user))) 415 if (get_user(ur_idx, &(ur->regionindex)))
416 return -EFAULT; 416 return -EFAULT;
417 417
418 if (ur.regionindex >= mtd->numeraseregions) 418 kr = &(mtd->eraseregions[ur_idx]);
419 return -EINVAL; 419
420 if (copy_to_user(argp, &(mtd->eraseregions[ur.regionindex]), 420 if (put_user(kr->offset, &(ur->offset))
421 sizeof(struct mtd_erase_region_info))) 421 || put_user(kr->erasesize, &(ur->erasesize))
422 || put_user(kr->numblocks, &(ur->numblocks)))
422 return -EFAULT; 423 return -EFAULT;
424
423 break; 425 break;
424 } 426 }
425 427
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index edb90b58a9b1..9a06dc93ee0d 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -564,10 +564,8 @@ int parse_mtd_partitions(struct mtd_info *master, const char **types,
564 564
565 for ( ; ret <= 0 && *types; types++) { 565 for ( ; ret <= 0 && *types; types++) {
566 parser = get_partition_parser(*types); 566 parser = get_partition_parser(*types);
567#ifdef CONFIG_KMOD
568 if (!parser && !request_module("%s", *types)) 567 if (!parser && !request_module("%s", *types))
569 parser = get_partition_parser(*types); 568 parser = get_partition_parser(*types);
570#endif
571 if (!parser) { 569 if (!parser) {
572 printk(KERN_NOTICE "%s partition parsing not available\n", 570 printk(KERN_NOTICE "%s partition parsing not available\n",
573 *types); 571 *types);
diff --git a/drivers/mtd/nand/alauda.c b/drivers/mtd/nand/alauda.c
index 257937cd99bf..962380394855 100644
--- a/drivers/mtd/nand/alauda.c
+++ b/drivers/mtd/nand/alauda.c
@@ -691,7 +691,7 @@ static int alauda_probe(struct usb_interface *interface,
691 al[0].port = ALAUDA_PORT_XD; 691 al[0].port = ALAUDA_PORT_XD;
692 al[1].port = ALAUDA_PORT_SM; 692 al[1].port = ALAUDA_PORT_SM;
693 693
694 info("alauda probed"); 694 dev_info(&interface->dev, "alauda probed\n");
695 alauda_check_media(al); 695 alauda_check_media(al);
696 alauda_check_media(al+1); 696 alauda_check_media(al+1);
697 697
@@ -716,7 +716,7 @@ static void alauda_disconnect(struct usb_interface *interface)
716 if (al) 716 if (al)
717 kref_put(&al->kref, alauda_delete); 717 kref_put(&al->kref, alauda_delete);
718 718
719 info("alauda gone"); 719 dev_info(&interface->dev, "alauda gone");
720} 720}
721 721
722static struct usb_driver alauda_driver = { 722static struct usb_driver alauda_driver = {
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 26d42987971f..782994ead0e8 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -145,7 +145,7 @@ static void ams_delta_hwcontrol(struct mtd_info *mtd, int cmd,
145 145
146static int ams_delta_nand_ready(struct mtd_info *mtd) 146static int ams_delta_nand_ready(struct mtd_info *mtd)
147{ 147{
148 return omap_get_gpio_datain(AMS_DELTA_GPIO_PIN_NAND_RB); 148 return gpio_get_value(AMS_DELTA_GPIO_PIN_NAND_RB);
149} 149}
150 150
151/* 151/*
@@ -185,7 +185,7 @@ static int __init ams_delta_init(void)
185 this->read_buf = ams_delta_read_buf; 185 this->read_buf = ams_delta_read_buf;
186 this->verify_buf = ams_delta_verify_buf; 186 this->verify_buf = ams_delta_verify_buf;
187 this->cmd_ctrl = ams_delta_hwcontrol; 187 this->cmd_ctrl = ams_delta_hwcontrol;
188 if (!omap_request_gpio(AMS_DELTA_GPIO_PIN_NAND_RB)) { 188 if (gpio_request(AMS_DELTA_GPIO_PIN_NAND_RB, "nand_rdy") == 0) {
189 this->dev_ready = ams_delta_nand_ready; 189 this->dev_ready = ams_delta_nand_ready;
190 } else { 190 } else {
191 this->dev_ready = NULL; 191 this->dev_ready = NULL;
diff --git a/drivers/mtd/nand/atmel_nand_ecc.h b/drivers/mtd/nand/atmel_nand_ecc.h
index 1ee7f993db1c..578c776e1356 100644
--- a/drivers/mtd/nand/atmel_nand_ecc.h
+++ b/drivers/mtd/nand/atmel_nand_ecc.h
@@ -2,6 +2,9 @@
2 * Error Corrected Code Controller (ECC) - System peripherals regsters. 2 * Error Corrected Code Controller (ECC) - System peripherals regsters.
3 * Based on AT91SAM9260 datasheet revision B. 3 * Based on AT91SAM9260 datasheet revision B.
4 * 4 *
5 * Copyright (C) 2007 Andrew Victor
6 * Copyright (C) 2007 Atmel Corporation.
7 *
5 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your 10 * Free Software Foundation; either version 2 of the License, or (at your
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c
index 761946ea45b1..92c334ff4508 100644
--- a/drivers/mtd/nand/au1550nd.c
+++ b/drivers/mtd/nand/au1550nd.c
@@ -16,7 +16,6 @@
16#include <linux/mtd/mtd.h> 16#include <linux/mtd/mtd.h>
17#include <linux/mtd/nand.h> 17#include <linux/mtd/nand.h>
18#include <linux/mtd/partitions.h> 18#include <linux/mtd/partitions.h>
19#include <linux/version.h>
20#include <asm/io.h> 19#include <asm/io.h>
21 20
22#include <asm/mach-au1x00/au1xxx.h> 21#include <asm/mach-au1x00/au1xxx.h>
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index 95345d051579..b8064bf3aee4 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -1,6 +1,9 @@
1/* 1/*
2 * Driver for One Laptop Per Child ‘CAFÉ’ controller, aka Marvell 88ALP01 2 * Driver for One Laptop Per Child ‘CAFÉ’ controller, aka Marvell 88ALP01
3 * 3 *
4 * The data sheet for this device can be found at:
5 * http://www.marvell.com/products/pcconn/88ALP01.jsp
6 *
4 * Copyright © 2006 Red Hat, Inc. 7 * Copyright © 2006 Red Hat, Inc.
5 * Copyright © 2006 David Woodhouse <dwmw2@infradead.org> 8 * Copyright © 2006 David Woodhouse <dwmw2@infradead.org>
6 */ 9 */
@@ -842,7 +845,8 @@ static void __devexit cafe_nand_remove(struct pci_dev *pdev)
842} 845}
843 846
844static struct pci_device_id cafe_nand_tbl[] = { 847static struct pci_device_id cafe_nand_tbl[] = {
845 { 0x11ab, 0x4100, PCI_ANY_ID, PCI_ANY_ID }, 848 { PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_88ALP01_NAND,
849 PCI_ANY_ID, PCI_ANY_ID },
846 { } 850 { }
847}; 851};
848 852
diff --git a/drivers/mtd/nand/cmx270_nand.c b/drivers/mtd/nand/cmx270_nand.c
index 9eba3f04783a..fa129c09bca8 100644
--- a/drivers/mtd/nand/cmx270_nand.c
+++ b/drivers/mtd/nand/cmx270_nand.c
@@ -156,7 +156,7 @@ static int cmx270_init(void)
156 int mtd_parts_nb = 0; 156 int mtd_parts_nb = 0;
157 int ret; 157 int ret;
158 158
159 if (!machine_is_armcore()) 159 if (!(machine_is_armcore() && cpu_is_pxa27x()))
160 return -ENODEV; 160 return -ENODEV;
161 161
162 ret = gpio_request(GPIO_NAND_CS, "NAND CS"); 162 ret = gpio_request(GPIO_NAND_CS, "NAND CS");
diff --git a/drivers/mtd/nand/tmio_nand.c b/drivers/mtd/nand/tmio_nand.c
index cbab654b03c8..edb1e322113d 100644
--- a/drivers/mtd/nand/tmio_nand.c
+++ b/drivers/mtd/nand/tmio_nand.c
@@ -109,7 +109,7 @@ struct tmio_nand {
109 109
110 void __iomem *ccr; 110 void __iomem *ccr;
111 void __iomem *fcr; 111 void __iomem *fcr;
112 unsigned long fcr_phys; 112 unsigned long fcr_base;
113 113
114 unsigned int irq; 114 unsigned int irq;
115 115
@@ -316,8 +316,8 @@ static int tmio_hw_init(struct platform_device *dev, struct tmio_nand *tmio)
316 tmio_iowrite8(0x81, tmio->ccr + CCR_ICC); 316 tmio_iowrite8(0x81, tmio->ccr + CCR_ICC);
317 317
318 /* (10h)BaseAddress 0x1000 spba.spba2 */ 318 /* (10h)BaseAddress 0x1000 spba.spba2 */
319 tmio_iowrite16(tmio->fcr_phys, tmio->ccr + CCR_BASE); 319 tmio_iowrite16(tmio->fcr_base, tmio->ccr + CCR_BASE);
320 tmio_iowrite16(tmio->fcr_phys >> 16, tmio->ccr + CCR_BASE + 16); 320 tmio_iowrite16(tmio->fcr_base >> 16, tmio->ccr + CCR_BASE + 2);
321 321
322 /* (04h)Command Register I/O spcmd */ 322 /* (04h)Command Register I/O spcmd */
323 tmio_iowrite8(0x02, tmio->ccr + CCR_COMMAND); 323 tmio_iowrite8(0x02, tmio->ccr + CCR_COMMAND);
@@ -395,7 +395,7 @@ static int tmio_probe(struct platform_device *dev)
395 goto err_iomap_ccr; 395 goto err_iomap_ccr;
396 } 396 }
397 397
398 tmio->fcr_phys = (unsigned long)fcr->start; 398 tmio->fcr_base = fcr->start & 0xfffff;
399 tmio->fcr = ioremap(fcr->start, fcr->end - fcr->start + 1); 399 tmio->fcr = ioremap(fcr->start, fcr->end - fcr->start + 1);
400 if (!tmio->fcr) { 400 if (!tmio->fcr) {
401 retval = -EIO; 401 retval = -EIO;