public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org
Cc: "Boris Brezillon" <boris.brezillon@free-electrons.com>,
	"Rafał Miłecki" <zajec5@gmail.com>
Subject: [PATCH 1/3] mtd: nand: add new enum for storing ECC algorithm
Date: Tue, 22 Mar 2016 23:54:12 +0100	[thread overview]
Message-ID: <1458687254-26181-2-git-send-email-zajec5@gmail.com> (raw)
In-Reply-To: <1458687254-26181-1-git-send-email-zajec5@gmail.com>

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 bit 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 <zajec5@gmail.com>
---
 include/linux/mtd/nand.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 7604f4b..b818eb3 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -119,6 +119,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
  */
@@ -508,6 +514,7 @@ struct nand_hw_control {
  */
 struct nand_ecc_ctrl {
 	nand_ecc_modes_t mode;
+	enum nand_ecc_algo algo;
 	int steps;
 	int size;
 	int bytes;
-- 
1.8.4.5

  reply	other threads:[~2016-03-22 22:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 22:54 [PATCH 0/3] mtd: nand: add enum nand_ecc_algo Rafał Miłecki
2016-03-22 22:54 ` Rafał Miłecki [this message]
2016-03-22 22:54 ` [PATCH 2/3] mtd: nand: set ECC algorithm in nand_dt_init Rafał Miłecki
2016-03-22 22:54 ` [PATCH 3/3] mtd: nand: nandsim: set ECC algorithm explicitly Rafał Miłecki
2016-03-23  9:00 ` [PATCH 0/3] mtd: nand: add enum nand_ecc_algo Boris Brezillon
2016-03-23  9:10   ` Rafał Miłecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458687254-26181-2-git-send-email-zajec5@gmail.com \
    --to=zajec5@gmail.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox