[U-Boot] [PATCH v2 3/4] mtd: nand: mxs: Add comment for calculating ECC strength

Jörg Krause joerg.krause at embedded.rocks
Mon Apr 13 22:17:53 CEST 2015


Signed-off-by: Jörg Krause <joerg.krause at embedded.rocks>
---
 drivers/mtd/nand/mxs_nand.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c
index 912fed8..76e47ab 100644
--- a/drivers/mtd/nand/mxs_nand.c
+++ b/drivers/mtd/nand/mxs_nand.c
@@ -148,6 +148,13 @@ static inline uint32_t mxs_nand_get_ecc_strength(uint32_t page_data_size,
 {
 	int ecc_strength;
 
+	/* Determine the ECC layout with the formula:
+	 * 	ECC bits per chunk = (total page spare data bits) /
+	 * 		(bits per ECC level) / (chunks per page)
+	 * where:
+	 * 	total page spare data bits =
+	 * 		(page oob size - meta data size) * (bits per byte)
+	 */
 	ecc_strength = ((page_oob_size - MXS_NAND_METADATA_SIZE) * 8)
 			/ (MXS_NAND_BITS_PER_ECC_LEVEL *
 				mxs_nand_ecc_chunk_cnt(page_data_size));
-- 
2.3.5



More information about the U-Boot mailing list