From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751284AbdFFCEh (ORCPT ); Mon, 5 Jun 2017 22:04:37 -0400 Received: from conssluserg-06.nifty.com ([210.131.2.91]:43329 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213AbdFFCEg (ORCPT ); Mon, 5 Jun 2017 22:04:36 -0400 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com v5624KrJ010840 X-Nifty-SrcIP: [209.85.161.171] MIME-Version: 1.0 In-Reply-To: <20170330183030.14acbb47@bbrezillon> References: <1490861708-27813-1-git-send-email-yamada.masahiro@socionext.com> <1490861708-27813-2-git-send-email-yamada.masahiro@socionext.com> <20170330183030.14acbb47@bbrezillon> From: Masahiro Yamada Date: Tue, 6 Jun 2017 11:04:19 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 32/37] mtd: nand: denali: support hardware-assisted erased page detection To: Boris Brezillon Cc: linux-mtd@lists.infradead.org, Linux Kernel Mailing List , David Woodhouse , Marek Vasut , Dinh Nguyen , Artem Bityutskiy , Graham Moore , Enrico Jorns , Chuanxiao Dong , Masami Hiramatsu , Jassi Brar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Boris, 2017-03-31 1:30 GMT+09:00 Boris Brezillon : > On Thu, 30 Mar 2017 17:15:03 +0900 > Masahiro Yamada wrote: > >> Recent versions of this IP support automatic erased page detection. >> If an erased page is detected on reads, the controller does not set >> INTR__ECC_UNCOR_ERR, but INTR__ERASED_PAGE. If this feature is >> supported, the driver can use this information instead of calling >> nand_check_erased_ecc_chunk(). >> >> The detection of erased page is based on the number of zeros in the >> page; if the number of zeros is less than the value in the field >> ERASED_THRESHOLD, the page is assumed as erased. >> >> Set the ERASED_THRESHOLD to (chip->ecc.strength + 1). This is the >> worst case where all the bitflips come from the same ECC sector. >> This field is Reserved for older IP versions, so this commit has >> no impact on them. > > Do you have a way to know the actual number of bitflips in an erased > ECC block? There is no way to the actual number of bitflips except that the driver parses the whole buffer counting bitflips. > BTW, is the threshold a per-page information or a per ECC > block information. Per-page. Honestly, this hardware feature is not nice because per-chunk threshold makes sense . > If you can't know the real number of bitflips I don't think it's safe > to set the threshold to chip->ecc.strength + 1. Right. > You can still use the feature to detect erased pages without any > bitflips (set ERASED_THRESHOLD to 1), which should be the case most of > the time, but for cases where you have bitflips I'd recommend using > nand_check_erased_ecc_chunk() if you can't know the actual number of > bitflips in the page. > You are right. Probably, this feature can work safely only when ERASED_THRESHOLD == 1. I decided to drop this patch from v4 for now, but I will consider it. -- Best Regards Masahiro Yamada