From patchwork Fri Apr 30 10:05:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo Serra X-Patchwork-Id: 51323 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 28C66B7D11 for ; Fri, 30 Apr 2010 20:07:49 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1O7n6T-00013Q-0X; Fri, 30 Apr 2010 10:05:49 +0000 Received: from mail-pz0-f198.google.com ([209.85.222.198]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1O7n6N-000122-Lt for linux-mtd@lists.infradead.org; Fri, 30 Apr 2010 10:05:44 +0000 Received: by pzk36 with SMTP id 36so22766pzk.24 for ; Fri, 30 Apr 2010 03:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=I+TPFuox/vH8slEWmcZJqrqX4guO8SKbLxEn4wGbZ+Y=; b=G0yJ0UG6jG0Aa8Ubf+v5dkUpg4cSX61+emmqoqL7Wx9rQTFTU/MciSw4+bNzrRieiR tViA9bjzb8h69+HJogjnIV7fBevVuDyRdCv4eRM+UP2+t0yYlp/mW5Ng6EQ15xUMosQx d6y4FA1rD5LiWzVHwv3jiwwrhCW1KrTcZapvU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=T3uVH9ajxV2zHNSgkUV3pPcsTPQJ9cG74UyJOj9Prm6OPiXHoMmn2njL7A5h13LkaP +MiVF+ElJ6z2G9i0oX8vLVzkNpA83ZF+o/bF8hDaa5H2eJEQJtkkXgrx7jlgy0qCavgG +ruBIEfvNXybfn7HfXikaDsBTiN11v5A5XS4c= MIME-Version: 1.0 Received: by 10.140.55.9 with SMTP id d9mr648399rva.164.1272621941020; Fri, 30 Apr 2010 03:05:41 -0700 (PDT) Received: by 10.140.144.6 with HTTP; Fri, 30 Apr 2010 03:05:40 -0700 (PDT) Date: Fri, 30 Apr 2010 12:05:40 +0200 Message-ID: Subject: Possible bug in onenand_base ? From: =?UTF-8?Q?Enric_Balletb=C3=B2_i_Serra?= To: linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org, kyungmin.park@samsung.com X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100430_060543_827150_ACABFD28 X-CRM114-Status: UNSURE ( 8.19 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.3.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is freemail (eballetbo[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.222.198 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hello all, After commit 5988af2319781bc8e0ce418affec4e09cfa77907 (mtd: Flex-OneNAND support) the onenand support for my device is broken. Before this commit when I run the nandtest program all is ok --- # nandtest /dev/mtd3 ECC corrections: 0 ECC failures : 0 Bad blocks : 0 BBT blocks : 0 002c0000: checking... Finished pass 1 successfully -- Introduced commit 5988af2319781bc8e0ce418affec4e09cfa7790 the nandtest fails with: --- # nandtest /dev/mtd3 ECC corrections: 0 ECC failures : 0 Bad blocks : 0 BBT blocks : 0 00000000: reading... [ 299.092041] onenand_wait: ECC error = 0x8488 ( ... lots of ECC errors ... ) [ 299.092041] onenand_wait: ECC error = 0x8488 ECC failed at 00000000 00000000: checking... compare failed. seed 1804289383 Byte 0x1 is 5a should be da Byte 0x3 is 82 should be 92 Byte 0x4 is 10 should be 1a ( ... ) --- Investigating a little I see a significant difference introduced by this patch. In line 347: page = (int) (addr - onenand_addr(this, block)) >> this->page_shift; (patch applied) instead of 347: page = (int) (addr >> this->page_shift); (without patch) I applied commit 5988af2319781bc8e0ce418affec4e09cfa7790 and replaced the line 347 and now works again. Fantastic, but I suspect this is not the proper solution (probably this breaks other onenands devices, I can't test). I'm just introducing in OneNAND devices so anyone can help me to understand and solve the problem ? Note that my device is a Numonyx 4-Gbit DDP (DUAL DIE PLAN) OneNAND flash memory ( 2 dice of 2Gb, 2KB page ) Thanks in advance, ///:~Enric --- /* Make the even block number */ --- diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 081f97d..b1d50a3 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -344,7 +344,7 @@ static int onenand_command(struct mtd_info *mtd, int cmd, loff_t addr, size_t le default: block = (int) onenand_block(this, addr); - page = (int) (addr - onenand_addr(this, block)) >> this->page_shift; + page = (int) (addr >> this->page_shift); if (ONENAND_IS_2PLANE(this)) {