mtd: nand: davinci: Reinitialize the HW ECC engine in 4bit hwctl
[pandora-kernel.git] / drivers / mtd / nand / davinci_nand.c
index 1f34951..4aa25d7 100644 (file)
@@ -57,7 +57,6 @@ struct davinci_nand_info {
 
        struct device           *dev;
        struct clk              *clk;
-       bool                    partitioned;
 
        bool                    is_readmode;
 
@@ -240,6 +239,9 @@ static void nand_davinci_hwctl_4bit(struct mtd_info *mtd, int mode)
        unsigned long flags;
        u32 val;
 
+       /* Reset ECC hardware */
+       davinci_nand_readl(info, NAND_4BIT_ECC1_OFFSET);
+
        spin_lock_irqsave(&davinci_nand_lock, flags);
 
        /* Start 4-bit ECC calculation for read/write */
@@ -530,8 +532,6 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
        int                             ret;
        uint32_t                        val;
        nand_ecc_modes_t                ecc_mode;
-       struct mtd_partition            *mtd_parts = NULL;
-       int                             mtd_parts_nb = 0;
 
        /* insist on board-specific configuration */
        if (!pdata)
@@ -581,7 +581,9 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
        info->chip.chip_delay   = 0;
        info->chip.select_chip  = nand_davinci_select_chip;
 
-       /* options such as NAND_USE_FLASH_BBT or 16-bit widths */
+       /* options such as NAND_BBT_USE_FLASH */
+       info->chip.bbt_options  = pdata->bbt_options;
+       /* options such as 16-bit widths */
        info->chip.options      = pdata->options;
        info->chip.bbt_td       = pdata->bbt_td;
        info->chip.bbt_md       = pdata->bbt_md;
@@ -751,33 +753,8 @@ syndrome_done:
        if (ret < 0)
                goto err_scan;
 
-       if (mtd_has_cmdlinepart()) {
-               static const char *probes[] __initconst = {
-                       "cmdlinepart", NULL
-               };
-
-               mtd_parts_nb = parse_mtd_partitions(&info->mtd, probes,
-                                                   &mtd_parts, 0);
-       }
-
-       if (mtd_parts_nb <= 0) {
-               mtd_parts = pdata->parts;
-               mtd_parts_nb = pdata->nr_parts;
-       }
-
-       /* Register any partitions */
-       if (mtd_parts_nb > 0) {
-               ret = mtd_device_register(&info->mtd, mtd_parts,
-                                         mtd_parts_nb);
-               if (ret == 0)
-                       info->partitioned = true;
-       }
-
-       /* If there's no partition info, just package the whole chip
-        * as a single MTD device.
-        */
-       if (!info->partitioned)
-               ret = mtd_device_register(&info->mtd, NULL, 0) ? -ENODEV : 0;
+       ret = mtd_device_parse_register(&info->mtd, NULL, 0,
+                       pdata->parts, pdata->nr_parts);
 
        if (ret < 0)
                goto err_scan;
@@ -816,9 +793,6 @@ err_nomem:
 static int __exit nand_davinci_remove(struct platform_device *pdev)
 {
        struct davinci_nand_info *info = platform_get_drvdata(pdev);
-       int status;
-
-       status = mtd_device_unregister(&info->mtd);
 
        spin_lock_irq(&davinci_nand_lock);
        if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)