Received: by 10.223.176.5 with SMTP id f5csp3996772wra; Tue, 30 Jan 2018 00:05:50 -0800 (PST) X-Google-Smtp-Source: AH8x227079Y5+9sDIvRBzznE+aZXjcXh8N2+jzDwmvOLJKhbeYDQcMInp4wO2nq1npG0kDGexIIq X-Received: by 2002:a17:902:40a:: with SMTP id 10-v6mr24152554ple.88.1517299550567; Tue, 30 Jan 2018 00:05:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517299550; cv=none; d=google.com; s=arc-20160816; b=K7rUI6gzhMYcs/POyjZMn8n3p/m2XPlC0lCu78U575Yz6XrH86i6N2ni7HyIZYxpzZ i5Y4wLUW91no/TQpmSqCYYDYwRSTXHKacYlayG1lGcBR40GfuTCVdjnRxUd1iEszTbBm ADQ0HXKoRXf+m+sPcGwSOSnigMb1bsrHgAAqoiZbZwWmjImuLtzkUgobJzofHnIAhZxp w7p9V0uvFzFWFRkJUZEGpm4z+OJ39dGMVB4+ac8FzaZre6i2WFA5brl/KRNqb3UPliaL RAhxazFH9gSuL36TpfRyB5i2j3xqwBZfsEmioQGqGNsQDfVD/AkpO28N0kNMfyvjG3Bx atyQ== 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 :arc-authentication-results; bh=lQOlof1kPeicnSq5yvC8TkSsoER3I+6MVD+TlfdNLJQ=; b=YLHznBVgSnnZSeE/HlK20lbYyfT5NdX6rvMJyfE+lcUQggoBh0kWE/+sOwuqjKkKhf GRPxADpb6ZTQIoW+j23SNrP1m+EybWJDa6YUhRwWc6ToAdXTPzRgrNmxGD3daqqBvfw2 exGdCYTZGPlfOMEI5yl1aMK16URBUtALt0c/NRSrFM6rFF9I7XLpYfRvK2RmeIku/5j/ hnThVClAgfHDlDsI1Q0GBM9Hlfow7dstNiwBJcBN0fGPgdZPSjEOcnGS/n515ikC7gXw FNMrkJQ+t7ldqJYWJ+lUnljdx5DG0tQl6gbaRDn+x+STfYG+L1FrDOCzGrecphvt419a d3Ig== 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 g5-v6si2498427plp.615.2018.01.30.00.05.36; Tue, 30 Jan 2018 00:05:50 -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 S1751916AbeA3IFB (ORCPT + 99 others); Tue, 30 Jan 2018 03:05:01 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:60599 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751511AbeA3IE7 (ORCPT ); Tue, 30 Jan 2018 03:04:59 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id C3323219D7; Tue, 30 Jan 2018 09:04:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.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.0 Received: from bbrezillon (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 6A25B219AA; Tue, 30 Jan 2018 09:04:47 +0100 (CET) Date: Tue, 30 Jan 2018 09:04:46 +0100 From: Boris Brezillon To: KOBAYASHI Yoshitake Cc: richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, cyrille.pitchen@wedev4u.fr, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next v3 1/2] mtd: nand: toshiba: Retrieve ECC requirements from extended ID Message-ID: <20180130090446.1ace92b3@bbrezillon> In-Reply-To: <0cf2e0f7-e61b-2cae-f216-e616aecf3e76@toshiba.co.jp> References: <1512569098-30038-1-git-send-email-yoshitake.kobayashi@toshiba.co.jp> <1512569098-30038-2-git-send-email-yoshitake.kobayashi@toshiba.co.jp> <20171206160805.2435094b@bbrezillon> <3e11d966-0801-96f2-8417-194b36a0b775@toshiba.co.jp> <20171219125624.58e3e8f8@bbrezillon> <0cf2e0f7-e61b-2cae-f216-e616aecf3e76@toshiba.co.jp> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; 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, 30 Jan 2018 08:44:30 +0900 KOBAYASHI Yoshitake wrote: > On 2017/12/27 15:06, KOBAYASHI Yoshitake wrote: > > On 2017/12/19 20:56, Boris Brezillon wrote: > >> On Tue, 19 Dec 2017 20:42:36 +0900 > >> KOBAYASHI Yoshitake wrote: > >> > >>> On 2017/12/07 0:08, Boris Brezillon wrote: > >>>> On Wed, 6 Dec 2017 23:04:57 +0900 > >>>> KOBAYASHI Yoshitake wrote: > >>>> > >>>>> This patch enables support to read the ECC strength and size from the > >>>>> NAND flash using Toshiba Memory SLC NAND extended-ID. This patch is > >>>>> based on the information of the 6th ID byte of the Toshiba Memory SLC > >>>>> NAND. > >>>>> > >>>>> Signed-off-by: KOBAYASHI Yoshitake > >>>>> --- > >>>>> drivers/mtd/nand/nand_toshiba.c | 28 ++++++++++++++++++++++++++++ > >>>>> 1 file changed, 28 insertions(+) > >>>>> > >>>>> diff --git a/drivers/mtd/nand/nand_toshiba.c b/drivers/mtd/nand/nand_toshiba.c > >>>>> index 57df857..c2c141b 100644 > >>>>> --- a/drivers/mtd/nand/nand_toshiba.c > >>>>> +++ b/drivers/mtd/nand/nand_toshiba.c > >>>>> @@ -35,6 +35,34 @@ static void toshiba_nand_decode_id(struct nand_chip *chip) > >>>>> (chip->id.data[5] & 0x7) == 0x6 /* 24nm */ && > >>>>> !(chip->id.data[4] & 0x80) /* !BENAND */) > >>>>> mtd->oobsize = 32 * mtd->writesize >> 9; > >>>>> + > >>>>> + /* > >>>>> + * Extract ECC requirements from 6th id byte. > >>>>> + * For Toshiba SLC, ecc requrements are as follows: > >>>>> + * - 43nm: 1 bit ECC for each 512Byte is required. > >>>>> + * - 32nm: 4 bit ECC for each 512Byte is required. > >>>>> + * - 24nm: 8 bit ECC for each 512Byte is required. > >>>>> + */ > >>>>> + if (chip->id.len >= 6 && nand_is_slc(chip)) { > >>>>> + chip->ecc_step_ds = 512; > >>>>> + switch (chip->id.data[5] & 0x7) { > >>>>> + case 0x4: > >>>>> + chip->ecc_strength_ds = 1; > >>>>> + break; > >>>>> + case 0x5: > >>>>> + chip->ecc_strength_ds = 4; > >>>>> + break; > >>>>> + case 0x6: > >>>>> + chip->ecc_strength_ds = 8; > >>>>> + break; > >>>>> + default: > >>>>> + WARN(1, "Could not get ECC info"); > >>>>> + chip->ecc_step_ds = 0; > >>>>> + break; > >>>>> + } > >>>>> + } else if (chip->id.len < 6 && nand_is_slc(chip)) { > >>>>> + WARN(1, "Could not get ECC info, 6th nand id byte does not exist."); > >>>> > >>>> I'm pretty sure you have old NAND chips that do not have 6bytes ids > >>>> (see the table here [1]), and printing a huge backtrace in this case is > >>>> probably not what you want. > >>>> > >>>> If you're okay with dropping this else block, I'll do the change when > >>>> applying, no need to send a new version. > >>> > >>> Some controllers may have limitation in reading ids beyond 5 bytes, > >>> considering such scenario we think it is better to keep this warning. > >>> However if you feel huge backtrace is an issue, how about we using pr_warn() instead? > >>> > >> > >> Toshiba NANDs with an id smaller than 6 bytes exist, so no, we should > >> not complain at all. If the controller is broken and can't read the 8 id > >> bytes the core is asking for, then it should be detected at the core > >> level not in the NAND manufacturer driver. > > > > I understood your opinion. Please apply this patch with dropping the else block. > > Should I repost patch with else block dropped? Please let me know if that is necessary. I forgot to apply it :-/. Please, send a new version so I can track it in patchwork. Thanks, Boris