]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/linux/mtd/nand_ecc.h
mtd: nand: kirkwood: enable BCH ECC and add support for dynamically switching ECC...
[karo-tx-uboot.git] / include / linux / mtd / nand_ecc.h
index 9715a53d86d4ec3716b167a646dd3732da556d13..b07e7431f3294a0372fb3927545743566e4343f3 100644 (file)
 
 struct mtd_info;
 
-#if defined(CONFIG_MTD_ECC_SOFT)
-
-static inline int mtd_nand_has_ecc_soft(void) { return 1; }
-
 /*
  * Calculate 3 byte ECC code for 256 byte block
  */
@@ -29,25 +25,18 @@ int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code
  */
 int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc);
 
-#else
-
-static inline int mtd_nand_has_ecc_soft(void) { return 0; }
-
-static inline int
-nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
-{
-       return -1;
-}
+#ifdef CONFIG_NAND_ECC_SOFT_RS
+/*
+ * Calculate 10 byte RS ECC syndrome for 512 byte block
+ */
+int nand_rs_calculate_ecc(struct mtd_info *mtd, const uint8_t *data, uint8_t *ecc);
 
-static inline int
-nand_correct_data(struct mtd_info *mtd,
-                       u_char *dat,
-                       u_char *read_ecc,
-                       u_char *calc_ecc)
-{
-       return -1;
-}
+/*
+ * stub routine for unsupported RS-ECC decoding
+ */
+int nand_rs_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc);
 
+void kw_nand_ecc_switch(struct mtd_info *mtd, nand_ecc_modes_t eccmode);
 #endif
 
 #endif /* __MTD_NAND_ECC_H__ */