aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2016-03-23 06:19:00 -0400
committerBoris Brezillon <boris.brezillon@free-electrons.com>2016-04-19 16:02:32 -0400
commitb0fcd8ab7b3c89b5da7fff5224d06ed73e7a33cc (patch)
tree6df4158de505ece04e61fe394eecd0bf227574b6 /include/linux/mtd
parent8de53481b433e45638e8e5252cbfeb78d64ca4d9 (diff)
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>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/nand.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 56574ba36555..1b673e19667c 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -119,6 +119,12 @@ typedef enum {
119 NAND_ECC_SOFT_BCH, 119 NAND_ECC_SOFT_BCH,
120} nand_ecc_modes_t; 120} nand_ecc_modes_t;
121 121
122enum nand_ecc_algo {
123 NAND_ECC_UNKNOWN,
124 NAND_ECC_HAMMING,
125 NAND_ECC_BCH,
126};
127
122/* 128/*
123 * Constants for Hardware ECC 129 * Constants for Hardware ECC
124 */ 130 */
@@ -458,6 +464,7 @@ struct nand_hw_control {
458/** 464/**
459 * struct nand_ecc_ctrl - Control structure for ECC 465 * struct nand_ecc_ctrl - Control structure for ECC
460 * @mode: ECC mode 466 * @mode: ECC mode
467 * @algo: ECC algorithm
461 * @steps: number of ECC steps per page 468 * @steps: number of ECC steps per page
462 * @size: data bytes per ECC step 469 * @size: data bytes per ECC step
463 * @bytes: ECC bytes per step 470 * @bytes: ECC bytes per step
@@ -508,6 +515,7 @@ struct nand_hw_control {
508 */ 515 */
509struct nand_ecc_ctrl { 516struct nand_ecc_ctrl {
510 nand_ecc_modes_t mode; 517 nand_ecc_modes_t mode;
518 enum nand_ecc_algo algo;
511 int steps; 519 int steps;
512 int size; 520 int size;
513 int bytes; 521 int bytes;