mtd: nand: add new enum for storing ECC algorithm

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon May 23 21:59:04 PDT 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=b0fcd8ab7b3c89b5da7fff5224d06ed73e7a33cc
Commit:     b0fcd8ab7b3c89b5da7fff5224d06ed73e7a33cc
Parent:     8de53481b433e45638e8e5252cbfeb78d64ca4d9
Author:     Rafał Miłecki <zajec5 at gmail.com>
AuthorDate: Wed Mar 23 11:19:00 2016 +0100
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Tue Apr 19 22:02:32 2016 +0200

    mtd: nand: add new enum for storing ECC algorithm
    
    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 <zajec5 at gmail.com>
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
 include/linux/mtd/nand.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 56574ba..1b673e1 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
  */
@@ -458,6 +464,7 @@ struct nand_hw_control {
 /**
  * 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
@@ -508,6 +515,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;



More information about the linux-mtd-cvs mailing list