Skip to content

Commit b0fcd8a

Browse files
rmileckiBoris Brezillon
authored andcommitted
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@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
1 parent 8de5348 commit b0fcd8a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎include/linux/mtd/nand.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ typedef enum {
119119
NAND_ECC_SOFT_BCH,
120120
} nand_ecc_modes_t;
121121

122+
enum nand_ecc_algo {
123+
NAND_ECC_UNKNOWN,
124+
NAND_ECC_HAMMING,
125+
NAND_ECC_BCH,
126+
};
127+
122128
/*
123129
* Constants for Hardware ECC
124130
*/
@@ -458,6 +464,7 @@ struct nand_hw_control {
458464
/**
459465
* struct nand_ecc_ctrl - Control structure for ECC
460466
* @mode: ECC mode
467+
* @algo: ECC algorithm
461468
* @steps: number of ECC steps per page
462469
* @size: data bytes per ECC step
463470
* @bytes: ECC bytes per step
@@ -508,6 +515,7 @@ struct nand_hw_control {
508515
*/
509516
struct nand_ecc_ctrl {
510517
nand_ecc_modes_t mode;
518+
enum nand_ecc_algo algo;
511519
int steps;
512520
int size;
513521
int bytes;

0 commit comments

Comments
 (0)