Skip to contentSkip to conversation

mtd: OneNAND: Fix onenand_block_markbad

PATCH In review Ladislav Michl 2 participants 2 messages Jun 20, 2017 – Jun 24, 2017 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: OneNAND: Fix onenand_block_markbad

commit dfe64e2c89731a3f9950d7acd8681b68df2bae03
Author: Sergey Lapin <[email protected]>
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.

---
 drivers/mtd/onenand/onenand_base.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mtd/onenand/onenand_base.c +5 -1
index 2e3d0e5c9a..8282f683a5 100644
@@ -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;
 }
 
Signature · 1 line
2.11.0
#1 lore raw
Quoted 16 lines · Ladislav Michl

commit dfe64e2c89731a3f9950d7acd8681b68df2bae03
Author: Sergey Lapin <[email protected]>
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.

Quoted 1 line

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170624/0335ee31/attachment.sig>