public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mtd: nand: revive "nand scrub" command
@ 2014-12-11 10:49 Masahiro Yamada
  2014-12-11 20:37 ` Scott Wood
  0 siblings, 1 reply; 13+ messages in thread
From: Masahiro Yamada @ 2014-12-11 10:49 UTC (permalink / raw)
  To: u-boot

Since commit ff94bc40af34 (mtd, ubi, ubifs: resync with Linux-3.14),
the "nand scrub" command has not been working.

The scrub is a U-Boot extension and we have to modify nand_base.c
that originates in Linux.

Mark the code with #ifdef __UBOOT__ so we will never accidentally
drop it when we re-sync the NAND framework with Linux in the future.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Heiko Schocher <hs@denx.de>
---

 drivers/mtd/nand/nand_base.c | 5 +++++
 include/linux/mtd/mtd.h      | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 70e780c..83bd033 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2905,8 +2905,13 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
 		WATCHDOG_RESET();
 
 		/* Check if we have a bad block, we do not erase bad blocks! */
+#ifdef __UBOOT__
+		if (!instr->scrub && nand_block_checkbad(mtd, ((loff_t) page) <<
+					chip->page_shift, 0, allowbbt)) {
+#else
 		if (nand_block_checkbad(mtd, ((loff_t) page) <<
 					chip->page_shift, 0, allowbbt)) {
+#endif
 			pr_warn("%s: attempt to erase a bad block at page 0x%08x\n",
 				    __func__, page);
 			instr->state = MTD_ERASE_FAILED;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 8666413..2b4e218 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -52,7 +52,9 @@ struct erase_info {
 	u_long priv;
 	u_char state;
 	struct erase_info *next;
+#ifdef __UBOOT__
 	int scrub;
+#endif
 };
 
 struct mtd_erase_region_info {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-12-16  6:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-11 10:49 [U-Boot] [PATCH] mtd: nand: revive "nand scrub" command Masahiro Yamada
2014-12-11 20:37 ` Scott Wood
2014-12-11 21:37   ` Marek Vasut
2014-12-11 21:43     ` Scott Wood
2014-12-12  6:19       ` Heiko Schocher
2014-12-15 10:54         ` Masahiro Yamada
2014-12-15 11:13           ` Marek Vasut
2014-12-15 23:08             ` Scott Wood
2014-12-16  1:26               ` Tom Rini
2014-12-16  6:21                 ` Heiko Schocher
2014-12-16  6:24                   ` Scott Wood
2014-12-16  6:39                     ` Heiko Schocher
2014-12-16  6:41                     ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox