2019-06-04 11:11:33 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
2010-08-08 23:58:20 +04:00
|
|
|
* Copyright (C) 2000-2010 Steven J. Hill <sjhill@realitydiluted.com>
|
|
|
|
* David Woodhouse <dwmw2@infradead.org>
|
|
|
|
* Thomas Gleixner <tglx@linutronix.de>
|
2005-04-17 02:20:36 +04:00
|
|
|
*
|
|
|
|
* This file is the header for the ECC algorithm.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MTD_NAND_ECC_H__
|
|
|
|
#define __MTD_NAND_ECC_H__
|
|
|
|
|
2018-09-06 15:05:18 +03:00
|
|
|
struct nand_chip;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/*
|
2009-10-22 11:53:32 +04:00
|
|
|
* Calculate 3 byte ECC code for eccsize byte block
|
|
|
|
*/
|
|
|
|
void __nand_calculate_ecc(const u_char *dat, unsigned int eccsize,
|
2018-09-04 17:23:28 +03:00
|
|
|
u_char *ecc_code, bool sm_order);
|
2009-10-22 11:53:32 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Calculate 3 byte ECC code for 256/512 byte block
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
2018-09-06 15:05:18 +03:00
|
|
|
int nand_calculate_ecc(struct nand_chip *chip, const u_char *dat,
|
|
|
|
u_char *ecc_code);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2009-09-04 20:20:43 +04:00
|
|
|
/*
|
|
|
|
* Detect and correct a 1 bit error for eccsize byte block
|
|
|
|
*/
|
|
|
|
int __nand_correct_data(u_char *dat, u_char *read_ecc, u_char *calc_ecc,
|
2018-09-04 17:23:28 +03:00
|
|
|
unsigned int eccsize, bool sm_order);
|
2009-09-04 20:20:43 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
2009-10-22 11:53:32 +04:00
|
|
|
* Detect and correct a 1 bit error for 256/512 byte block
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
2018-09-06 15:05:19 +03:00
|
|
|
int nand_correct_data(struct nand_chip *chip, u_char *dat, u_char *read_ecc,
|
|
|
|
u_char *calc_ecc);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#endif /* __MTD_NAND_ECC_H__ */
|