Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp448467imu; Tue, 11 Dec 2018 01:44:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/UpGjrD1B+XoGLvQUmsNJzmscKpn6U+jxKlA0bUhNxjrMxjdxbeiLMWYSCU9sELzbJzEjc1 X-Received: by 2002:a63:b30f:: with SMTP id i15mr14012860pgf.240.1544521452148; Tue, 11 Dec 2018 01:44:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544521452; cv=none; d=google.com; s=arc-20160816; b=jOzE06QYZroOgEPMF6lA2FSYq3nPlf0tpYpOHE++p31sX4YB9zE4q9ST6LB0Vvy9jn mmmL1ibKTt7LcOoocdsxndskom82BPqeloBOhU8kdQ4adxC42oXh/Gxqr/LR60laSwc6 DdltcmZZGONEjWc2r0mqzVeuoMYPWeISP2NUxrdndc+izng3+pqDtYZOGrWrSrJeasat azXdGOMyS6LrVET9+JG33pOuO751EoIYVXluWzqXTrfNk/5VDvMd36QTJG31CCzG0++X EOrLjD9y4gJU2bzF+XJ8BoN4+BzrF16SYDsgCtB6CmkId1RHkJyTuV21GVXbQkPQfBav 1WRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=WCclXw2FF3qWKyQndSelfRDr9Hq+N+1OxhCMo5ixQcU=; b=J4uuzRKOqK3ZyUumD6VVy2EyCWOJR/eHtdfAg7ncVcK48reIUrtjxLTBBWmokcaq1v MIoM+3iwF0DAphqTZrf8AEmZmElv2XW/PHfb03q7evoB2mh9VXyfXZYZmuxTTVhp43Va DQrIalBenCecHpEGx2A6cCjbmDjMgetIoLnn4ioWNdohcajrWsglcmr7xR7EEhO66vdV ws99kBpRAzdiSOr1mgGT1fp2US5ORFF6nfJ0sn+ly6uv04g2gzDtkoqZ5SKo84W9IS4C aTmhxNIdN0D0ut8GQ/TQkHLky0eq3PjoG8Zu9E4AWt9gxnDmsBY/kzdvwiJbJaGLHjxD cfBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24si11814951pgb.489.2018.12.11.01.43.55; Tue, 11 Dec 2018 01:44:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726202AbeLKJmz (ORCPT + 99 others); Tue, 11 Dec 2018 04:42:55 -0500 Received: from mail-sz2.amlogic.com ([211.162.65.114]:7702 "EHLO mail-sz2.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726114AbeLKJmz (ORCPT ); Tue, 11 Dec 2018 04:42:55 -0500 Received: from [10.28.18.115] (10.28.18.115) by mail-sz2.amlogic.com (10.28.11.6) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Tue, 11 Dec 2018 17:43:11 +0800 Subject: Re: [PATCH v7 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller To: Miquel Raynal CC: Boris Brezillon , Jianxin Pan , , Yixun Lan , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Jerome Brunet , Neil Armstrong , Martin Blumenstingl , Carlo Caione , Kevin Hilman , Rob Herring , Jian Hu , Hanjie Lin , Victor Wan , , , References: <1542386439-30166-1-git-send-email-jianxin.pan@amlogic.com> <1542386439-30166-3-git-send-email-jianxin.pan@amlogic.com> <20181207102456.1dc67e07@xps13> <823825a3-86fb-9a20-ae29-85cc52d44093@amlogic.com> <20181210123809.5ade45c4@bbrezillon> <79a797c2-f37f-7f7c-e907-2d3c2283ec2d@amlogic.com> <20181210155057.38788656@xps13> <20181211085445.68e57e0e@xps13> <356aed95-518d-7cd0-4337-184f181472ad@amlogic.com> <20181211100718.51d2cd6c@xps13> From: Liang Yang Message-ID: Date: Tue, 11 Dec 2018 17:43:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <20181211100718.51d2cd6c@xps13> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.28.18.115] X-ClientProxiedBy: mail-sz2.amlogic.com (10.28.11.6) To mail-sz2.amlogic.com (10.28.11.6) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miquel, On 2018/12/11 17:07, Miquel Raynal wrote: > Hi Liang, > > Liang Yang wrote on Tue, 11 Dec 2018 16:36:47 > +0800: > >> Hi Miquel, >> >> Thanks for your quickly reply. >> >> On 2018/12/11 15:54, Miquel Raynal wrote: >>> Hi Liang, >>> >>> Liang Yang wrote on Tue, 11 Dec 2018 09:56:25 >>> +0800: >>> >>>> Hi Miquel, >>>> >>>> On 2018/12/10 22:50, Miquel Raynal wrote: >>>>> Hi Liang, >>>>> >>>>> Liang Yang wrote on Mon, 10 Dec 2018 20:12:39 >>>>> +0800: >>>>> >>>> On 2018/12/10 19:38, Boris Brezillon wrote: >>>>>>> On Mon, 10 Dec 2018 19:23:46 +0800 >>>>>>> Liang Yang wrote: >>>>>>> >>>>>> + mtd->ecc_stats.failed++; >>>>>>>>>> + continue; >>>>>>>>>> + } >>>>>>>>>> + mtd->ecc_stats.corrected += ECC_ERR_CNT(*info); >>>>>>>>>> + bitflips = max_t(u32, bitflips, ECC_ERR_CNT(*info)); >>>>>>>>>> + } >>>>>>>>> >>>>>>>>> Are you sure you handle correctly empty pages with bf? >>>>>>>>> >> if scramble is enable, i would say yes here. >>>>>>>> when scramble is disabled, i am considering how to use the helper >>>>>>>> nand_check_erased_ecc_chunk, but it seems that i can't get the ecc >>>>>>>> bytes which is caculated by ecc engine.by the way, nfc dma doesn't send >>>>>>>> out the ecc parity bytes. >>>>>>> >>>>>>> Even if the ECC engine is disabled? >>>>>>> >> No. >>>>>> When ECC engine is disabled, it can read the ecc parity bytes ; but there is another problem that i need to consider how code struct looks better when reading error with ecc opened and then try to raw read. >>>>>> Is there a good idea? >>>>> >>>>> When reading with ECC enabled, in case of uncorrectable error you >>>>> must re-read without ECC, then check if the page is empty or not with >>>>> the core helpers (nand_check_erased_*()). >>>>> >>>>> Is this what you meant? >>>>> >> yes. when uncorrectable ECC error, i need firstly read out the ECC bytes without ECC engine and then use the helper nand_check_erased_ecc_chunk to check if blank page. >>>> Of course, the precondition is without scrambler, or the bland page can be detected by meson NFC. >>> >>> A suppose you meant "blank page"? If yes, then you don't need the >>> helper to check for only-0xFF pages. If the controller tells you if the >>> page was blank, then just check for that bit. >>> >> >> i think not. we need to return back the previous problem that how i can get the bitflips of one blank page. i think i need the helper. > > You are right, I suppose the "blank page" flag is only triggered if > there is no bitflip. In this case you can assume there are no > bitflips. Otherwise the controller will trigger an > uncorrectable error event and you will have to re-read the page > without ECC and check for bitflips with the helper. > yes, that is right. i will do the "re-read" process. > > Thanks, > Miquèl > > . >