diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2020-09-30 01:01:20 +0200 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2020-12-10 22:37:29 +0100 |
commit | 19b2ce184b9f404d6620adf667a9019e6abcae51 (patch) | |
tree | 35baebb133becb03c9354b13e4717f6f59094686 /include/linux/mtd/nand-ecc-sw-hamming.h | |
parent | 90ccf0a0192f7fa06e52de80cb528c5217e3e297 (diff) |
mtd: nand: ecc-hamming: Stop using raw NAND structures
This code is meant to be reused by the SPI-NAND core. Now that the
driver has been cleaned and reorganized, use a generic ECC engine
object to store the driver's data instead of accessing members of the
nand_chip structure. This means adding proper init/cleanup helpers.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-17-miquel.raynal@bootlin.com
Diffstat (limited to 'include/linux/mtd/nand-ecc-sw-hamming.h')
-rw-r--r-- | include/linux/mtd/nand-ecc-sw-hamming.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/mtd/nand-ecc-sw-hamming.h b/include/linux/mtd/nand-ecc-sw-hamming.h index 84a123bf45f3..9d4b4d623741 100644 --- a/include/linux/mtd/nand-ecc-sw-hamming.h +++ b/include/linux/mtd/nand-ecc-sw-hamming.h @@ -12,6 +12,26 @@ #include <linux/mtd/nand.h> +/** + * struct nand_ecc_sw_hamming_conf - private software Hamming ECC engine structure + * @reqooblen: Save the actual user OOB length requested before overwriting it + * @spare_oobbuf: Spare OOB buffer if none is provided + * @code_size: Number of bytes needed to store a code (one code per step) + * @nsteps: Number of steps + * @calc_buf: Buffer to use when calculating ECC bytes + * @code_buf: Buffer to use when reading (raw) ECC bytes from the chip + * @sm_order: Smart Media special ordering + */ +struct nand_ecc_sw_hamming_conf { + unsigned int reqooblen; + void *spare_oobbuf; + unsigned int code_size; + unsigned int nsteps; + u8 *calc_buf; + u8 *code_buf; + unsigned int sm_order; +}; + int ecc_sw_hamming_calculate(const unsigned char *buf, unsigned int step_size, unsigned char *code, bool sm_order); int nand_ecc_sw_hamming_calculate(struct nand_device *nand, |