From patchwork Wed Nov 27 20:52:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Ebalard X-Patchwork-Id: 3250281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 105C1C045B for ; Wed, 27 Nov 2013 20:53:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27FA0205F5 for ; Wed, 27 Nov 2013 20:53:38 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27B79205E7 for ; Wed, 27 Nov 2013 20:53:37 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vlm71-0007cS-2z; Wed, 27 Nov 2013 20:53:31 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vlm6y-0001j6-Po; Wed, 27 Nov 2013 20:53:28 +0000 Received: from [2a01:e35:139b:9f90:221:70ff:fe55:8f78] (helo=smtp.natisbad.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vlm6v-0001ia-NS; Wed, 27 Nov 2013 20:53:26 +0000 Received: by smtp.natisbad.org (Postfix, from userid 5001) id B4E572C08BD; Wed, 27 Nov 2013 21:53:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=natisbad.org; s=mail; t=1385585582; bh=9szZcgqJHuSsy0fLiZ98yj5Xag2WnYXC4pZxjdpNjps=; h=From:To:Cc:Subject:References:Date:In-Reply-To; b=cV7umfmOQ+RK9ZhybJ/hpiPjMEadLoUbaVGJT9ZKlucxSET1nkVspmueMt/JadYJL mdrm3BpOp28sPMxpBT40sv79FjvMe6fqOyXCLSgWoq0kaUZnWJjrxQXt6nEGQ2sHx+ 5k9U2kBfjxhFLgJre1izBc2GMv/tAS6r9cQVyV8A= X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from small (localhost [127.0.0.1]) by smtp.natisbad.org (Postfix) with ESMTP id C32022C088D; Wed, 27 Nov 2013 21:52:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=natisbad.org; s=mail; t=1385585573; bh=9szZcgqJHuSsy0fLiZ98yj5Xag2WnYXC4pZxjdpNjps=; h=From:To:Cc:Subject:References:Date:In-Reply-To; b=HWttZsBQhORQAk8T0+iFaBGyOd13E5yuQSUrYderU5MX4I4//PxeKaTA6VZzRzq0g YM39wDOUrQT8WUh/laqyOBpRpLjR3TTu8aNGqlVVBJlx0hGkHECSFW5pb3SkZKdq0S dy4KAFMLV9PoUbcJlyZgATSQqAecJFzcWdla1j78= From: arno@natisbad.org (Arnaud Ebalard) To: Ezequiel Garcia Subject: Re: [PATCH v5 00/14] Armada 370/XP NAND support References: <1384464339-6817-1-git-send-email-ezequiel.garcia@free-electrons.com> <87d2lp28pd.fsf@natisbad.org> <20131125120335.GD2408@localhost> <87r4a4f5gr.fsf@natisbad.org> <20131126124003.GA2344@localhost> <87zjopd240.fsf@natisbad.org> X-PGP-Key-URL: http://natisbad.org/arno@natisbad.org.asc X-Fingerprint: D3A5 B68A 839B 38A5 815A 781B B77C 0748 A7AE 341B X-Hashcash: 1:20:131127:linux-mtd@lists.infradead.org::CMG+fI8cReMChD4d:0000000000000000000000000000000003Hh X-Hashcash: 1:20:131127:ezequiel.garcia@free-electrons.com::23vFyOspt8A8lRdo:0000000000000000000000000000Ss5 X-Hashcash: 1:20:131127:linux-arm-kernel@lists.infradead.org::I63Ua5QyptQVPNuD:00000000000000000000000000nyG X-Hashcash: 1:20:131127:alior@marvell.com::kV7KB60CIhyqjmKN:000000000000000000000000000000000000000000000bbI X-Hashcash: 1:20:131127:thomas.petazzoni@free-electrons.com::KJLQ8pUTb9ZFUI+h:0000000000000000000000000028YD X-Hashcash: 1:20:131127:computersforpeace@gmail.com::i77k1BS1v9e1fuRJ:00000000000000000000000000000000004F6L X-Hashcash: 1:20:131127:gregory.clement@free-electrons.com::VdXaR7FO1xe9mp9/:0000000000000000000000000009kpi Date: Wed, 27 Nov 2013 21:52:52 +0100 In-Reply-To: <87zjopd240.fsf@natisbad.org> (Arnaud Ebalard's message of "Wed, 27 Nov 2013 21:24:47 +0100") Message-ID: <87wqjtbm8r.fsf@natisbad.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131127_155326_533664_E00AB0CF X-CRM114-Status: GOOD ( 16.35 ) X-Spam-Score: -1.2 (-) Cc: Lior Amsalem , Thomas Petazzoni , linux-mtd@lists.infradead.org, Gregory Clement , Brian Norris , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, arno@natisbad.org (Arnaud Ebalard) writes: > Well, I guess the bad block the driver put in the bbt are not that bad > in practice, i.e. they were mistakenly marked that way. I also > guess^Whope there is a some low level command I could use to simply > clear the bbt (the NAND had no bad block prior to the test). Any help > would be appreciated on that point. Replying to myself w/ the solution: just in case it happens to someone else, it's as simple as using flash_erase w/ -N option on a kernel modified (in drivers/mtd/nand/nand_base.c) to allow write to a bad block w/ the following patch: After a reboot on that modified kernel, a simple call to flash_erase using -N option will erase the badblocks: # flash_erase -N /dev/mtd4 0 0 Then, at next reboot an empty bad block table is recreated. NAND: (ID 0xf1ad) 128 MiB Bad block table not found for chip 0 Bad block table not found for chip 0 Bad block table written to 0x000007fe0000, version 0x01 Bad block table written to 0x000007fc0000, version 0x01 FPU not initialized USB 0: Host Mode USB 1: Host Mode Ezequiel, I am back in business to test a v2 ;-) Cheers, a+ ps: primary source: http://lists.infradead.org/pipermail/linux-mtd/2012-June/041969.html diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index bd39f7b..e70ef60 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2591,6 +2591,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, instr->state = MTD_ERASING; while (len) { +#if 0 /* Check if we have a bad block, we do not erase bad blocks! */ if (nand_block_checkbad(mtd, ((loff_t) page) << chip->page_shift, 0, allowbbt)) { @@ -2599,6 +2600,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, instr->state = MTD_ERASE_FAILED; goto erase_exit; } +#endif /* * Invalidate the page cache, if we erase the block which