xref: /rk3399_rockchip-uboot/include/linux/mtd/nand_ecc.h (revision 78e9e71c83cf75483a6f756488b245df33783c5b)
1932394acSWolfgang Denk /*
2932394acSWolfgang Denk  *  drivers/mtd/nand_ecc.h
3932394acSWolfgang Denk  *
4*78e9e71cSTom Rini  *  Copyright (C) 2000-2010 Steven J. Hill <sjhill@realitydiluted.com>
5*78e9e71cSTom Rini  *			    David Woodhouse <dwmw2@infradead.org>
6*78e9e71cSTom Rini  *			    Thomas Gleixner <tglx@linutronix.de>
7932394acSWolfgang Denk  *
8*78e9e71cSTom Rini  * SPDX-License-Identifier:	GPL-2.0
9932394acSWolfgang Denk  *
10932394acSWolfgang Denk  * This file is the header for the ECC algorithm.
11932394acSWolfgang Denk  */
12932394acSWolfgang Denk 
13932394acSWolfgang Denk #ifndef __MTD_NAND_ECC_H__
14932394acSWolfgang Denk #define __MTD_NAND_ECC_H__
15932394acSWolfgang Denk 
16932394acSWolfgang Denk struct mtd_info;
17932394acSWolfgang Denk 
18932394acSWolfgang Denk /*
19932394acSWolfgang Denk  * Calculate 3 byte ECC code for 256 byte block
20932394acSWolfgang Denk  */
21932394acSWolfgang Denk int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code);
22932394acSWolfgang Denk 
23932394acSWolfgang Denk /*
24932394acSWolfgang Denk  * Detect and correct a 1 bit error for 256 byte block
25932394acSWolfgang Denk  */
26932394acSWolfgang Denk int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc);
27932394acSWolfgang Denk 
28932394acSWolfgang Denk #endif /* __MTD_NAND_ECC_H__ */
29