From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755365AbbFLJtg (ORCPT ); Fri, 12 Jun 2015 05:49:36 -0400 Received: from mail-yk0-f175.google.com ([209.85.160.175]:36615 "EHLO mail-yk0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754695AbbFLJtc (ORCPT ); Fri, 12 Jun 2015 05:49:32 -0400 MIME-Version: 1.0 In-Reply-To: <1434038402-26365-1-git-send-email-yoshitake.kobayashi@toshiba.co.jp> References: <1434038402-26365-1-git-send-email-yoshitake.kobayashi@toshiba.co.jp> Date: Fri, 12 Jun 2015 11:49:31 +0200 Message-ID: Subject: Re: [PATCH v2] mtd: nand: support for Toshiba BENAND (Built-in ECC NAND) From: Richard Weinberger To: KOBAYASHI Yoshitake Cc: David Woodhouse , Brian Norris , "linux-mtd@lists.infradead.org" , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 11, 2015 at 6:00 PM, KOBAYASHI Yoshitake wrote: > This patch enables support for Toshiba BENAND. > BENAND is a SLC NAND solution that automatically generates ECC inside > NAND chip. > > Some of the comments in the following discussion may need to be considerd. > https://lkml.org/lkml/2015/3/25/310 Yep. > +void nand_benand_init(struct mtd_info *mtd) > +{ > + struct nand_chip *chip = mtd->priv; > + > + pr_info("%s\n", __func__); Please kill all these prints. Use ftrace to trace function calls. > + chip->ecc.size = mtd->writesize; > + chip->ecc.strength = 1; BENAND can correct only one bit? This would explain why you consider it as fast. ;-) > +int nand_benand_status_chk(struct mtd_info *mtd, struct nand_chip *chip) > +{ > + unsigned int bitflips = 0; > + u8 status; > + > + pr_debug("%s\n", __func__); > + > + /* Check Read Status */ > + chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1); > + status = chip->read_byte(mtd); > + > + /* timeout */ > + if (!(status & NAND_STATUS_READY)) { > + pr_info("BENAND : Time Out!\n"); > + return -EIO; > + } > + > + /* uncorrectable */ > + else if (status & NAND_STATUS_FAIL) { > + pr_info("BENAND : Uncorrectable!\n"); > + mtd->ecc_stats.failed++; > + } > + > + /* correctable */ > + else if (status & NAND_STATUS_RECOM_REWRT) { > + pr_info("BENAND : Recommended to rewrite!\n"); > + bitflips = chip->ecc.strength; In your case this might be okay, as you set strength to 1. Otherweise you'd have to report the real number of bitflips. -- Thanks, //richard From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yh0-x236.google.com ([2607:f8b0:4002:c01::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z3Lb1-0002Qe-2f for linux-mtd@lists.infradead.org; Fri, 12 Jun 2015 09:49:56 +0000 Received: by yhak3 with SMTP id k3so11905098yha.2 for ; Fri, 12 Jun 2015 02:49:33 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1434038402-26365-1-git-send-email-yoshitake.kobayashi@toshiba.co.jp> References: <1434038402-26365-1-git-send-email-yoshitake.kobayashi@toshiba.co.jp> Date: Fri, 12 Jun 2015 11:49:31 +0200 Message-ID: Subject: Re: [PATCH v2] mtd: nand: support for Toshiba BENAND (Built-in ECC NAND) From: Richard Weinberger To: KOBAYASHI Yoshitake Content-Type: text/plain; charset=UTF-8 Cc: "linux-mtd@lists.infradead.org" , Brian Norris , David Woodhouse , LKML List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu, Jun 11, 2015 at 6:00 PM, KOBAYASHI Yoshitake wrote: > This patch enables support for Toshiba BENAND. > BENAND is a SLC NAND solution that automatically generates ECC inside > NAND chip. > > Some of the comments in the following discussion may need to be considerd. > https://lkml.org/lkml/2015/3/25/310 Yep. > +void nand_benand_init(struct mtd_info *mtd) > +{ > + struct nand_chip *chip = mtd->priv; > + > + pr_info("%s\n", __func__); Please kill all these prints. Use ftrace to trace function calls. > + chip->ecc.size = mtd->writesize; > + chip->ecc.strength = 1; BENAND can correct only one bit? This would explain why you consider it as fast. ;-) > +int nand_benand_status_chk(struct mtd_info *mtd, struct nand_chip *chip) > +{ > + unsigned int bitflips = 0; > + u8 status; > + > + pr_debug("%s\n", __func__); > + > + /* Check Read Status */ > + chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1); > + status = chip->read_byte(mtd); > + > + /* timeout */ > + if (!(status & NAND_STATUS_READY)) { > + pr_info("BENAND : Time Out!\n"); > + return -EIO; > + } > + > + /* uncorrectable */ > + else if (status & NAND_STATUS_FAIL) { > + pr_info("BENAND : Uncorrectable!\n"); > + mtd->ecc_stats.failed++; > + } > + > + /* correctable */ > + else if (status & NAND_STATUS_RECOM_REWRT) { > + pr_info("BENAND : Recommended to rewrite!\n"); > + bitflips = chip->ecc.strength; In your case this might be okay, as you set strength to 1. Otherweise you'd have to report the real number of bitflips. -- Thanks, //richard