Commit b0fcd8ab authored by Rafał Miłecki's avatar Rafał Miłecki Committed by Boris Brezillon

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: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent 8de53481
...@@ -119,6 +119,12 @@ typedef enum { ...@@ -119,6 +119,12 @@ typedef enum {
NAND_ECC_SOFT_BCH, NAND_ECC_SOFT_BCH,
} nand_ecc_modes_t; } nand_ecc_modes_t;
enum nand_ecc_algo {
NAND_ECC_UNKNOWN,
NAND_ECC_HAMMING,
NAND_ECC_BCH,
};
/* /*
* Constants for Hardware ECC * Constants for Hardware ECC
*/ */
...@@ -458,6 +464,7 @@ struct nand_hw_control { ...@@ -458,6 +464,7 @@ struct nand_hw_control {
/** /**
* struct nand_ecc_ctrl - Control structure for ECC * struct nand_ecc_ctrl - Control structure for ECC
* @mode: ECC mode * @mode: ECC mode
* @algo: ECC algorithm
* @steps: number of ECC steps per page * @steps: number of ECC steps per page
* @size: data bytes per ECC step * @size: data bytes per ECC step
* @bytes: ECC bytes per step * @bytes: ECC bytes per step
...@@ -508,6 +515,7 @@ struct nand_hw_control { ...@@ -508,6 +515,7 @@ struct nand_hw_control {
*/ */
struct nand_ecc_ctrl { struct nand_ecc_ctrl {
nand_ecc_modes_t mode; nand_ecc_modes_t mode;
enum nand_ecc_algo algo;
int steps; int steps;
int size; int size;
int bytes; int bytes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment