aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/Kconfig2
-rw-r--r--drivers/mtd/nand/ams-delta.c12
-rw-r--r--drivers/mtd/nand/bcm_umi_nand.c13
-rw-r--r--drivers/mtd/nand/davinci_nand.c4
-rw-r--r--drivers/mtd/nand/diskonchip.c4
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c75
-rw-r--r--drivers/mtd/nand/fsl_upm.c12
-rw-r--r--drivers/mtd/nand/gpio.c115
-rw-r--r--drivers/mtd/nand/jz4740_nand.c12
-rw-r--r--drivers/mtd/nand/mpc5121_nfc.c14
-rw-r--r--drivers/mtd/nand/nand_base.c7
-rw-r--r--drivers/mtd/nand/nand_bbt.c14
-rw-r--r--drivers/mtd/nand/nand_ids.c4
-rw-r--r--drivers/mtd/nand/nandsim.c2
-rw-r--r--drivers/mtd/nand/ndfc.c13
-rw-r--r--drivers/mtd/nand/nomadik_nand.c18
-rw-r--r--drivers/mtd/nand/nuc900_nand.c13
-rw-r--r--drivers/mtd/nand/omap2.c15
-rw-r--r--drivers/mtd/nand/pasemi_nand.c12
-rw-r--r--drivers/mtd/nand/plat_nand.c13
-rw-r--r--drivers/mtd/nand/pxa3xx_nand.c16
-rw-r--r--drivers/mtd/nand/sharpsl.c12
-rw-r--r--drivers/mtd/nand/sm_common.c2
-rw-r--r--drivers/mtd/nand/socrates_nand.c13
-rw-r--r--drivers/mtd/nand/tmio_nand.c13
-rw-r--r--drivers/mtd/nand/txx9ndfmc.c6
26 files changed, 189 insertions, 247 deletions
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index dd0279249bf4..31b034b7eba3 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -110,7 +110,7 @@ config MTD_NAND_AMS_DELTA
110 110
111config MTD_NAND_OMAP2 111config MTD_NAND_OMAP2
112 tristate "NAND Flash device on OMAP2, OMAP3 and OMAP4" 112 tristate "NAND Flash device on OMAP2, OMAP3 and OMAP4"
113 depends on ARM && (ARCH_OMAP2 || ARCH_OMAP3 || ARCH_OMAP4) 113 depends on ARCH_OMAP2PLUS
114 help 114 help
115 Support for NAND flash on Texas Instruments OMAP2, OMAP3 and OMAP4 115 Support for NAND flash on Texas Instruments OMAP2, OMAP3 and OMAP4
116 platforms. 116 platforms.
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 9e6b498c9beb..3197e9764fcd 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -280,17 +280,7 @@ static struct platform_driver ams_delta_nand_driver = {
280 }, 280 },
281}; 281};
282 282
283static int __init ams_delta_nand_init(void) 283module_platform_driver(ams_delta_nand_driver);
284{
285 return platform_driver_register(&ams_delta_nand_driver);
286}
287module_init(ams_delta_nand_init);
288
289static void __exit ams_delta_nand_exit(void)
290{
291 platform_driver_unregister(&ams_delta_nand_driver);
292}
293module_exit(ams_delta_nand_exit);
294 284
295MODULE_LICENSE("GPL"); 285MODULE_LICENSE("GPL");
296MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>"); 286MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>");
diff --git a/drivers/mtd/nand/bcm_umi_nand.c b/drivers/mtd/nand/bcm_umi_nand.c
index 46b58d672847..50387fd4009b 100644
--- a/drivers/mtd/nand/bcm_umi_nand.c
+++ b/drivers/mtd/nand/bcm_umi_nand.c
@@ -546,18 +546,7 @@ static struct platform_driver nand_driver = {
546 .resume = bcm_umi_nand_resume, 546 .resume = bcm_umi_nand_resume,
547}; 547};
548 548
549static int __init nand_init(void) 549module_platform_driver(nand_driver);
550{
551 return platform_driver_register(&nand_driver);
552}
553
554static void __exit nand_exit(void)
555{
556 platform_driver_unregister(&nand_driver);
557}
558
559module_init(nand_init);
560module_exit(nand_exit);
561 550
562MODULE_LICENSE("GPL"); 551MODULE_LICENSE("GPL");
563MODULE_AUTHOR("Broadcom"); 552MODULE_AUTHOR("Broadcom");
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index c153e1f77f90..6e566156956f 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -675,7 +675,9 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
675 675
676 davinci_nand_writel(info, A1CR_OFFSET + info->core_chipsel * 4, val); 676 davinci_nand_writel(info, A1CR_OFFSET + info->core_chipsel * 4, val);
677 677
678 ret = davinci_aemif_setup_timing(info->timing, info->base, 678 ret = 0;
679 if (info->timing)
680 ret = davinci_aemif_setup_timing(info->timing, info->base,
679 info->core_chipsel); 681 info->core_chipsel);
680 if (ret < 0) { 682 if (ret < 0) {
681 dev_dbg(&pdev->dev, "NAND timing values setup fail\n"); 683 dev_dbg(&pdev->dev, "NAND timing values setup fail\n");
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index 5780dbab6113..df921e7a496c 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -1072,7 +1072,7 @@ static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const ch
1072 size_t retlen; 1072 size_t retlen;
1073 1073
1074 for (offs = 0; offs < mtd->size; offs += mtd->erasesize) { 1074 for (offs = 0; offs < mtd->size; offs += mtd->erasesize) {
1075 ret = mtd->read(mtd, offs, mtd->writesize, &retlen, buf); 1075 ret = mtd_read(mtd, offs, mtd->writesize, &retlen, buf);
1076 if (retlen != mtd->writesize) 1076 if (retlen != mtd->writesize)
1077 continue; 1077 continue;
1078 if (ret) { 1078 if (ret) {
@@ -1097,7 +1097,7 @@ static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const ch
1097 /* Only one mediaheader was found. We want buf to contain a 1097 /* Only one mediaheader was found. We want buf to contain a
1098 mediaheader on return, so we'll have to re-read the one we found. */ 1098 mediaheader on return, so we'll have to re-read the one we found. */
1099 offs = doc->mh0_page << this->page_shift; 1099 offs = doc->mh0_page << this->page_shift;
1100 ret = mtd->read(mtd, offs, mtd->writesize, &retlen, buf); 1100 ret = mtd_read(mtd, offs, mtd->writesize, &retlen, buf);
1101 if (retlen != mtd->writesize) { 1101 if (retlen != mtd->writesize) {
1102 /* Insanity. Give up. */ 1102 /* Insanity. Give up. */
1103 printk(KERN_ERR "Read DiskOnChip Media Header once, but can't reread it???\n"); 1103 printk(KERN_ERR "Read DiskOnChip Media Header once, but can't reread it???\n");
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index eedd8ee2c9ac..7195ee6efe12 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -166,15 +166,22 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
166 166
167 elbc_fcm_ctrl->page = page_addr; 167 elbc_fcm_ctrl->page = page_addr;
168 168
169 out_be32(&lbc->fbar,
170 page_addr >> (chip->phys_erase_shift - chip->page_shift));
171
172 if (priv->page_size) { 169 if (priv->page_size) {
170 /*
171 * large page size chip : FPAR[PI] save the lowest 6 bits,
172 * FBAR[BLK] save the other bits.
173 */
174 out_be32(&lbc->fbar, page_addr >> 6);
173 out_be32(&lbc->fpar, 175 out_be32(&lbc->fpar,
174 ((page_addr << FPAR_LP_PI_SHIFT) & FPAR_LP_PI) | 176 ((page_addr << FPAR_LP_PI_SHIFT) & FPAR_LP_PI) |
175 (oob ? FPAR_LP_MS : 0) | column); 177 (oob ? FPAR_LP_MS : 0) | column);
176 buf_num = (page_addr & 1) << 2; 178 buf_num = (page_addr & 1) << 2;
177 } else { 179 } else {
180 /*
181 * small page size chip : FPAR[PI] save the lowest 5 bits,
182 * FBAR[BLK] save the other bits.
183 */
184 out_be32(&lbc->fbar, page_addr >> 5);
178 out_be32(&lbc->fpar, 185 out_be32(&lbc->fpar,
179 ((page_addr << FPAR_SP_PI_SHIFT) & FPAR_SP_PI) | 186 ((page_addr << FPAR_SP_PI_SHIFT) & FPAR_SP_PI) |
180 (oob ? FPAR_SP_MS : 0) | column); 187 (oob ? FPAR_SP_MS : 0) | column);
@@ -349,20 +356,22 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
349 fsl_elbc_run_command(mtd); 356 fsl_elbc_run_command(mtd);
350 return; 357 return;
351 358
352 /* READID must read all 5 possible bytes while CEB is active */
353 case NAND_CMD_READID: 359 case NAND_CMD_READID:
354 dev_vdbg(priv->dev, "fsl_elbc_cmdfunc: NAND_CMD_READID.\n"); 360 case NAND_CMD_PARAM:
361 dev_vdbg(priv->dev, "fsl_elbc_cmdfunc: NAND_CMD %x\n", command);
355 362
356 out_be32(&lbc->fir, (FIR_OP_CM0 << FIR_OP0_SHIFT) | 363 out_be32(&lbc->fir, (FIR_OP_CM0 << FIR_OP0_SHIFT) |
357 (FIR_OP_UA << FIR_OP1_SHIFT) | 364 (FIR_OP_UA << FIR_OP1_SHIFT) |
358 (FIR_OP_RBW << FIR_OP2_SHIFT)); 365 (FIR_OP_RBW << FIR_OP2_SHIFT));
359 out_be32(&lbc->fcr, NAND_CMD_READID << FCR_CMD0_SHIFT); 366 out_be32(&lbc->fcr, command << FCR_CMD0_SHIFT);
360 /* nand_get_flash_type() reads 8 bytes of entire ID string */ 367 /*
361 out_be32(&lbc->fbcr, 8); 368 * although currently it's 8 bytes for READID, we always read
362 elbc_fcm_ctrl->read_bytes = 8; 369 * the maximum 256 bytes(for PARAM)
370 */
371 out_be32(&lbc->fbcr, 256);
372 elbc_fcm_ctrl->read_bytes = 256;
363 elbc_fcm_ctrl->use_mdr = 1; 373 elbc_fcm_ctrl->use_mdr = 1;
364 elbc_fcm_ctrl->mdr = 0; 374 elbc_fcm_ctrl->mdr = column;
365
366 set_addr(mtd, 0, 0, 0); 375 set_addr(mtd, 0, 0, 0);
367 fsl_elbc_run_command(mtd); 376 fsl_elbc_run_command(mtd);
368 return; 377 return;
@@ -407,9 +416,17 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
407 page_addr, column); 416 page_addr, column);
408 417
409 elbc_fcm_ctrl->column = column; 418 elbc_fcm_ctrl->column = column;
410 elbc_fcm_ctrl->oob = 0;
411 elbc_fcm_ctrl->use_mdr = 1; 419 elbc_fcm_ctrl->use_mdr = 1;
412 420
421 if (column >= mtd->writesize) {
422 /* OOB area */
423 column -= mtd->writesize;
424 elbc_fcm_ctrl->oob = 1;
425 } else {
426 WARN_ON(column != 0);
427 elbc_fcm_ctrl->oob = 0;
428 }
429
413 fcr = (NAND_CMD_STATUS << FCR_CMD1_SHIFT) | 430 fcr = (NAND_CMD_STATUS << FCR_CMD1_SHIFT) |
414 (NAND_CMD_SEQIN << FCR_CMD2_SHIFT) | 431 (NAND_CMD_SEQIN << FCR_CMD2_SHIFT) |
415 (NAND_CMD_PAGEPROG << FCR_CMD3_SHIFT); 432 (NAND_CMD_PAGEPROG << FCR_CMD3_SHIFT);
@@ -434,16 +451,12 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
434 (FIR_OP_CW1 << FIR_OP6_SHIFT) | 451 (FIR_OP_CW1 << FIR_OP6_SHIFT) |
435 (FIR_OP_RS << FIR_OP7_SHIFT)); 452 (FIR_OP_RS << FIR_OP7_SHIFT));
436 453
437 if (column >= mtd->writesize) { 454 if (elbc_fcm_ctrl->oob)
438 /* OOB area --> READOOB */ 455 /* OOB area --> READOOB */
439 column -= mtd->writesize;
440 fcr |= NAND_CMD_READOOB << FCR_CMD0_SHIFT; 456 fcr |= NAND_CMD_READOOB << FCR_CMD0_SHIFT;
441 elbc_fcm_ctrl->oob = 1; 457 else
442 } else {
443 WARN_ON(column != 0);
444 /* First 256 bytes --> READ0 */ 458 /* First 256 bytes --> READ0 */
445 fcr |= NAND_CMD_READ0 << FCR_CMD0_SHIFT; 459 fcr |= NAND_CMD_READ0 << FCR_CMD0_SHIFT;
446 }
447 } 460 }
448 461
449 out_be32(&lbc->fcr, fcr); 462 out_be32(&lbc->fcr, fcr);
@@ -463,7 +476,8 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
463 */ 476 */
464 if (elbc_fcm_ctrl->oob || elbc_fcm_ctrl->column != 0 || 477 if (elbc_fcm_ctrl->oob || elbc_fcm_ctrl->column != 0 ||
465 elbc_fcm_ctrl->index != mtd->writesize + mtd->oobsize) 478 elbc_fcm_ctrl->index != mtd->writesize + mtd->oobsize)
466 out_be32(&lbc->fbcr, elbc_fcm_ctrl->index); 479 out_be32(&lbc->fbcr,
480 elbc_fcm_ctrl->index - elbc_fcm_ctrl->column);
467 else 481 else
468 out_be32(&lbc->fbcr, 0); 482 out_be32(&lbc->fbcr, 0);
469 483
@@ -659,9 +673,7 @@ static int fsl_elbc_chip_init_tail(struct mtd_info *mtd)
659 if (chip->pagemask & 0xff000000) 673 if (chip->pagemask & 0xff000000)
660 al++; 674 al++;
661 675
662 /* add to ECCM mode set in fsl_elbc_init */ 676 priv->fmr |= al << FMR_AL_SHIFT;
663 priv->fmr |= (12 << FMR_CWTO_SHIFT) | /* Timeout > 12 ms */
664 (al << FMR_AL_SHIFT);
665 677
666 dev_dbg(priv->dev, "fsl_elbc_init: nand->numchips = %d\n", 678 dev_dbg(priv->dev, "fsl_elbc_init: nand->numchips = %d\n",
667 chip->numchips); 679 chip->numchips);
@@ -764,8 +776,10 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
764 priv->mtd.priv = chip; 776 priv->mtd.priv = chip;
765 priv->mtd.owner = THIS_MODULE; 777 priv->mtd.owner = THIS_MODULE;
766 778
767 /* Set the ECCM according to the settings in bootloader.*/ 779 /* set timeout to maximum */
768 priv->fmr = in_be32(&lbc->fmr) & FMR_ECCM; 780 priv->fmr = 15 << FMR_CWTO_SHIFT;
781 if (in_be32(&lbc->bank[priv->bank].or) & OR_FCM_PGS)
782 priv->fmr |= FMR_ECCM;
769 783
770 /* fill in nand_chip structure */ 784 /* fill in nand_chip structure */
771 /* set up function call table */ 785 /* set up function call table */
@@ -971,18 +985,7 @@ static struct platform_driver fsl_elbc_nand_driver = {
971 .remove = fsl_elbc_nand_remove, 985 .remove = fsl_elbc_nand_remove,
972}; 986};
973 987
974static int __init fsl_elbc_nand_init(void) 988module_platform_driver(fsl_elbc_nand_driver);
975{
976 return platform_driver_register(&fsl_elbc_nand_driver);
977}
978
979static void __exit fsl_elbc_nand_exit(void)
980{
981 platform_driver_unregister(&fsl_elbc_nand_driver);
982}
983
984module_init(fsl_elbc_nand_init);
985module_exit(fsl_elbc_nand_exit);
986 989
987MODULE_LICENSE("GPL"); 990MODULE_LICENSE("GPL");
988MODULE_AUTHOR("Freescale"); 991MODULE_AUTHOR("Freescale");
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index b4f3cc9f32fb..45df542b9c61 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -353,17 +353,7 @@ static struct platform_driver of_fun_driver = {
353 .remove = __devexit_p(fun_remove), 353 .remove = __devexit_p(fun_remove),
354}; 354};
355 355
356static int __init fun_module_init(void) 356module_platform_driver(of_fun_driver);
357{
358 return platform_driver_register(&of_fun_driver);
359}
360module_init(fun_module_init);
361
362static void __exit fun_module_exit(void)
363{
364 platform_driver_unregister(&of_fun_driver);
365}
366module_exit(fun_module_exit);
367 357
368MODULE_LICENSE("GPL"); 358MODULE_LICENSE("GPL");
369MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>"); 359MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
diff --git a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c
index 2c2060b2800e..27000a5f5f47 100644
--- a/drivers/mtd/nand/gpio.c
+++ b/drivers/mtd/nand/gpio.c
@@ -27,6 +27,9 @@
27#include <linux/mtd/nand.h> 27#include <linux/mtd/nand.h>
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/mtd/nand-gpio.h> 29#include <linux/mtd/nand-gpio.h>
30#include <linux/of.h>
31#include <linux/of_address.h>
32#include <linux/of_gpio.h>
30 33
31struct gpiomtd { 34struct gpiomtd {
32 void __iomem *io_sync; 35 void __iomem *io_sync;
@@ -171,6 +174,96 @@ static int gpio_nand_devready(struct mtd_info *mtd)
171 return gpio_get_value(gpiomtd->plat.gpio_rdy); 174 return gpio_get_value(gpiomtd->plat.gpio_rdy);
172} 175}
173 176
177#ifdef CONFIG_OF
178static const struct of_device_id gpio_nand_id_table[] = {
179 { .compatible = "gpio-control-nand" },
180 {}
181};
182MODULE_DEVICE_TABLE(of, gpio_nand_id_table);
183
184static int gpio_nand_get_config_of(const struct device *dev,
185 struct gpio_nand_platdata *plat)
186{
187 u32 val;
188
189 if (!of_property_read_u32(dev->of_node, "bank-width", &val)) {
190 if (val == 2) {
191 plat->options |= NAND_BUSWIDTH_16;
192 } else if (val != 1) {
193 dev_err(dev, "invalid bank-width %u\n", val);
194 return -EINVAL;
195 }
196 }
197
198 plat->gpio_rdy = of_get_gpio(dev->of_node, 0);
199 plat->gpio_nce = of_get_gpio(dev->of_node, 1);
200 plat->gpio_ale = of_get_gpio(dev->of_node, 2);
201 plat->gpio_cle = of_get_gpio(dev->of_node, 3);
202 plat->gpio_nwp = of_get_gpio(dev->of_node, 4);
203
204 if (!of_property_read_u32(dev->of_node, "chip-delay", &val))
205 plat->chip_delay = val;
206
207 return 0;
208}
209
210static struct resource *gpio_nand_get_io_sync_of(struct platform_device *pdev)
211{
212 struct resource *r = devm_kzalloc(&pdev->dev, sizeof(*r), GFP_KERNEL);
213 u64 addr;
214
215 if (!r || of_property_read_u64(pdev->dev.of_node,
216 "gpio-control-nand,io-sync-reg", &addr))
217 return NULL;
218
219 r->start = addr;
220 r->end = r->start + 0x3;
221 r->flags = IORESOURCE_MEM;
222
223 return r;
224}
225#else /* CONFIG_OF */
226#define gpio_nand_id_table NULL
227static inline int gpio_nand_get_config_of(const struct device *dev,
228 struct gpio_nand_platdata *plat)
229{
230 return -ENOSYS;
231}
232
233static inline struct resource *
234gpio_nand_get_io_sync_of(struct platform_device *pdev)
235{
236 return NULL;
237}
238#endif /* CONFIG_OF */
239
240static inline int gpio_nand_get_config(const struct device *dev,
241 struct gpio_nand_platdata *plat)
242{
243 int ret = gpio_nand_get_config_of(dev, plat);
244
245 if (!ret)
246 return ret;
247
248 if (dev->platform_data) {
249 memcpy(plat, dev->platform_data, sizeof(*plat));
250 return 0;
251 }
252
253 return -EINVAL;
254}
255
256static inline struct resource *
257gpio_nand_get_io_sync(struct platform_device *pdev)
258{
259 struct resource *r = gpio_nand_get_io_sync_of(pdev);
260
261 if (r)
262 return r;
263
264 return platform_get_resource(pdev, IORESOURCE_MEM, 1);
265}
266
174static int __devexit gpio_nand_remove(struct platform_device *dev) 267static int __devexit gpio_nand_remove(struct platform_device *dev)
175{ 268{
176 struct gpiomtd *gpiomtd = platform_get_drvdata(dev); 269 struct gpiomtd *gpiomtd = platform_get_drvdata(dev);
@@ -178,7 +271,7 @@ static int __devexit gpio_nand_remove(struct platform_device *dev)
178 271
179 nand_release(&gpiomtd->mtd_info); 272 nand_release(&gpiomtd->mtd_info);
180 273
181 res = platform_get_resource(dev, IORESOURCE_MEM, 1); 274 res = gpio_nand_get_io_sync(dev);
182 iounmap(gpiomtd->io_sync); 275 iounmap(gpiomtd->io_sync);
183 if (res) 276 if (res)
184 release_mem_region(res->start, resource_size(res)); 277 release_mem_region(res->start, resource_size(res));
@@ -226,9 +319,10 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
226 struct gpiomtd *gpiomtd; 319 struct gpiomtd *gpiomtd;
227 struct nand_chip *this; 320 struct nand_chip *this;
228 struct resource *res0, *res1; 321 struct resource *res0, *res1;
229 int ret; 322 struct mtd_part_parser_data ppdata = {};
323 int ret = 0;
230 324
231 if (!dev->dev.platform_data) 325 if (!dev->dev.of_node && !dev->dev.platform_data)
232 return -EINVAL; 326 return -EINVAL;
233 327
234 res0 = platform_get_resource(dev, IORESOURCE_MEM, 0); 328 res0 = platform_get_resource(dev, IORESOURCE_MEM, 0);
@@ -248,7 +342,7 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
248 goto err_map; 342 goto err_map;
249 } 343 }
250 344
251 res1 = platform_get_resource(dev, IORESOURCE_MEM, 1); 345 res1 = gpio_nand_get_io_sync(dev);
252 if (res1) { 346 if (res1) {
253 gpiomtd->io_sync = request_and_remap(res1, 4, "NAND sync", &ret); 347 gpiomtd->io_sync = request_and_remap(res1, 4, "NAND sync", &ret);
254 if (!gpiomtd->io_sync) { 348 if (!gpiomtd->io_sync) {
@@ -257,7 +351,9 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
257 } 351 }
258 } 352 }
259 353
260 memcpy(&gpiomtd->plat, dev->dev.platform_data, sizeof(gpiomtd->plat)); 354 ret = gpio_nand_get_config(&dev->dev, &gpiomtd->plat);
355 if (ret)
356 goto err_nce;
261 357
262 ret = gpio_request(gpiomtd->plat.gpio_nce, "NAND NCE"); 358 ret = gpio_request(gpiomtd->plat.gpio_nce, "NAND NCE");
263 if (ret) 359 if (ret)
@@ -316,8 +412,12 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
316 gpiomtd->plat.adjust_parts(&gpiomtd->plat, 412 gpiomtd->plat.adjust_parts(&gpiomtd->plat,
317 gpiomtd->mtd_info.size); 413 gpiomtd->mtd_info.size);
318 414
319 mtd_device_register(&gpiomtd->mtd_info, gpiomtd->plat.parts, 415 ppdata.of_node = dev->dev.of_node;
320 gpiomtd->plat.num_parts); 416 ret = mtd_device_parse_register(&gpiomtd->mtd_info, NULL, &ppdata,
417 gpiomtd->plat.parts,
418 gpiomtd->plat.num_parts);
419 if (ret)
420 goto err_wp;
321 platform_set_drvdata(dev, gpiomtd); 421 platform_set_drvdata(dev, gpiomtd);
322 422
323 return 0; 423 return 0;
@@ -352,6 +452,7 @@ static struct platform_driver gpio_nand_driver = {
352 .remove = gpio_nand_remove, 452 .remove = gpio_nand_remove,
353 .driver = { 453 .driver = {
354 .name = "gpio-nand", 454 .name = "gpio-nand",
455 .of_match_table = gpio_nand_id_table,
355 }, 456 },
356}; 457};
357 458
diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c
index e2664073a89b..ac3b9f255e00 100644
--- a/drivers/mtd/nand/jz4740_nand.c
+++ b/drivers/mtd/nand/jz4740_nand.c
@@ -423,17 +423,7 @@ static struct platform_driver jz_nand_driver = {
423 }, 423 },
424}; 424};
425 425
426static int __init jz_nand_init(void) 426module_platform_driver(jz_nand_driver);
427{
428 return platform_driver_register(&jz_nand_driver);
429}
430module_init(jz_nand_init);
431
432static void __exit jz_nand_exit(void)
433{
434 platform_driver_unregister(&jz_nand_driver);
435}
436module_exit(jz_nand_exit);
437 427
438MODULE_LICENSE("GPL"); 428MODULE_LICENSE("GPL");
439MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 429MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index 5ede64706346..c240cf1af961 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -879,19 +879,7 @@ static struct platform_driver mpc5121_nfc_driver = {
879 }, 879 },
880}; 880};
881 881
882static int __init mpc5121_nfc_init(void) 882module_platform_driver(mpc5121_nfc_driver);
883{
884 return platform_driver_register(&mpc5121_nfc_driver);
885}
886
887module_init(mpc5121_nfc_init);
888
889static void __exit mpc5121_nfc_cleanup(void)
890{
891 platform_driver_unregister(&mpc5121_nfc_driver);
892}
893
894module_exit(mpc5121_nfc_cleanup);
895 883
896MODULE_AUTHOR("Freescale Semiconductor, Inc."); 884MODULE_AUTHOR("Freescale Semiconductor, Inc.");
897MODULE_DESCRIPTION("MPC5121 NAND MTD driver"); 885MODULE_DESCRIPTION("MPC5121 NAND MTD driver");
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 3ed9c5e4d34e..35b4565050f1 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3132,8 +3132,8 @@ ident_done:
3132 * Bad block marker is stored in the last page of each block 3132 * Bad block marker is stored in the last page of each block
3133 * on Samsung and Hynix MLC devices; stored in first two pages 3133 * on Samsung and Hynix MLC devices; stored in first two pages
3134 * of each block on Micron devices with 2KiB pages and on 3134 * of each block on Micron devices with 2KiB pages and on
3135 * SLC Samsung, Hynix, Toshiba and AMD/Spansion. All others scan 3135 * SLC Samsung, Hynix, Toshiba, AMD/Spansion, and Macronix.
3136 * only the first page. 3136 * All others scan only the first page.
3137 */ 3137 */
3138 if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) && 3138 if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
3139 (*maf_id == NAND_MFR_SAMSUNG || 3139 (*maf_id == NAND_MFR_SAMSUNG ||
@@ -3143,7 +3143,8 @@ ident_done:
3143 (*maf_id == NAND_MFR_SAMSUNG || 3143 (*maf_id == NAND_MFR_SAMSUNG ||
3144 *maf_id == NAND_MFR_HYNIX || 3144 *maf_id == NAND_MFR_HYNIX ||
3145 *maf_id == NAND_MFR_TOSHIBA || 3145 *maf_id == NAND_MFR_TOSHIBA ||
3146 *maf_id == NAND_MFR_AMD)) || 3146 *maf_id == NAND_MFR_AMD ||
3147 *maf_id == NAND_MFR_MACRONIX)) ||
3147 (mtd->writesize == 2048 && 3148 (mtd->writesize == 2048 &&
3148 *maf_id == NAND_MFR_MICRON)) 3149 *maf_id == NAND_MFR_MICRON))
3149 chip->bbt_options |= NAND_BBT_SCAN2NDPAGE; 3150 chip->bbt_options |= NAND_BBT_SCAN2NDPAGE;
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 69148ae3bf58..20a112f591fe 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -201,7 +201,7 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num,
201 from += marker_len; 201 from += marker_len;
202 marker_len = 0; 202 marker_len = 0;
203 } 203 }
204 res = mtd->read(mtd, from, len, &retlen, buf); 204 res = mtd_read(mtd, from, len, &retlen, buf);
205 if (res < 0) { 205 if (res < 0) {
206 if (mtd_is_eccerr(res)) { 206 if (mtd_is_eccerr(res)) {
207 pr_info("nand_bbt: ECC error in BBT at " 207 pr_info("nand_bbt: ECC error in BBT at "
@@ -298,7 +298,7 @@ static int scan_read_raw_data(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
298 if (td->options & NAND_BBT_VERSION) 298 if (td->options & NAND_BBT_VERSION)
299 len++; 299 len++;
300 300
301 return mtd->read(mtd, offs, len, &retlen, buf); 301 return mtd_read(mtd, offs, len, &retlen, buf);
302} 302}
303 303
304/* Scan read raw data from flash */ 304/* Scan read raw data from flash */
@@ -317,7 +317,7 @@ static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
317 ops.len = min(len, (size_t)mtd->writesize); 317 ops.len = min(len, (size_t)mtd->writesize);
318 ops.oobbuf = buf + ops.len; 318 ops.oobbuf = buf + ops.len;
319 319
320 res = mtd->read_oob(mtd, offs, &ops); 320 res = mtd_read_oob(mtd, offs, &ops);
321 321
322 if (res) 322 if (res)
323 return res; 323 return res;
@@ -350,7 +350,7 @@ static int scan_write_bbt(struct mtd_info *mtd, loff_t offs, size_t len,
350 ops.oobbuf = oob; 350 ops.oobbuf = oob;
351 ops.len = len; 351 ops.len = len;
352 352
353 return mtd->write_oob(mtd, offs, &ops); 353 return mtd_write_oob(mtd, offs, &ops);
354} 354}
355 355
356static u32 bbt_get_ver_offs(struct mtd_info *mtd, struct nand_bbt_descr *td) 356static u32 bbt_get_ver_offs(struct mtd_info *mtd, struct nand_bbt_descr *td)
@@ -434,7 +434,7 @@ static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd,
434 * Read the full oob until read_oob is fixed to handle single 434 * Read the full oob until read_oob is fixed to handle single
435 * byte reads for 16 bit buswidth. 435 * byte reads for 16 bit buswidth.
436 */ 436 */
437 ret = mtd->read_oob(mtd, offs, &ops); 437 ret = mtd_read_oob(mtd, offs, &ops);
438 /* Ignore ECC errors when checking for BBM */ 438 /* Ignore ECC errors when checking for BBM */
439 if (ret && !mtd_is_bitflip_or_eccerr(ret)) 439 if (ret && !mtd_is_bitflip_or_eccerr(ret))
440 return ret; 440 return ret;
@@ -756,7 +756,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
756 /* Make it block aligned */ 756 /* Make it block aligned */
757 to &= ~((loff_t)((1 << this->bbt_erase_shift) - 1)); 757 to &= ~((loff_t)((1 << this->bbt_erase_shift) - 1));
758 len = 1 << this->bbt_erase_shift; 758 len = 1 << this->bbt_erase_shift;
759 res = mtd->read(mtd, to, len, &retlen, buf); 759 res = mtd_read(mtd, to, len, &retlen, buf);
760 if (res < 0) { 760 if (res < 0) {
761 if (retlen != len) { 761 if (retlen != len) {
762 pr_info("nand_bbt: error reading block " 762 pr_info("nand_bbt: error reading block "
@@ -769,7 +769,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
769 /* Read oob data */ 769 /* Read oob data */
770 ops.ooblen = (len >> this->page_shift) * mtd->oobsize; 770 ops.ooblen = (len >> this->page_shift) * mtd->oobsize;
771 ops.oobbuf = &buf[len]; 771 ops.oobbuf = &buf[len];
772 res = mtd->read_oob(mtd, to + mtd->writesize, &ops); 772 res = mtd_read_oob(mtd, to + mtd->writesize, &ops);
773 if (res < 0 || ops.oobretlen != ops.ooblen) 773 if (res < 0 || ops.oobretlen != ops.ooblen)
774 goto outerr; 774 goto outerr;
775 775
diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c
index 00cf1b0d6053..af4fe8ca7b5e 100644
--- a/drivers/mtd/nand/nand_ids.c
+++ b/drivers/mtd/nand/nand_ids.c
@@ -73,11 +73,12 @@ struct nand_flash_dev nand_flash_ids[] = {
73#define LP_OPTIONS (NAND_SAMSUNG_LP_OPTIONS | NAND_NO_READRDY | NAND_NO_AUTOINCR) 73#define LP_OPTIONS (NAND_SAMSUNG_LP_OPTIONS | NAND_NO_READRDY | NAND_NO_AUTOINCR)
74#define LP_OPTIONS16 (LP_OPTIONS | NAND_BUSWIDTH_16) 74#define LP_OPTIONS16 (LP_OPTIONS | NAND_BUSWIDTH_16)
75 75
76 /*512 Megabit */ 76 /* 512 Megabit */
77 {"NAND 64MiB 1,8V 8-bit", 0xA2, 0, 64, 0, LP_OPTIONS}, 77 {"NAND 64MiB 1,8V 8-bit", 0xA2, 0, 64, 0, LP_OPTIONS},
78 {"NAND 64MiB 1,8V 8-bit", 0xA0, 0, 64, 0, LP_OPTIONS}, 78 {"NAND 64MiB 1,8V 8-bit", 0xA0, 0, 64, 0, LP_OPTIONS},
79 {"NAND 64MiB 3,3V 8-bit", 0xF2, 0, 64, 0, LP_OPTIONS}, 79 {"NAND 64MiB 3,3V 8-bit", 0xF2, 0, 64, 0, LP_OPTIONS},
80 {"NAND 64MiB 3,3V 8-bit", 0xD0, 0, 64, 0, LP_OPTIONS}, 80 {"NAND 64MiB 3,3V 8-bit", 0xD0, 0, 64, 0, LP_OPTIONS},
81 {"NAND 64MiB 3,3V 8-bit", 0xF0, 0, 64, 0, LP_OPTIONS},
81 {"NAND 64MiB 1,8V 16-bit", 0xB2, 0, 64, 0, LP_OPTIONS16}, 82 {"NAND 64MiB 1,8V 16-bit", 0xB2, 0, 64, 0, LP_OPTIONS16},
82 {"NAND 64MiB 1,8V 16-bit", 0xB0, 0, 64, 0, LP_OPTIONS16}, 83 {"NAND 64MiB 1,8V 16-bit", 0xB0, 0, 64, 0, LP_OPTIONS16},
83 {"NAND 64MiB 3,3V 16-bit", 0xC2, 0, 64, 0, LP_OPTIONS16}, 84 {"NAND 64MiB 3,3V 16-bit", 0xC2, 0, 64, 0, LP_OPTIONS16},
@@ -176,6 +177,7 @@ struct nand_manufacturers nand_manuf_ids[] = {
176 {NAND_MFR_HYNIX, "Hynix"}, 177 {NAND_MFR_HYNIX, "Hynix"},
177 {NAND_MFR_MICRON, "Micron"}, 178 {NAND_MFR_MICRON, "Micron"},
178 {NAND_MFR_AMD, "AMD"}, 179 {NAND_MFR_AMD, "AMD"},
180 {NAND_MFR_MACRONIX, "Macronix"},
179 {0x0, "Unknown"} 181 {0x0, "Unknown"}
180}; 182};
181 183
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 34c03be77301..261f478f8cc3 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -737,7 +737,7 @@ static int parse_badblocks(struct nandsim *ns, struct mtd_info *mtd)
737 return -EINVAL; 737 return -EINVAL;
738 } 738 }
739 offset = erase_block_no * ns->geom.secsz; 739 offset = erase_block_no * ns->geom.secsz;
740 if (mtd->block_markbad(mtd, offset)) { 740 if (mtd_block_markbad(mtd, offset)) {
741 NS_ERR("invalid badblocks.\n"); 741 NS_ERR("invalid badblocks.\n");
742 return -EINVAL; 742 return -EINVAL;
743 } 743 }
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index f8aacf48ecdd..ec688548c880 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -294,18 +294,7 @@ static struct platform_driver ndfc_driver = {
294 .remove = __devexit_p(ndfc_remove), 294 .remove = __devexit_p(ndfc_remove),
295}; 295};
296 296
297static int __init ndfc_nand_init(void) 297module_platform_driver(ndfc_driver);
298{
299 return platform_driver_register(&ndfc_driver);
300}
301
302static void __exit ndfc_nand_exit(void)
303{
304 platform_driver_unregister(&ndfc_driver);
305}
306
307module_init(ndfc_nand_init);
308module_exit(ndfc_nand_exit);
309 298
310MODULE_LICENSE("GPL"); 299MODULE_LICENSE("GPL");
311MODULE_AUTHOR("Thomas Gleixner <tglx@linutronix.de>"); 300MODULE_AUTHOR("Thomas Gleixner <tglx@linutronix.de>");
diff --git a/drivers/mtd/nand/nomadik_nand.c b/drivers/mtd/nand/nomadik_nand.c
index b463ecfb4c1a..a86aa812ca13 100644
--- a/drivers/mtd/nand/nomadik_nand.c
+++ b/drivers/mtd/nand/nomadik_nand.c
@@ -201,7 +201,7 @@ static int nomadik_nand_suspend(struct device *dev)
201 struct nomadik_nand_host *host = dev_get_drvdata(dev); 201 struct nomadik_nand_host *host = dev_get_drvdata(dev);
202 int ret = 0; 202 int ret = 0;
203 if (host) 203 if (host)
204 ret = host->mtd.suspend(&host->mtd); 204 ret = mtd_suspend(&host->mtd);
205 return ret; 205 return ret;
206} 206}
207 207
@@ -209,7 +209,7 @@ static int nomadik_nand_resume(struct device *dev)
209{ 209{
210 struct nomadik_nand_host *host = dev_get_drvdata(dev); 210 struct nomadik_nand_host *host = dev_get_drvdata(dev);
211 if (host) 211 if (host)
212 host->mtd.resume(&host->mtd); 212 mtd_resume(&host->mtd);
213 return 0; 213 return 0;
214} 214}
215 215
@@ -228,19 +228,7 @@ static struct platform_driver nomadik_nand_driver = {
228 }, 228 },
229}; 229};
230 230
231static int __init nand_nomadik_init(void) 231module_platform_driver(nomadik_nand_driver);
232{
233 pr_info("Nomadik NAND driver\n");
234 return platform_driver_register(&nomadik_nand_driver);
235}
236
237static void __exit nand_nomadik_exit(void)
238{
239 platform_driver_unregister(&nomadik_nand_driver);
240}
241
242module_init(nand_nomadik_init);
243module_exit(nand_nomadik_exit);
244 232
245MODULE_LICENSE("GPL"); 233MODULE_LICENSE("GPL");
246MODULE_AUTHOR("ST Microelectronics (sachin.verma@st.com)"); 234MODULE_AUTHOR("ST Microelectronics (sachin.verma@st.com)");
diff --git a/drivers/mtd/nand/nuc900_nand.c b/drivers/mtd/nand/nuc900_nand.c
index fa8faedfad6e..8febe46e1105 100644
--- a/drivers/mtd/nand/nuc900_nand.c
+++ b/drivers/mtd/nand/nuc900_nand.c
@@ -364,18 +364,7 @@ static struct platform_driver nuc900_nand_driver = {
364 }, 364 },
365}; 365};
366 366
367static int __init nuc900_nand_init(void) 367module_platform_driver(nuc900_nand_driver);
368{
369 return platform_driver_register(&nuc900_nand_driver);
370}
371
372static void __exit nuc900_nand_exit(void)
373{
374 platform_driver_unregister(&nuc900_nand_driver);
375}
376
377module_init(nuc900_nand_init);
378module_exit(nuc900_nand_exit);
379 368
380MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); 369MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>");
381MODULE_DESCRIPTION("w90p910/NUC9xx nand driver!"); 370MODULE_DESCRIPTION("w90p910/NUC9xx nand driver!");
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index f745f00f3167..b3a883e2a22f 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1145,20 +1145,7 @@ static struct platform_driver omap_nand_driver = {
1145 }, 1145 },
1146}; 1146};
1147 1147
1148static int __init omap_nand_init(void) 1148module_platform_driver(omap_nand_driver);
1149{
1150 pr_info("%s driver initializing\n", DRIVER_NAME);
1151
1152 return platform_driver_register(&omap_nand_driver);
1153}
1154
1155static void __exit omap_nand_exit(void)
1156{
1157 platform_driver_unregister(&omap_nand_driver);
1158}
1159
1160module_init(omap_nand_init);
1161module_exit(omap_nand_exit);
1162 1149
1163MODULE_ALIAS("platform:" DRIVER_NAME); 1150MODULE_ALIAS("platform:" DRIVER_NAME);
1164MODULE_LICENSE("GPL"); 1151MODULE_LICENSE("GPL");
diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c
index a97264ececdb..974dbf8251c9 100644
--- a/drivers/mtd/nand/pasemi_nand.c
+++ b/drivers/mtd/nand/pasemi_nand.c
@@ -230,17 +230,7 @@ static struct platform_driver pasemi_nand_driver =
230 .remove = pasemi_nand_remove, 230 .remove = pasemi_nand_remove,
231}; 231};
232 232
233static int __init pasemi_nand_init(void) 233module_platform_driver(pasemi_nand_driver);
234{
235 return platform_driver_register(&pasemi_nand_driver);
236}
237module_init(pasemi_nand_init);
238
239static void __exit pasemi_nand_exit(void)
240{
241 platform_driver_unregister(&pasemi_nand_driver);
242}
243module_exit(pasemi_nand_exit);
244 234
245MODULE_LICENSE("GPL"); 235MODULE_LICENSE("GPL");
246MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>"); 236MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>");
diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
index ea8e1234e0e2..7f2da6953357 100644
--- a/drivers/mtd/nand/plat_nand.c
+++ b/drivers/mtd/nand/plat_nand.c
@@ -148,18 +148,7 @@ static struct platform_driver plat_nand_driver = {
148 }, 148 },
149}; 149};
150 150
151static int __init plat_nand_init(void) 151module_platform_driver(plat_nand_driver);
152{
153 return platform_driver_register(&plat_nand_driver);
154}
155
156static void __exit plat_nand_exit(void)
157{
158 platform_driver_unregister(&plat_nand_driver);
159}
160
161module_init(plat_nand_init);
162module_exit(plat_nand_exit);
163 152
164MODULE_LICENSE("GPL"); 153MODULE_LICENSE("GPL");
165MODULE_AUTHOR("Vitaly Wool"); 154MODULE_AUTHOR("Vitaly Wool");
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 9eb7f879969e..8544d6bf50a0 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1258,7 +1258,7 @@ static int pxa3xx_nand_suspend(struct platform_device *pdev, pm_message_t state)
1258 1258
1259 for (cs = 0; cs < pdata->num_cs; cs++) { 1259 for (cs = 0; cs < pdata->num_cs; cs++) {
1260 mtd = info->host[cs]->mtd; 1260 mtd = info->host[cs]->mtd;
1261 mtd->suspend(mtd); 1261 mtd_suspend(mtd);
1262 } 1262 }
1263 1263
1264 return 0; 1264 return 0;
@@ -1291,7 +1291,7 @@ static int pxa3xx_nand_resume(struct platform_device *pdev)
1291 nand_writel(info, NDSR, NDSR_MASK); 1291 nand_writel(info, NDSR, NDSR_MASK);
1292 for (cs = 0; cs < pdata->num_cs; cs++) { 1292 for (cs = 0; cs < pdata->num_cs; cs++) {
1293 mtd = info->host[cs]->mtd; 1293 mtd = info->host[cs]->mtd;
1294 mtd->resume(mtd); 1294 mtd_resume(mtd);
1295 } 1295 }
1296 1296
1297 return 0; 1297 return 0;
@@ -1311,17 +1311,7 @@ static struct platform_driver pxa3xx_nand_driver = {
1311 .resume = pxa3xx_nand_resume, 1311 .resume = pxa3xx_nand_resume,
1312}; 1312};
1313 1313
1314static int __init pxa3xx_nand_init(void) 1314module_platform_driver(pxa3xx_nand_driver);
1315{
1316 return platform_driver_register(&pxa3xx_nand_driver);
1317}
1318module_init(pxa3xx_nand_init);
1319
1320static void __exit pxa3xx_nand_exit(void)
1321{
1322 platform_driver_unregister(&pxa3xx_nand_driver);
1323}
1324module_exit(pxa3xx_nand_exit);
1325 1315
1326MODULE_LICENSE("GPL"); 1316MODULE_LICENSE("GPL");
1327MODULE_DESCRIPTION("PXA3xx NAND controller driver"); 1317MODULE_DESCRIPTION("PXA3xx NAND controller driver");
diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c
index 619d2a504788..b175c0fd8b93 100644
--- a/drivers/mtd/nand/sharpsl.c
+++ b/drivers/mtd/nand/sharpsl.c
@@ -230,17 +230,7 @@ static struct platform_driver sharpsl_nand_driver = {
230 .remove = __devexit_p(sharpsl_nand_remove), 230 .remove = __devexit_p(sharpsl_nand_remove),
231}; 231};
232 232
233static int __init sharpsl_nand_init(void) 233module_platform_driver(sharpsl_nand_driver);
234{
235 return platform_driver_register(&sharpsl_nand_driver);
236}
237module_init(sharpsl_nand_init);
238
239static void __exit sharpsl_nand_exit(void)
240{
241 platform_driver_unregister(&sharpsl_nand_driver);
242}
243module_exit(sharpsl_nand_exit);
244 234
245MODULE_LICENSE("GPL"); 235MODULE_LICENSE("GPL");
246MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); 236MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
diff --git a/drivers/mtd/nand/sm_common.c b/drivers/mtd/nand/sm_common.c
index 32ae5af7444f..774c3c266713 100644
--- a/drivers/mtd/nand/sm_common.c
+++ b/drivers/mtd/nand/sm_common.c
@@ -55,7 +55,7 @@ static int sm_block_markbad(struct mtd_info *mtd, loff_t ofs)
55 ops.datbuf = NULL; 55 ops.datbuf = NULL;
56 56
57 57
58 ret = mtd->write_oob(mtd, ofs, &ops); 58 ret = mtd_write_oob(mtd, ofs, &ops);
59 if (ret < 0 || ops.oobretlen != SM_OOB_SIZE) { 59 if (ret < 0 || ops.oobretlen != SM_OOB_SIZE) {
60 printk(KERN_NOTICE 60 printk(KERN_NOTICE
61 "sm_common: can't mark sector at %i as bad\n", 61 "sm_common: can't mark sector at %i as bad\n",
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c
index 0fb24f9c2327..e02b08bcf0c0 100644
--- a/drivers/mtd/nand/socrates_nand.c
+++ b/drivers/mtd/nand/socrates_nand.c
@@ -273,18 +273,7 @@ static struct platform_driver socrates_nand_driver = {
273 .remove = __devexit_p(socrates_nand_remove), 273 .remove = __devexit_p(socrates_nand_remove),
274}; 274};
275 275
276static int __init socrates_nand_init(void) 276module_platform_driver(socrates_nand_driver);
277{
278 return platform_driver_register(&socrates_nand_driver);
279}
280
281static void __exit socrates_nand_exit(void)
282{
283 platform_driver_unregister(&socrates_nand_driver);
284}
285
286module_init(socrates_nand_init);
287module_exit(socrates_nand_exit);
288 277
289MODULE_LICENSE("GPL"); 278MODULE_LICENSE("GPL");
290MODULE_AUTHOR("Ilya Yanok"); 279MODULE_AUTHOR("Ilya Yanok");
diff --git a/drivers/mtd/nand/tmio_nand.c b/drivers/mtd/nand/tmio_nand.c
index beebd95f7690..6caa0cd9d6a7 100644
--- a/drivers/mtd/nand/tmio_nand.c
+++ b/drivers/mtd/nand/tmio_nand.c
@@ -533,18 +533,7 @@ static struct platform_driver tmio_driver = {
533 .resume = tmio_resume, 533 .resume = tmio_resume,
534}; 534};
535 535
536static int __init tmio_init(void) 536module_platform_driver(tmio_driver);
537{
538 return platform_driver_register(&tmio_driver);
539}
540
541static void __exit tmio_exit(void)
542{
543 platform_driver_unregister(&tmio_driver);
544}
545
546module_init(tmio_init);
547module_exit(tmio_exit);
548 537
549MODULE_LICENSE("GPL v2"); 538MODULE_LICENSE("GPL v2");
550MODULE_AUTHOR("Ian Molton, Dirk Opfer, Chris Humbert, Dmitry Baryshkov"); 539MODULE_AUTHOR("Ian Molton, Dirk Opfer, Chris Humbert, Dmitry Baryshkov");
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c
index ace46fdaef58..c7c4f1d11c77 100644
--- a/drivers/mtd/nand/txx9ndfmc.c
+++ b/drivers/mtd/nand/txx9ndfmc.c
@@ -298,11 +298,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
298 drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL); 298 drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL);
299 if (!drvdata) 299 if (!drvdata)
300 return -ENOMEM; 300 return -ENOMEM;
301 if (!devm_request_mem_region(&dev->dev, res->start, 301 drvdata->base = devm_request_and_ioremap(&dev->dev, res);
302 resource_size(res), dev_name(&dev->dev)))
303 return -EBUSY;
304 drvdata->base = devm_ioremap(&dev->dev, res->start,
305 resource_size(res));
306 if (!drvdata->base) 302 if (!drvdata->base)
307 return -EBUSY; 303 return -EBUSY;
308 304