]> git.sur5r.net Git - u-boot/commitdiff
mtd: OneNAND: Fix onenand_block_markbad
authorLadislav Michl <ladis@linux-mips.org>
Tue, 20 Jun 2017 15:17:45 +0000 (17:17 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 23 Jun 2017 14:38:07 +0000 (10:38 -0400)
commit dfe64e2c89731a3f9950d7acd8681b68df2bae03
    Author: Sergey Lapin <slapin@ossfans.org>
    Date:   Mon Jan 14 03:46:50 2013 +0000

        mtd: resync with Linux-3.7.1

modified onenand_block_markbad to call mtd_block_markbad,
but as _block_markbad function pointer used by mtd_block_markbad
to do actual job is by default pointing back to
onenand_block_markbad there is no way this function ever
finishes its job.
Fix it by changing function body according current (4.12-rc6)
linux implementation.
Tested on IGEPv2 board with Muxed OneNAND(DDP) 512MB containing
several unerasable blocks this function marked bad.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
drivers/mtd/onenand/onenand_base.c

index 2e3d0e5c9af0087c8249846a2cdc0981969a11f1..8282f683a565d490c94f787103102a3d7ee030e4 100644 (file)
@@ -1919,6 +1919,7 @@ static int onenand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
  */
 int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
 {
+       struct onenand_chip *this = mtd->priv;
        int ret;
 
        ret = onenand_block_isbad(mtd, ofs);
@@ -1929,7 +1930,10 @@ int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
                return ret;
        }
 
-       ret = mtd_block_markbad(mtd, ofs);
+       onenand_get_device(mtd, FL_WRITING);
+       ret = this->block_markbad(mtd, ofs);
+       onenand_release_device(mtd);
+
        return ret;
 }