Received: by 10.223.185.116 with SMTP id b49csp1120445wrg; Wed, 14 Feb 2018 11:59:19 -0800 (PST) X-Google-Smtp-Source: AH8x2274X7Zevi9bQ+UkSxghcjwISICl6Vzvf14grrdZS06lN4pZxQoxQn1ULtTYFpJV3NxBUWeW X-Received: by 10.98.18.65 with SMTP id a62mr188051pfj.115.1518638359392; Wed, 14 Feb 2018 11:59:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518638359; cv=none; d=google.com; s=arc-20160816; b=uP3pfcsU0A3CXrtca5U2bFIEDfpAPadfDz2XrzB049Jl5lPoM15JGxGtCmGKOnpll3 YdJExZyy2vsmUNt18SK2862Dcv7GY26V5hAiYUVKPT3m1g8XG95mIK7IAEiYYPFMueg/ XLgDf4Zp6hQl1LxyYl37tFwL2vB4xlFzZt3qJQfZFSyHx2p5xQW0m9ViqdPb/xD01DQ/ XusMHnYSjmMgXcOHXpyzeSWf0TLPhV5UwFSmoWk6hh+YllBMGhGVbcOZZg0487+tefwc kwTg8li1gnfYF7zU1eavgnhcC63HrL6uVSou9OZ+XzkH4F2BJFBTstvAvJqP/cBi082L mTRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :content-transfer-encoding:arc-authentication-results; bh=4sJic4AIbomxP0cQZQ/P8loq4q5nukcX+FvWSGCgda8=; b=UcogYmApDpDMxDF4b9sXX5geHaQOCZbfoCoPUhKwlf5AjYCDvX+pAeWitwVyqELwdM jom6Jas+tB3v4qOw9Xf1xvifZTdhRQtiG7izhM/dUDjdyocZM9htdZrHXARV5JkmhFg/ TNczrCMA5JsaxGKW2TKDUHYlERfsEKx3AXe6zs4mS1VnCzrXSDD764iC/lY4V1TQhRxx SgDbeO2nUsnD309fWsyvzRaJ1V0S2x9vLBkjNJDXIX7Ysn79UYfFaV6JUUhUh9lTssu3 He66wOG1h/SEYxwtTDWmuU/virc2R90g4EWgh6gfwufltbCG2iHAxWpGiuyVVcsNQi1k PYEQ== 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 m12-v6si2190296plt.170.2018.02.14.11.59.04; Wed, 14 Feb 2018 11:59:19 -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 S1031591AbeBNPia (ORCPT + 99 others); Wed, 14 Feb 2018 10:38:30 -0500 Received: from mo1500.tsb.2iij.net ([210.149.48.172]:44208 "EHLO mo.tsb.2iij.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934301AbeBNPi3 (ORCPT ); Wed, 14 Feb 2018 10:38:29 -0500 Received: by mo.tsb.2iij.net (tsb-mo1500) id w1EFbuNM009691; Thu, 15 Feb 2018 00:37:56 +0900 Received: from unknown [172.27.153.190] (EHLO tsb-mr1502.hop.2iij.net) by mas1506.tsb.2iij.net(mxl_mta-7.2.4-7) with ESMTP id 4d7548a5.0.53846.00-663.108415.mas1506.tsb.2iij.net (envelope-from ); Thu, 15 Feb 2018 00:37:57 +0900 (JST) X-MXL-Hash: 5a8457d569c62f4e-5fa86ef81529849928ccf1c42f1abd8e0ddab7ef Received: from imx2.toshiba.co.jp (imx2.toshiba.co.jp [106.186.93.51]) by relay.tsb.2iij.net (tsb-mr1502) with ESMTP id w1EFbtcq005792; Thu, 15 Feb 2018 00:37:55 +0900 Received: from tsbmgw-mgw02.tsbmgw-mgw02.toshiba.co.jp ([133.199.200.50]) by imx2.toshiba.co.jp with ESMTP id w1EFbta5015190 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Feb 2018 00:37:55 +0900 (JST) Received: from tsbmgw-mgw02 (localhost [127.0.0.1]) by tsbmgw-mgw02.tsbmgw-mgw02.toshiba.co.jp (8.13.8/8.14.5) with ESMTP id w1EFbtnK001003; Thu, 15 Feb 2018 00:37:55 +0900 Content-Transfer-Encoding: 7bit Received: from localhost ([127.0.0.1]) by tsbmgw-mgw02 (JAMES SMTP Server 2.3.1) with SMTP ID 863; Thu, 15 Feb 2018 00:37:54 +0900 (JST) Received: from arc1.toshiba.co.jp ([133.199.194.235]) by tsbmgw-mgw02.tsbmgw-mgw02.toshiba.co.jp (8.13.8/8.14.5) with ESMTP id w1EFbsYf001000; Thu, 15 Feb 2018 00:37:54 +0900 Received: (from root@localhost) by arc1.toshiba.co.jp id w1EFbs1m010565; Thu, 15 Feb 2018 00:37:54 +0900 (JST) Received: from unknown [133.199.192.144] by arc1.toshiba.co.jp with ESMTP id AAA10564; Thu, 15 Feb 2018 00:37:54 +0900 Received: from mx11.toshiba.co.jp (mx11.toshiba.co.jp [133.199.90.141]) by ovp2.toshiba.co.jp with ESMTP id w1EFbsPm016376; Thu, 15 Feb 2018 00:37:54 +0900 (JST) Received: from BK2211.rdc.toshiba.co.jp by toshiba.co.jp id w1EFbs5J009070; Thu, 15 Feb 2018 00:37:54 +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 w1EFbs5d024910; Thu, 15 Feb 2018 00:37:54 +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 10BCDC0462; Thu, 15 Feb 2018 00:37:54 +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-mmc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, KOBAYASHI Yoshitake Subject: [PATCH -next v4] mtd: nand: toshiba: Retrieve ECC requirements from extended ID Date: Thu, 15 Feb 2018 00:35:06 +0900 Message-Id: <1518622506-16606-1-git-send-email-yoshitake.kobayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 X-MAIL-FROM: X-SOURCE-IP: [172.27.153.190] X-Spam: exempt Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 | 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) -- 2.7.4