aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/davinci_nand.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand/davinci_nand.c')
-rw-r--r--drivers/mtd/nand/davinci_nand.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index 1f34951ae1a7..c153e1f77f90 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -57,7 +57,6 @@ struct davinci_nand_info {
57 57
58 struct device *dev; 58 struct device *dev;
59 struct clk *clk; 59 struct clk *clk;
60 bool partitioned;
61 60
62 bool is_readmode; 61 bool is_readmode;
63 62
@@ -530,8 +529,6 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
530 int ret; 529 int ret;
531 uint32_t val; 530 uint32_t val;
532 nand_ecc_modes_t ecc_mode; 531 nand_ecc_modes_t ecc_mode;
533 struct mtd_partition *mtd_parts = NULL;
534 int mtd_parts_nb = 0;
535 532
536 /* insist on board-specific configuration */ 533 /* insist on board-specific configuration */
537 if (!pdata) 534 if (!pdata)
@@ -581,7 +578,9 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
581 info->chip.chip_delay = 0; 578 info->chip.chip_delay = 0;
582 info->chip.select_chip = nand_davinci_select_chip; 579 info->chip.select_chip = nand_davinci_select_chip;
583 580
584 /* options such as NAND_USE_FLASH_BBT or 16-bit widths */ 581 /* options such as NAND_BBT_USE_FLASH */
582 info->chip.bbt_options = pdata->bbt_options;
583 /* options such as 16-bit widths */
585 info->chip.options = pdata->options; 584 info->chip.options = pdata->options;
586 info->chip.bbt_td = pdata->bbt_td; 585 info->chip.bbt_td = pdata->bbt_td;
587 info->chip.bbt_md = pdata->bbt_md; 586 info->chip.bbt_md = pdata->bbt_md;
@@ -751,33 +750,8 @@ syndrome_done:
751 if (ret < 0) 750 if (ret < 0)
752 goto err_scan; 751 goto err_scan;
753 752
754 if (mtd_has_cmdlinepart()) { 753 ret = mtd_device_parse_register(&info->mtd, NULL, 0,
755 static const char *probes[] __initconst = { 754 pdata->parts, pdata->nr_parts);
756 "cmdlinepart", NULL
757 };
758
759 mtd_parts_nb = parse_mtd_partitions(&info->mtd, probes,
760 &mtd_parts, 0);
761 }
762
763 if (mtd_parts_nb <= 0) {
764 mtd_parts = pdata->parts;
765 mtd_parts_nb = pdata->nr_parts;
766 }
767
768 /* Register any partitions */
769 if (mtd_parts_nb > 0) {
770 ret = mtd_device_register(&info->mtd, mtd_parts,
771 mtd_parts_nb);
772 if (ret == 0)
773 info->partitioned = true;
774 }
775
776 /* If there's no partition info, just package the whole chip
777 * as a single MTD device.
778 */
779 if (!info->partitioned)
780 ret = mtd_device_register(&info->mtd, NULL, 0) ? -ENODEV : 0;
781 755
782 if (ret < 0) 756 if (ret < 0)
783 goto err_scan; 757 goto err_scan;
@@ -816,9 +790,6 @@ err_nomem:
816static int __exit nand_davinci_remove(struct platform_device *pdev) 790static int __exit nand_davinci_remove(struct platform_device *pdev)
817{ 791{
818 struct davinci_nand_info *info = platform_get_drvdata(pdev); 792 struct davinci_nand_info *info = platform_get_drvdata(pdev);
819 int status;
820
821 status = mtd_device_unregister(&info->mtd);
822 793
823 spin_lock_irq(&davinci_nand_lock); 794 spin_lock_irq(&davinci_nand_lock);
824 if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME) 795 if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)