Received: by 10.223.176.5 with SMTP id f5csp3586809wra; Mon, 29 Jan 2018 15:46:07 -0800 (PST) X-Google-Smtp-Source: AH8x227r95ltvdQy4Sog08CEF70X39oiYmYLCktJuJhuj5MOn50mD02ntbWXNt0Ergdrvcc/mBZh X-Received: by 10.98.162.10 with SMTP id m10mr28181184pff.168.1517269567451; Mon, 29 Jan 2018 15:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517269567; cv=none; d=google.com; s=arc-20160816; b=d2oDa7dm/mbHFc/PbpKx2fneneWdYDwFmvJElsajWAlhVULVRSEWoYOdWeNFEN/l5/ uMeGeqWPjRJ5UgzVA8/Sk4Geny9RSviy0CgiNBIHs1HpKNoIeP81ny5yVDOBRWY5Sdl3 fsiUKXS3AFvZ7YStff2WqVo4cfQw++k1996wZFcGOt6f+jgs3Emd1+TAv1i8FlFE1wui tzvQfl8E86G/eNBTPXYG37irYlSVMPt/vVOgq6UKnPDAIOhK4jci5+dqCR9CZ3ekKVXX i5/cbNT+nbOVM73h9O9mROH0oI7+PGimhz1wUIvx/AuIZEpOFxMuv0r77G4M2K+XzsXa UWUg== 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:references:cc:to:from:subject:arc-authentication-results; bh=KzSxsSXsYKXAHhEl88L5TIgR/+x3hqjtC4kHnDebNmo=; b=SPxpLezPu2lQqq8a6wzjIAoW0J9Wh8Z8vScPrtyg7C7WHp6Yifkv08GFpwAED3C+wD zd1J/wYlZm8NHraKvJkAn9wsQLcZT4XjvqxN5UTVLt3yUt83/ZD3Iq+jQtZQ4SbgaA8r MTxzRWfrt57p7pypykrCwKjCJnDoO7ektLcF7gVpOZO0TU2qxNte5GMjkxXL7hpO6AHi 4yv3JjBeJlSOR+CpWouKA+iHC8277+5WxqVgiXdkSC5sE2/WYcqU4X1hfD5QMXRW7oWj 79ftMN+hP6EhByhWYqcBQc/qoly0x50/8H79Ej/i2rbMvBoI+52i7Jjo0UdNQwI/znIy 8TLw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 43-v6si10383510pla.70.2018.01.29.15.45.52; Mon, 29 Jan 2018 15:46:07 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751778AbeA2Xp1 (ORCPT + 99 others); Mon, 29 Jan 2018 18:45:27 -0500 Received: from mo1500.tsb.2iij.net ([210.149.48.172]:56371 "EHLO mo.tsb.2iij.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751749AbeA2Xp0 (ORCPT ); Mon, 29 Jan 2018 18:45:26 -0500 Received: by mo.tsb.2iij.net (tsb-mo1500) id w0TNiY7V005812; Tue, 30 Jan 2018 08:44:35 +0900 Received: from unknown [172.27.153.187] (EHLO tsb-mr1501.hop.2iij.net) by mas1504.tsb.2iij.net(mxl_mta-7.2.4-7) with ESMTP id 2e1bf6a5.0.1333518.00-009.2365950.mas1504.tsb.2iij.net (envelope-from ); Tue, 30 Jan 2018 08:44:35 +0900 (JST) X-MXL-Hash: 5a6fb1e36e10a9d6-60016c692152ce142b74f4bf36618295836a97ef Received: from imx12.toshiba.co.jp (imx12.toshiba.co.jp [61.202.160.132]) by relay.tsb.2iij.net (tsb-mr1501) with ESMTP id w0TNiWN1005198; Tue, 30 Jan 2018 08:44:32 +0900 Received: from tsbmgw-mgw01.tsbmgw-mgw01.toshiba.co.jp ([133.199.232.103]) by imx12.toshiba.co.jp with ESMTP id w0TNiWW0016412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Jan 2018 08:44:32 +0900 (JST) Received: from tsbmgw-mgw01 (localhost [127.0.0.1]) by tsbmgw-mgw01.tsbmgw-mgw01.toshiba.co.jp (8.13.8/8.14.5) with ESMTP id w0TNiWWL026208; Tue, 30 Jan 2018 08:44:32 +0900 Received: from localhost ([127.0.0.1]) by tsbmgw-mgw01 (JAMES SMTP Server 2.3.1) with SMTP ID 221; Tue, 30 Jan 2018 08:44:32 +0900 (JST) Received: from arc11.toshiba.co.jp ([133.199.90.127]) by tsbmgw-mgw01.tsbmgw-mgw01.toshiba.co.jp (8.13.8/8.14.5) with ESMTP id w0TNiVrr026202; Tue, 30 Jan 2018 08:44:31 +0900 Received: (from root@localhost) by arc11.toshiba.co.jp id w0TNiV7g012685; Tue, 30 Jan 2018 08:44:31 +0900 (JST) Received: from ovp11.toshiba.co.jp [133.199.90.148] by arc11.toshiba.co.jp with ESMTP id JAA12683; Tue, 30 Jan 2018 08:44:31 +0900 Received: from mx2.toshiba.co.jp (mx2 [133.199.192.142]) by ovp11.toshiba.co.jp with ESMTP id w0TNiVv8000527; Tue, 30 Jan 2018 08:44:31 +0900 (JST) Received: from BK2211.rdc.toshiba.co.jp by toshiba.co.jp id w0TNiVYN003483; Tue, 30 Jan 2018 08:44:31 +0900 (JST) Received: from vmkw1204.swc.toshiba.co.jp (localhost [127.0.0.1]) by BK2211.rdc.toshiba.co.jp (8.13.8+Sun/8.13.8) with ESMTP id w0TNiUJo006631; Tue, 30 Jan 2018 08:44:30 +0900 (JST) Received: from [133.196.123.203] (unknown [133.196.123.203]) by vmkw1204.swc.toshiba.co.jp (Postfix) with ESMTP id 32EA2C2FFA; Tue, 30 Jan 2018 08:44:30 +0900 (JST) Subject: Re: [PATCH -next v3 1/2] mtd: nand: toshiba: Retrieve ECC requirements from extended ID From: KOBAYASHI Yoshitake To: Boris Brezillon 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 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> Message-ID: <0cf2e0f7-e61b-2cae-f216-e616aecf3e76@toshiba.co.jp> Date: Tue, 30 Jan 2018 08:44:30 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-MAIL-FROM: X-SOURCE-IP: [172.27.153.187] X-Spam: exempt Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Yoshi