[U-Boot] [PATCH] mtd: nand: revive "nand scrub" command
Masahiro Yamada
yamada.m at jp.panasonic.com
Thu Dec 11 11:49:29 CET 2014
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 at jp.panasonic.com>
Cc: Scott Wood <scottwood at freescale.com>
Cc: Heiko Schocher <hs at 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
More information about the U-Boot
mailing list