From patchwork Thu Dec 11 10:49:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 420012 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A3B2514009B for ; Thu, 11 Dec 2014 21:50:04 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 800194B884; Thu, 11 Dec 2014 11:50:00 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NtDe3e0FOpV9; Thu, 11 Dec 2014 11:49:59 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6AD9D4B83F; Thu, 11 Dec 2014 11:49:59 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5BB704B83F for ; Thu, 11 Dec 2014 11:49:54 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QIrKqMOuh7xJ for ; Thu, 11 Dec 2014 11:49:54 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp.mei.co.jp (smtp.mei.co.jp [133.183.100.20]) by theia.denx.de (Postfix) with ESMTP id A0A9F4B829 for ; Thu, 11 Dec 2014 11:49:49 +0100 (CET) Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile13) with ESMTP id sBBAnYiq000008; Thu, 11 Dec 2014 19:49:34 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili15) with ESMTP id sBBAnYB26772; Thu, 11 Dec 2014 19:49:34 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi14) id sBBAnYpx018251; Thu, 11 Dec 2014 19:49:34 +0900 Received: from poodle by lomi14.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id sBBAnYNI018232; Thu, 11 Dec 2014 19:49:34 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 309F52743A5C; Thu, 11 Dec 2014 19:49:34 +0900 (JST) From: Masahiro Yamada To: u-boot@lists.denx.de Date: Thu, 11 Dec 2014 19:49:29 +0900 Message-Id: <1418294969-7116-1-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.9.1 Cc: Scott Wood , Marek Vasut Subject: [U-Boot] [PATCH] mtd: nand: revive "nand scrub" command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 Cc: Scott Wood Cc: Heiko Schocher --- 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 {