From patchwork Mon Oct 21 03:30:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 285106 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7FCA22C0331 for ; Mon, 21 Oct 2013 14:28:34 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VY6AG-00034v-5t; Mon, 21 Oct 2013 03:28:20 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VY6AE-0000rW-Ft; Mon, 21 Oct 2013 03:28:18 +0000 Received: from mail-db9lp0249.outbound.messaging.microsoft.com ([213.199.154.249] helo=db9outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VY6AB-0000qS-BL for linux-mtd@lists.infradead.org; Mon, 21 Oct 2013 03:28:17 +0000 Received: from mail49-db9-R.bigfish.com (10.174.16.234) by DB9EHSOBE014.bigfish.com (10.174.14.77) with Microsoft SMTP Server id 14.1.225.22; Mon, 21 Oct 2013 03:27:53 +0000 Received: from mail49-db9 (localhost [127.0.0.1]) by mail49-db9-R.bigfish.com (Postfix) with ESMTP id 9AC133C0649; Mon, 21 Oct 2013 03:27:53 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 1 X-BigFish: VS1(zzc89bh1432I4015Izz1f42h208ch1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6h1082kzz17326ah8275dh1de097h186068h8275bhz2dh2a8h839h93fhd25he5bhf0ah1288h12a5h12a9h12bdh1354h137ah13b6h1441h1504h1537h153bh162dh1631h1758h1765h18e1h190ch1946h19c3h1ad9h1b0ah1b2fh1fb3h1d0ch1d2eh1d3fh1dfeh1dffh1f5fh1fe8h1ff5h209eh1155h) Received: from mail49-db9 (localhost.localdomain [127.0.0.1]) by mail49-db9 (MessageSwitch) id 1382326072149363_10671; Mon, 21 Oct 2013 03:27:52 +0000 (UTC) Received: from DB9EHSMHS018.bigfish.com (unknown [10.174.16.234]) by mail49-db9.bigfish.com (Postfix) with ESMTP id 15B0A20544; Mon, 21 Oct 2013 03:27:52 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB9EHSMHS018.bigfish.com (10.174.14.28) with Microsoft SMTP Server (TLS) id 14.16.227.3; Mon, 21 Oct 2013 03:27:51 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.3.158.2; Mon, 21 Oct 2013 03:27:45 +0000 Received: from localhost.localdomain (udp161149uds.ap.freescale.net [10.192.242.25]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r9L3RhUk027032; Sun, 20 Oct 2013 20:27:44 -0700 Message-ID: <52649FDA.1030804@freescale.com> Date: Mon, 21 Oct 2013 11:30:34 +0800 From: Huang Shijie User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 MIME-Version: 1.0 To: Tim Harvey Subject: Re: gpmi-mtd ecc regression References: In-Reply-To: X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131020_232815_626878_E9C89812 X-CRM114-Status: GOOD ( 25.48 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [213.199.154.249 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 于 2013年10月19日 01:03, Tim Harvey 写道: > Huang, > > The patch you made to obtain ECC info from the chip > (http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/mtd/nand/gpmi-nand?id=2febcdf84b75aae627c61f0a5bf531a69299966c) > has caused a regression for an i.MX6 board I'm working with that uses > NAND and ubifs. > > I'm using a Micron MT29F8G08 > (http://download.micron.com/pdf/datasheets/flash/nand/2_4_8gb_nand_m49a.pdf) > which has: > page size: 2112 bytes (2048 + 64 bytes) > block size: 1056 words (1024 + 32 words) > plane size: 2 planes x 1024 blocks per plane > device size: 2Gb: 2048 blocks > ecc: 4bit > > The legacy_set_geometry function comes up with: > gf_len=13 > ecc_strength=8 > page_size=2112 > metadata_size=10 > ecc_chunk_size=512 > ecc_chunk_count=4 > payload_size=2048 > auxiliary_size=16 > auxiliary_status_offset=12 > block_mark_byte_offset=1999 > > and the new set_geometry_by_ecc_info comes up with: > gf_len=13 > ecc_strength=4 > page_size=2084 > metadata_size=10 > ecc_chunk_size=512 > ecc_chunk_count=4 > payload_size=2048 > auxiliary_size=16 > auxiliary_status_offset=12 > block_mark_byte_offset=2018 > block_mark_bit_offset=4 > > There are two discrepancies above: > a) ecc_strength - this part has 4bit ecc but being detected as 8? > b) page_size - the legacy function includes oob in page size, and the > new one does not > > which is correct? > In theory, both are correct. I am in an embarrass state now: [1] we can support the jffs2, when we use the set_geometry_by_ecc_info() to set the NAND layout. [2] if we still use the legacy_set_geometry() to set the NAND layout, we can not support the jffs2 for GPMI. When i submitted the gpmi to the kernel, the mtd code can not provide me the ECC info. I had to use all the OOB with legacy_set_geometry(). After i submitted several patches for mtd, it can provide us the ECC info now, so i switch to use the set_geometry_by_ecc_info(). it's easy to fix your problem with a patch like this: ----------------------------------------------------------------------------------------------------------------- drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) ----------------------------------------------------------------------------------------------------------------- But after apply this patch, the gpmi may can not support the JFFS2 any more. thanks Huang Shijie > With your patch using the new function to detect ECC from the part, > booting to a ubifs that was flashed with uboot (which incidentally > also set ecc_strength=8) I get endless ECC failures: > > [ 3.946205] UBI: attaching mtd2 to ubi0 > [ 3.946585] UBI warning: ubi_io_read: error -74 (ECC error) while > reading 64 bytes from PEB 0:0, read only 64 bytes, retry > [ 3.946785] UBI warning: ubi_io_read: error -74 (ECC error) while > reading 64 bytes from PEB 0:0, read only 64 bytes, retry > [ 3.946983] UBI warning: ubi_io_read: error -74 (ECC error) while > reading 64 bytes from PEB 0:0, read only 64 bytes, retry > [ 3.947177] UBI error: ubi_io_read: error -74 (ECC error) while > reading 64 bytes from PEB 0:0, read 64 bytes > [ 3.947186] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.12.0-rc3+ #253 > [ 3.947192] Backtrace: > [ 3.947220] [<8001265c>] (dump_backtrace+0x0/0x10c) from > [<800127fc>] (show_stack+0x18/0x1c) > [ 3.947230] r6:00000040 r5:ffffffb6 r4:00000000 r3:00000000 > [ 3.947247] [<800127e4>] (show_stack+0x0/0x1c) from [<80661820>] > (dump_stack+0x78/0x94) > [ 3.947269] [<806617a8>] (dump_stack+0x0/0x94) from [<803b4ebc>] > (ubi_io_read+0x12c/0x364) > [ 3.947274] r4:bf09e000 r3:00000000 > [ 3.947285] [<803b4d90>] (ubi_io_read+0x0/0x364) from [<803b533c>] > (ubi_io_read_ec_hdr+0x60/0x330) > [ 3.947295] [<803b52dc>] (ubi_io_read_ec_hdr+0x0/0x330) from > [<803bb2dc>] (ubi_attach+0x160/0x15f0) > [ 3.947304] [<803bb17c>] (ubi_attach+0x0/0x15f0) from [<803ae5f0>] > (ubi_attach_mtd_dev+0x794/0xf18) > [ 3.947319] [<803ade5c>] (ubi_attach_mtd_dev+0x0/0xf18) from > [<808d9850>] (ubi_init+0x1f8/0x2bc) > [ 3.947330] [<808d9658>] (ubi_init+0x0/0x2bc) from [<80008880>] > (do_one_initcall+0xdc/0x194) > [ 3.947342] [<800087a4>] (do_one_initcall+0x0/0x194) from > [<808aeb94>] (kernel_init_freeable+0x104/0x1d0) > [ 3.952386] [<808d9658>] (ubi_init+0x0/0x2bc) from [<80008880>] > (do_one_initcall+0xdc/0x194) > [ 3.960828] [<800087a4>] (do_one_initcall+0x0/0x194) from > [<808aeb94>] (kernel_init_freeable+0x104/0x1d0) > [ 3.967418] [<800087a4>] (do_one_initcall+0x0/0x194) from > [<808aeb94>] (kernel_init_freeable+0x104/0x1d0) > [ 3.967426] [<808aea90>] (kernel_init_freeable+0x0/0x1d0) from > [<8065c74c>] (kernel_init+0x10/0xec) > > Ideas? > > Thanks, > > Tim > diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand index 5a1bbc7..8eeead6 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -352,7 +352,8 @@ static int legacy_set_geometry(struct gpmi_nand_data *this) int common_nfc_set_geometry(struct gpmi_nand_data *this) { - return set_geometry_by_ecc_info(this) ? 0 : legacy_set_geometry(this); + return (legacy_set_geometry(this) == 0) ? 0 : + set_geometry_by_ecc_info(this); } struct dma_chan *get_dma_chan(struct gpmi_nand_data *this)