Received: by 10.223.185.116 with SMTP id b49csp1079541wrg; Wed, 14 Feb 2018 11:17:09 -0800 (PST) X-Google-Smtp-Source: AH8x224haj/saiLhPh3tFORqjL3A2djuOsBwy2cN+OCD7hFCH5OICujiNUdYkccu/S7DUhDIRjtN X-Received: by 10.99.100.196 with SMTP id y187mr55082pgb.362.1518635829384; Wed, 14 Feb 2018 11:17:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518635829; cv=none; d=google.com; s=arc-20160816; b=Xwf1YfMk1ZU8+yn5yAtoUsnPMshO+ukaFSo7YurG4AG7RJXpn0unRAewCHnS5AyPU+ hdW1gVEp4ihFADyZ0lkJVgvxck6022lziU48fO7sT8zw0HqqvH7UGbdyYepa3RUi1E7X 5QOd5i9dD+YHRWEdK2Diq61kps4iGPeQOnLYlEh00Gxp1GUXL2Mn0V+lzwfxcPGG/40y A+cPIJb1Ptxmk92qS9FmqOOAKr6RFKXCPyMTJ3663PNemKlmSQZYzs8expjKlSM5Lsuo ldq0L1+UCBarRrsFSF4GrZxreLEF+8kiU2FZ1pF0Qs9BLurfS6m9psZZIYozOVKOfhqa /TlQ== 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=WK6WXWzRz5Cy/4GRCoCrrbCkIqVl6q0ZS7viLQgJWhU=; b=ZXHjYQvedjUUDNbtM+9fBHbuCS7O1XWVJ9ofLseLqq8k4JYlXOSeuj/202/kqRdcpO Ioreyl+KcD2fO5c0Y/8n4y6WSZCBgQOdI2p7sfWphjmVzc8zexZEALupJuOmGq9tosFw O/hURPRi7eKj7nsSmgJtcmLyiWyCbSL3Mu2xBC8SGrwu7fgVZYjB02seuDpIkGp1VII1 1C6uMj4/FX8dYrlcGAt2JAHlk93xId1S6rrs5wlsyXyBRCWCr7vfwkrtCF4hT5ZikeF/ V3DEgjs7XgHkw0YpDpbp9Lcx9o6DTJ+wN7umJQkiDDcbAa5RTmNNgg+/vL3wFrvuiNb1 elfg== 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 d16si873710pfk.27.2018.02.14.11.16.53; Wed, 14 Feb 2018 11:17:09 -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 S1162700AbeBNTPo (ORCPT + 99 others); Wed, 14 Feb 2018 14:15:44 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:35702 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162439AbeBNTPn (ORCPT ); Wed, 14 Feb 2018 14:15:43 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 593CA207E5; Wed, 14 Feb 2018 20:15:41 +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 (unknown [91.160.177.164]) by mail.free-electrons.com (Postfix) with ESMTPSA id 07674203F5; Wed, 14 Feb 2018 20:15:41 +0100 (CET) Date: Wed, 14 Feb 2018 20:15:41 +0100 From: Boris Brezillon To: KOBAYASHI Yoshitake Cc: boris.brezillon@free-electrons.com, 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 v4] mtd: nand: toshiba: Retrieve ECC requirements from extended ID Message-ID: <20180214201541.7c939976@bbrezillon> In-Reply-To: <1518622506-16606-1-git-send-email-yoshitake.kobayashi@toshiba.co.jp> References: <1518622506-16606-1-git-send-email-yoshitake.kobayashi@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 -linux-mmc +linux-mtd On Thu, 15 Feb 2018 00:35:06 +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. This version looks good to me. > > Signed-off-by: KOBAYASHI Yoshitake > --- > drivers/mtd/nand/nand_toshiba.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/drivers/mtd/nand/nand_toshiba.c b/drivers/mtd/nand/nand_toshiba.c > index 57df857..ab43f02 100644 > --- a/drivers/mtd/nand/nand_toshiba.c > +++ b/drivers/mtd/nand/nand_toshiba.c > @@ -35,6 +35,32 @@ 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; > + } > + } > } > > static int toshiba_nand_init(struct nand_chip *chip) -- Boris Brezillon, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com