From patchwork Tue Jul 10 09:48:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philippe REYNES X-Patchwork-Id: 941887 X-Patchwork-Delegate: trini@ti.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.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=softathome.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41Py8b3ZMKz9rvt for ; Tue, 10 Jul 2018 19:49:17 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A86CEC21E39; Tue, 10 Jul 2018 09:49:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1B559C21D8A; Tue, 10 Jul 2018 09:49:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2B0B7C21D8A; Tue, 10 Jul 2018 09:49:09 +0000 (UTC) Received: from vrout30.yaziba.net (vrout30.yaziba.net [185.56.204.33]) by lists.denx.de (Postfix) with ESMTPS id BDC0BC21C2F for ; Tue, 10 Jul 2018 09:49:08 +0000 (UTC) Received: from mtaout20.int.yaziba.net (mtaout20.int.yaziba.net [10.4.20.37]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by vrout30.yaziba.net (mx10.yaziba.net) with ESMTPS id 448725207B; Tue, 10 Jul 2018 11:49:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mtaout20.int.yaziba.net (Postfix) with ESMTP id 499DC160292; Tue, 10 Jul 2018 11:49:08 +0200 (CEST) X-Virus-Scanned: amavisd-new at mtaout20.int.yaziba.net Received: from mtaout20.int.yaziba.net ([127.0.0.1]) by localhost (mtaout20.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id JbzhkIU2Rf0B; Tue, 10 Jul 2018 11:49:08 +0200 (CEST) Received: from sahnlpt0333.softathome.com (unknown [149.6.166.170]) by mtaout20.int.yaziba.net (Postfix) with ESMTPSA id 244541601B2; Tue, 10 Jul 2018 11:49:08 +0200 (CEST) From: Philippe Reynes To: yamada.masahiro@socionext.com, boris.brezillon@free-electrons.com, s.hauer@pengutronix.de Date: Tue, 10 Jul 2018 11:48:08 +0200 Message-Id: <1531216088-2449-1-git-send-email-philippe.reynes@softathome.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-DRWEB-SCAN: ok X-VRSPAM-SCORE: 0 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgedtiedrgeeggddvudcutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofggtgfgsehtqhertdertdejnecuhfhrohhmpefrhhhilhhiphhpvgcutfgvhihnvghsuceophhhihhlihhpphgvrdhrvgihnhgvshesshhofhhtrghthhhomhgvrdgtohhmqeenucfkphepudegledriedrudeiiedrudejtdenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht Cc: oss@buserror.net, u-boot@lists.denx.de, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [U-Boot] [PATCH] mtd: nand: add new enum for storing ECC algorithm X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Rafał Miłecki Our nand_ecc_modes_t is already a bit abused by value NAND_ECC_SOFT_BCH. This enum should store ECC mode only and putting algorithm details there is a bad idea. It would result in too many values impossible to support in a sane way. To solve this problem let's add a new enum. We'll have to modify all drivers to set it properly but once it's done it'll be possible to drop NAND_ECC_SOFT_BCH. That will result in a cleaner design and more possibilities like setting ECC algorithm for hardware ECC mode. Signed-off-by: Rafał Miłecki Signed-off-by: Boris Brezillon [Linux commit: b0fcd8ab7b3c89b5da7fff5224d06ed73e7a33cc] [Philippe Reynes: adapt code to u-boot] Signed-off-by: Philippe Reynes --- include/linux/mtd/rawnand.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index cdad7b8..9f5dc81 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -143,6 +143,12 @@ typedef enum { NAND_ECC_SOFT_BCH, } nand_ecc_modes_t; +enum nand_ecc_algo { + NAND_ECC_UNKNOWN, + NAND_ECC_HAMMING, + NAND_ECC_BCH, +}; + /* * Constants for Hardware ECC */ @@ -533,6 +539,7 @@ static const struct nand_ecc_caps __name = { \ /** * struct nand_ecc_ctrl - Control structure for ECC * @mode: ECC mode + * @algo: ECC algorithm * @steps: number of ECC steps per page * @size: data bytes per ECC step * @bytes: ECC bytes per step @@ -583,6 +590,7 @@ static const struct nand_ecc_caps __name = { \ */ struct nand_ecc_ctrl { nand_ecc_modes_t mode; + enum nand_ecc_algo algo; int steps; int size; int bytes;