1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2000-2010 Steven J. Hill <sjhill@realitydiluted.com>
4 * David Woodhouse <dwmw2@infradead.org>
5 * Thomas Gleixner <tglx@linutronix.de>
7 * This file is the header for the ECC algorithm.
10 #ifndef __MTD_NAND_ECC_H__
11 #define __MTD_NAND_ECC_H__
16 * Calculate 3 byte ECC code for eccsize byte block
18 void __nand_calculate_ecc(const u_char *dat, unsigned int eccsize,
19 u_char *ecc_code, bool sm_order);
22 * Calculate 3 byte ECC code for 256/512 byte block
24 int nand_calculate_ecc(struct nand_chip *chip, const u_char *dat,
28 * Detect and correct a 1 bit error for eccsize byte block
30 int __nand_correct_data(u_char *dat, u_char *read_ecc, u_char *calc_ecc,
31 unsigned int eccsize, bool sm_order);
34 * Detect and correct a 1 bit error for 256/512 byte block
36 int nand_correct_data(struct nand_chip *chip, u_char *dat, u_char *read_ecc,
39 #endif /* __MTD_NAND_ECC_H__ */