Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * BCH Error Location Module
0004  *
0005  * Copyright (C) 2012 Texas Instruments Incorporated - https://www.ti.com/
0006  */
0007 
0008 #ifndef __ELM_H
0009 #define __ELM_H
0010 
0011 enum bch_ecc {
0012     BCH4_ECC = 0,
0013     BCH8_ECC,
0014     BCH16_ECC,
0015 };
0016 
0017 /* ELM support 8 error syndrome process */
0018 #define ERROR_VECTOR_MAX        8
0019 
0020 /**
0021  * struct elm_errorvec - error vector for elm
0022  * @error_reported:     set true for vectors error is reported
0023  * @error_uncorrectable:    number of uncorrectable errors
0024  * @error_count:        number of correctable errors in the sector
0025  * @error_loc:          buffer for error location
0026  *
0027  */
0028 struct elm_errorvec {
0029     bool error_reported;
0030     bool error_uncorrectable;
0031     int error_count;
0032     int error_loc[16];
0033 };
0034 
0035 #if IS_ENABLED(CONFIG_MTD_NAND_OMAP_BCH)
0036 void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
0037         struct elm_errorvec *err_vec);
0038 int elm_config(struct device *dev, enum bch_ecc bch_type,
0039     int ecc_steps, int ecc_step_size, int ecc_syndrome_size);
0040 #else
0041 static inline void
0042 elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
0043               struct elm_errorvec *err_vec)
0044 {
0045 }
0046 
0047 static inline int elm_config(struct device *dev, enum bch_ecc bch_type,
0048                  int ecc_steps, int ecc_step_size,
0049                  int ecc_syndrome_size)
0050 {
0051     return -ENOSYS;
0052 }
0053 #endif /* CONFIG_MTD_NAND_OMAP_BCH */
0054 
0055 #endif /* __ELM_H */