Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp402939imu; Tue, 11 Dec 2018 00:42:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/UYl8cP1n6jw082r9JG7RtsOz7VQxgwP9f1ZsmRlE5TYKwgr/iuFXURPLcNy6s9PkpBtdXV X-Received: by 2002:a63:ee0e:: with SMTP id e14mr13587150pgi.8.1544517740017; Tue, 11 Dec 2018 00:42:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544517739; cv=none; d=google.com; s=arc-20160816; b=EwbV+jzAkcw42+Be4pYJ7f46sNd/QLuJmU0C3gnhxJaax/e8RnT8TE1Wk44xwexvQQ xcaniBMY7dT+NknskLUkzEnz3wJ68/2WfGoUSdGg5nTEC2kgB9PaVGFuF44bANudWJDa +npdqVY7wzzCptBnvIjB0Mp9b1tDEIZJCHbU0kAjjAqbXL0Dcl/gAha+f3wCz+nzJ0k8 JhmoQNVV/UW1rANJdBIshmh/xfIJNQpOP54GOhZ4BHZLydBHmjUA8+6OmFrueqo3bbkY jGcNAJcCDwja0uG7EgACgjhmPRmxpFSvAG+nkeaV4bL4wyY3LNrDSZuw7TNoSdhf4RxL ehcg== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=+D4nfPBTTECoktDGIe2/iNjkk0GiZIjJfWDxcDEQerQ=; b=nPmgc0IJ4ud7ytCigRC7RvuCRkt8pgcbs2LRaxlbUWvM3vTdWSk5XfjopYTOJq/0Xo 1HsS/cbWMhbjtvarm/hLYtiEBs47bCy2SshxU8LKm2exT9x0crCaeJeryzomo0nc8q9P xZuYe+lGNhZUmGmtjvtVqo8lBAcCY0jag2K0JYlNZnoeQGeCQkmu8P0+IRudrwQ5+gNH j2LzzwNbeyJUvt/f4y7VsHUccmGNfzqli7tqAbcqJGZzrMiTX334a5MM9fRSnmSxsTbt pFww/kerQsOzS4z/WdLKbvcWd8M/HvwKVc0wR9Lo0dAenY2iE9y/pTv9lCXC/5nei72Q 57ig== 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 w9si11665450pgg.72.2018.12.11.00.42.05; Tue, 11 Dec 2018 00:42:19 -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 S1726164AbeLKIjz (ORCPT + 99 others); Tue, 11 Dec 2018 03:39:55 -0500 Received: from mail.bootlin.com ([62.4.15.54]:39308 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726089AbeLKIjz (ORCPT ); Tue, 11 Dec 2018 03:39:55 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 34C7320723; Tue, 11 Dec 2018 09:39:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from bbrezillon (aaubervilliers-681-1-79-44.w90-88.abo.wanadoo.fr [90.88.21.44]) by mail.bootlin.com (Postfix) with ESMTPSA id E1DB820717; Tue, 11 Dec 2018 09:39:32 +0100 (CET) Date: Tue, 11 Dec 2018 09:39:33 +0100 From: Boris Brezillon To: Liang Yang Cc: Miquel Raynal , 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 , , , Subject: Re: [PATCH v7 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller Message-ID: <20181211093933.2fab8cc3@bbrezillon> In-Reply-To: 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> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 11 Dec 2018 09:56:25 +0800 Liang Yang wrote: > 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. Yep, raw accessors should disable both the scrambler and the ECC engine (see what's done in sunxi_nand.c).