From patchwork Wed Dec 6 14:04:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KOBAYASHI Yoshitake X-Patchwork-Id: 845195 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="m/QQDs/r"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="bZNcKkx7"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ysLZP6HpLz9sCZ for ; Thu, 7 Dec 2017 01:28:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=EdSYHwuJemPdHODGhpSqF01NxQ64kKUrFEaaONnqOSA=; b=m/QQDs/rRUuxT0WJjY/KU5ZTry PkSeriDB46hL/1jcZw7wASFSPPNCLAZNZ0BdMXVyO9S7tEIQs/zmKPLg9BQSZ926UOvyNngtw5tl5 Db/mGYm/FWwMnRZeFJuRZhymIX1dqnMLIbZkOhVIZK0FuMJ756ywxD8qQ4DmDaX/qz1+V2tQbOBmq 7tE3XQwXAK1Bw90mOYhl0TlPh1yoN0/Lha9N1Nv5f00gV/bEZNwqw0aXg/u+WGCLZGLDTjDyMG1AL JP1PXJEaFFPKls6On5C4Ol7DAOdD9bhsMdwlhoTi2jEDUaCLXQOQJQGeAbnT9dqMtdw30iGEkQ3iM qY2D3tZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMagN-0004PA-Rw; Wed, 06 Dec 2017 14:28:19 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMagC-0004C2-A1 for linux-mtd@bombadil.infradead.org; Wed, 06 Dec 2017 14:28:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Content-Transfer-Encoding:Sender:Reply-To:MIME-Version: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=sruLmfIQLDfCZRqPXhKythv6IGLszcikdn9opL21TSg=; b=bZNcKkx7eh55fTjx4pGwtHPvuK JMHSYjTjR1ewJmWQ6GXn9PwQAaJ+eVyLPPxO1R0s3UXxCbvSL/PpWql/5H+mfLeRV/g5hx7cF9Zl/ kf+FzQMGE1FBcLozIMbY3Xxut8JXu48tbeEkQBSMhpD3x3pLN1qMoMxblKgBe6symn9GZq6tvhw9w vo7Owt1cmGVqvWwuQcNTNS9w2gTXH5s6Bh5Z4sncD24hrbcNpwQjlTIjzQ0tMxFOfL5Ax+KvfG6Ve D94fxBxfVJY+bJNRlfrW7XWAow9hB+5Ym61qEtg0Yv8HQO3Da+Dm5KfQe3VVbI7wyboNq7lfiwqnv mnLkBwag==; Received: from mo1501.tsb.2iij.net ([210.149.48.173] helo=mo.tsb.2iij.net) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMaQa-00004y-B2 for linux-mtd@lists.infradead.org; Wed, 06 Dec 2017 14:12:06 +0000 Received: by mo.tsb.2iij.net (tsb-mo1501) id vB6EBIb7022165; Wed, 6 Dec 2017 23:11:19 +0900 Received: from unknown [172.27.153.190] (EHLO tsb-mr1502.hop.2iij.net) by mas1507.tsb.2iij.net(mxl_mta-7.2.4-7) with ESMTP id 68af72a5.0.72358.00-658.140651.mas1507.tsb.2iij.net (envelope-from ); Wed, 06 Dec 2017 23:11:19 +0900 (JST) X-MXL-Hash: 5a27fa87595620e5-ba6e8d720a5efcf4d00fd03654143bafa558a915 Received: from imx12.toshiba.co.jp (imx12.toshiba.co.jp [61.202.160.132]) by relay.tsb.2iij.net (tsb-mr1502) with ESMTP id vB6EBH0x032549; Wed, 6 Dec 2017 23:11:17 +0900 Received: from tsbmgw-mgw01.tsbmgw-mgw01.toshiba.co.jp ([133.199.232.103]) by imx12.toshiba.co.jp with ESMTP id vB6EBHLv007438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 6 Dec 2017 23:11:17 +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 vB6EBHGM027101; Wed, 6 Dec 2017 23:11:17 +0900 Received: from localhost ([127.0.0.1]) by tsbmgw-mgw01 (JAMES SMTP Server 2.3.1) with SMTP ID 101; Wed, 6 Dec 2017 23:11:17 +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 vB6EBH90027088; Wed, 6 Dec 2017 23:11:17 +0900 Received: (from root@localhost) by arc11.toshiba.co.jp id vB6EBHOt017821; Wed, 6 Dec 2017 23:11:17 +0900 (JST) Received: from ovp11.toshiba.co.jp [133.199.90.148] by arc11.toshiba.co.jp with ESMTP id ZAA17818; Wed, 6 Dec 2017 23:11:16 +0900 Received: from mx2.toshiba.co.jp (mx2 [133.199.192.142]) by ovp11.toshiba.co.jp with ESMTP id vB6EBGLN017521; Wed, 6 Dec 2017 23:11:16 +0900 (JST) Received: from BK2211.rdc.toshiba.co.jp by toshiba.co.jp id vB6EBGNE013796; Wed, 6 Dec 2017 23:11:16 +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 vB6EBGOX002827; Wed, 6 Dec 2017 23:11:16 +0900 (JST) Received: from skerlet.swc.toshiba.co.jp (pftech04.swc.toshiba.co.jp [133.196.122.147]) by vmkw1204.swc.toshiba.co.jp (Postfix) with ESMTP id 22238C4438; Wed, 6 Dec 2017 23:11:16 +0900 (JST) From: KOBAYASHI Yoshitake To: 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 Subject: [PATCH -next v3 1/2] mtd: nand: toshiba: Retrieve ECC requirements from extended ID Date: Wed, 6 Dec 2017 23:04:57 +0900 Message-Id: <1512569098-30038-2-git-send-email-yoshitake.kobayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512569098-30038-1-git-send-email-yoshitake.kobayashi@toshiba.co.jp> References: <1512569098-30038-1-git-send-email-yoshitake.kobayashi@toshiba.co.jp> X-MAIL-FROM: X-SOURCE-IP: [172.27.153.190] X-Spam: exempt X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171206_141200_858627_F9D30659 X-CRM114-Status: GOOD ( 14.50 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-2.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [210.149.48.173 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, KOBAYASHI Yoshitake MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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."); + } } static int toshiba_nand_init(struct nand_chip *chip)