treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500
[sfrench/cifs-2.6.git] / include / linux / mtd / nand_ecc.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Copyright (C) 2000-2010 Steven J. Hill <sjhill@realitydiluted.com>
4  *                          David Woodhouse <dwmw2@infradead.org>
5  *                          Thomas Gleixner <tglx@linutronix.de>
6  *
7  * This file is the header for the ECC algorithm.
8  */
9
10 #ifndef __MTD_NAND_ECC_H__
11 #define __MTD_NAND_ECC_H__
12
13 struct nand_chip;
14
15 /*
16  * Calculate 3 byte ECC code for eccsize byte block
17  */
18 void __nand_calculate_ecc(const u_char *dat, unsigned int eccsize,
19                           u_char *ecc_code, bool sm_order);
20
21 /*
22  * Calculate 3 byte ECC code for 256/512 byte block
23  */
24 int nand_calculate_ecc(struct nand_chip *chip, const u_char *dat,
25                        u_char *ecc_code);
26
27 /*
28  * Detect and correct a 1 bit error for eccsize byte block
29  */
30 int __nand_correct_data(u_char *dat, u_char *read_ecc, u_char *calc_ecc,
31                         unsigned int eccsize, bool sm_order);
32
33 /*
34  * Detect and correct a 1 bit error for 256/512 byte block
35  */
36 int nand_correct_data(struct nand_chip *chip, u_char *dat, u_char *read_ecc,
37                       u_char *calc_ecc);
38
39 #endif /* __MTD_NAND_ECC_H__ */