aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-04-21 22:51:31 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-06-05 12:39:22 -0400
commit533a0149148ccaa0199a1ee6492cd860e3c8b456 (patch)
tree56d7320628d9c583183d7bacc75747e75e579b60 /drivers/mtd
parent81d19b04a865f9fcc0ca01b20be806169ff9efb3 (diff)
mtd: nand: minor davinci_nand cleanup
Make the DaVinci NAND driver require platform_data with board-specific configuration. We can't actually do any kind of sane job of configuring it otherwise. Also fix the comment about picking the "best" ECC mode. We can't do those any more; that relied on knowing what kind of CPU we're using (they don't all support 4-bit ECC), and current policy is that drivers not have cpu_is_*() checks. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/davinci_nand.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index 0119220de7d0..68b747584bc8 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -306,6 +306,10 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
306 uint32_t val; 306 uint32_t val;
307 nand_ecc_modes_t ecc_mode; 307 nand_ecc_modes_t ecc_mode;
308 308
309 /* insist on board-specific configuration */
310 if (!pdata)
311 return -ENODEV;
312
309 /* which external chipselect will we be managing? */ 313 /* which external chipselect will we be managing? */
310 if (pdev->id < 0 || pdev->id > 3) 314 if (pdev->id < 0 || pdev->id > 3)
311 return -ENODEV; 315 return -ENODEV;
@@ -351,7 +355,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
351 info->chip.select_chip = nand_davinci_select_chip; 355 info->chip.select_chip = nand_davinci_select_chip;
352 356
353 /* options such as NAND_USE_FLASH_BBT or 16-bit widths */ 357 /* options such as NAND_USE_FLASH_BBT or 16-bit widths */
354 info->chip.options = pdata ? pdata->options : 0; 358 info->chip.options = pdata->options;
355 359
356 info->ioaddr = (uint32_t __force) vaddr; 360 info->ioaddr = (uint32_t __force) vaddr;
357 361
@@ -360,14 +364,8 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
360 info->mask_chipsel = pdata->mask_chipsel; 364 info->mask_chipsel = pdata->mask_chipsel;
361 365
362 /* use nandboot-capable ALE/CLE masks by default */ 366 /* use nandboot-capable ALE/CLE masks by default */
363 if (pdata && pdata->mask_ale) 367 info->mask_ale = pdata->mask_cle ? : MASK_ALE;
364 info->mask_ale = pdata->mask_cle; 368 info->mask_cle = pdata->mask_cle ? : MASK_CLE;
365 else
366 info->mask_ale = MASK_ALE;
367 if (pdata && pdata->mask_cle)
368 info->mask_cle = pdata->mask_cle;
369 else
370 info->mask_cle = MASK_CLE;
371 369
372 /* Set address of hardware control function */ 370 /* Set address of hardware control function */
373 info->chip.cmd_ctrl = nand_davinci_hwcontrol; 371 info->chip.cmd_ctrl = nand_davinci_hwcontrol;
@@ -377,11 +375,8 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
377 info->chip.read_buf = nand_davinci_read_buf; 375 info->chip.read_buf = nand_davinci_read_buf;
378 info->chip.write_buf = nand_davinci_write_buf; 376 info->chip.write_buf = nand_davinci_write_buf;
379 377
380 /* use board-specific ECC config; else, the best available */ 378 /* Use board-specific ECC config */
381 if (pdata) 379 ecc_mode = pdata->ecc_mode;
382 ecc_mode = pdata->ecc_mode;
383 else
384 ecc_mode = NAND_ECC_HW;
385 380
386 switch (ecc_mode) { 381 switch (ecc_mode) {
387 case NAND_ECC_NONE: 382 case NAND_ECC_NONE:
@@ -469,7 +464,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
469 info->mtd.name = master_name; 464 info->mtd.name = master_name;
470 } 465 }
471 466
472 if (mtd_parts_nb <= 0 && pdata) { 467 if (mtd_parts_nb <= 0) {
473 mtd_parts = pdata->parts; 468 mtd_parts = pdata->parts;
474 mtd_parts_nb = pdata->nr_parts; 469 mtd_parts_nb = pdata->nr_parts;
475 } 470 }
@@ -482,7 +477,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
482 info->partitioned = true; 477 info->partitioned = true;
483 } 478 }
484 479
485 } else if (pdata && pdata->nr_parts) { 480 } else if (pdata->nr_parts) {
486 dev_warn(&pdev->dev, "ignoring %d default partitions on %s\n", 481 dev_warn(&pdev->dev, "ignoring %d default partitions on %s\n",
487 pdata->nr_parts, info->mtd.name); 482 pdata->nr_parts, info->mtd.name);
488 } 483 }