| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright © 2011 Ivan Djelic <ivan.djelic@parrot.com> |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | 4 | * |
|---|
| 8 | 5 | * This file is the header for the NAND BCH ECC implementation. |
|---|
| 9 | 6 | */ |
|---|
| .. | .. |
|---|
| 12 | 9 | #define __MTD_NAND_BCH_H__ |
|---|
| 13 | 10 | |
|---|
| 14 | 11 | struct mtd_info; |
|---|
| 12 | +struct nand_chip; |
|---|
| 15 | 13 | struct nand_bch_control; |
|---|
| 16 | 14 | |
|---|
| 17 | | -#if defined(CONFIG_MTD_NAND_ECC_BCH) |
|---|
| 15 | +#if IS_ENABLED(CONFIG_MTD_NAND_ECC_SW_BCH) |
|---|
| 18 | 16 | |
|---|
| 19 | 17 | static inline int mtd_nand_has_bch(void) { return 1; } |
|---|
| 20 | 18 | |
|---|
| 21 | 19 | /* |
|---|
| 22 | 20 | * Calculate BCH ecc code |
|---|
| 23 | 21 | */ |
|---|
| 24 | | -int nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat, |
|---|
| 22 | +int nand_bch_calculate_ecc(struct nand_chip *chip, const u_char *dat, |
|---|
| 25 | 23 | u_char *ecc_code); |
|---|
| 26 | 24 | |
|---|
| 27 | 25 | /* |
|---|
| 28 | 26 | * Detect and correct bit errors |
|---|
| 29 | 27 | */ |
|---|
| 30 | | -int nand_bch_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, |
|---|
| 31 | | - u_char *calc_ecc); |
|---|
| 28 | +int nand_bch_correct_data(struct nand_chip *chip, u_char *dat, |
|---|
| 29 | + u_char *read_ecc, u_char *calc_ecc); |
|---|
| 32 | 30 | /* |
|---|
| 33 | 31 | * Initialize BCH encoder/decoder |
|---|
| 34 | 32 | */ |
|---|
| .. | .. |
|---|
| 38 | 36 | */ |
|---|
| 39 | 37 | void nand_bch_free(struct nand_bch_control *nbc); |
|---|
| 40 | 38 | |
|---|
| 41 | | -#else /* !CONFIG_MTD_NAND_ECC_BCH */ |
|---|
| 39 | +#else /* !CONFIG_MTD_NAND_ECC_SW_BCH */ |
|---|
| 42 | 40 | |
|---|
| 43 | 41 | static inline int mtd_nand_has_bch(void) { return 0; } |
|---|
| 44 | 42 | |
|---|
| 45 | 43 | static inline int |
|---|
| 46 | | -nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat, |
|---|
| 44 | +nand_bch_calculate_ecc(struct nand_chip *chip, const u_char *dat, |
|---|
| 47 | 45 | u_char *ecc_code) |
|---|
| 48 | 46 | { |
|---|
| 49 | 47 | return -1; |
|---|
| 50 | 48 | } |
|---|
| 51 | 49 | |
|---|
| 52 | 50 | static inline int |
|---|
| 53 | | -nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf, |
|---|
| 51 | +nand_bch_correct_data(struct nand_chip *chip, unsigned char *buf, |
|---|
| 54 | 52 | unsigned char *read_ecc, unsigned char *calc_ecc) |
|---|
| 55 | 53 | { |
|---|
| 56 | 54 | return -ENOTSUPP; |
|---|
| .. | .. |
|---|
| 63 | 61 | |
|---|
| 64 | 62 | static inline void nand_bch_free(struct nand_bch_control *nbc) {} |
|---|
| 65 | 63 | |
|---|
| 66 | | -#endif /* CONFIG_MTD_NAND_ECC_BCH */ |
|---|
| 64 | +#endif /* CONFIG_MTD_NAND_ECC_SW_BCH */ |
|---|
| 67 | 65 | |
|---|
| 68 | 66 | #endif /* __MTD_NAND_BCH_H__ */ |
|---|