~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mtd/nand-ecc-sw-bch.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright © 2011 Ivan Djelic <ivan.djelic@parrot.com>
  4  *
  5  * This file is the header for the NAND BCH ECC implementation.
  6  */
  7 
  8 #ifndef __MTD_NAND_ECC_SW_BCH_H__
  9 #define __MTD_NAND_ECC_SW_BCH_H__
 10 
 11 #include <linux/mtd/nand.h>
 12 #include <linux/bch.h>
 13 
 14 /**
 15  * struct nand_ecc_sw_bch_conf - private software BCH ECC engine structure
 16  * @req_ctx: Save request context and tweak the original request to fit the
 17  *           engine needs
 18  * @code_size: Number of bytes needed to store a code (one code per step)
 19  * @calc_buf: Buffer to use when calculating ECC bytes
 20  * @code_buf: Buffer to use when reading (raw) ECC bytes from the chip
 21  * @bch: BCH control structure
 22  * @errloc: error location array
 23  * @eccmask: XOR ecc mask, allows erased pages to be decoded as valid
 24  */
 25 struct nand_ecc_sw_bch_conf {
 26         struct nand_ecc_req_tweak_ctx req_ctx;
 27         unsigned int code_size;
 28         u8 *calc_buf;
 29         u8 *code_buf;
 30         struct bch_control *bch;
 31         unsigned int *errloc;
 32         unsigned char *eccmask;
 33 };
 34 
 35 #if IS_ENABLED(CONFIG_MTD_NAND_ECC_SW_BCH)
 36 
 37 int nand_ecc_sw_bch_calculate(struct nand_device *nand,
 38                               const unsigned char *buf, unsigned char *code);
 39 int nand_ecc_sw_bch_correct(struct nand_device *nand, unsigned char *buf,
 40                             unsigned char *read_ecc, unsigned char *calc_ecc);
 41 int nand_ecc_sw_bch_init_ctx(struct nand_device *nand);
 42 void nand_ecc_sw_bch_cleanup_ctx(struct nand_device *nand);
 43 struct nand_ecc_engine *nand_ecc_sw_bch_get_engine(void);
 44 
 45 #else /* !CONFIG_MTD_NAND_ECC_SW_BCH */
 46 
 47 static inline int nand_ecc_sw_bch_calculate(struct nand_device *nand,
 48                                             const unsigned char *buf,
 49                                             unsigned char *code)
 50 {
 51         return -ENOTSUPP;
 52 }
 53 
 54 static inline int nand_ecc_sw_bch_correct(struct nand_device *nand,
 55                                           unsigned char *buf,
 56                                           unsigned char *read_ecc,
 57                                           unsigned char *calc_ecc)
 58 {
 59         return -ENOTSUPP;
 60 }
 61 
 62 static inline int nand_ecc_sw_bch_init_ctx(struct nand_device *nand)
 63 {
 64         return -ENOTSUPP;
 65 }
 66 
 67 static inline void nand_ecc_sw_bch_cleanup_ctx(struct nand_device *nand) {}
 68 
 69 #endif /* CONFIG_MTD_NAND_ECC_SW_BCH */
 70 
 71 #endif /* __MTD_NAND_ECC_SW_BCH_H__ */
 72 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php