From cef9f020c1fa123577bcd54596e54fd3a79a1b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Krause?= Date: Tue, 11 Aug 2015 13:44:26 +0200 Subject: tools: mxsboot: calculate ECC block level dynamically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For pages of 2048 bytes the current setting of the ECC Error Correction Level is only true for an oob size of 64 bytes and wrong for all others. Instead of hard-coding every possible combination of page size and oob size use the dynamic calculation of the ECC strength introduced in commit 6121560d7714d6d8e41ce1687a1388a1a8fea4cb. Cc: Marek Vasut Signed-off-by: Jörg Krause Acked-by: Marek Vasut Reviewed-by: Stefano Babic --- tools/mxsboot.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'tools') diff --git a/tools/mxsboot.c b/tools/mxsboot.c index 185b327920..15eec9179d 100644 --- a/tools/mxsboot.c +++ b/tools/mxsboot.c @@ -271,23 +271,10 @@ static struct mx28_nand_fcb *mx28_nand_get_fcb(uint32_t size) fcb->ecc_block_0_size = 512; fcb->ecc_block_n_size = 512; fcb->metadata_bytes = 10; - - if (nand_writesize == 2048) { - fcb->ecc_block_n_ecc_type = 4; - fcb->ecc_block_0_ecc_type = 4; - } else if (nand_writesize == 4096) { - if (nand_oobsize == 128) { - fcb->ecc_block_n_ecc_type = 4; - fcb->ecc_block_0_ecc_type = 4; - } else if (nand_oobsize == 218) { - fcb->ecc_block_n_ecc_type = 8; - fcb->ecc_block_0_ecc_type = 8; - } else if (nand_oobsize == 224) { - fcb->ecc_block_n_ecc_type = 8; - fcb->ecc_block_0_ecc_type = 8; - } - } - + fcb->ecc_block_n_ecc_type = mx28_nand_get_ecc_strength( + nand_writesize, nand_oobsize) >> 1; + fcb->ecc_block_0_ecc_type = mx28_nand_get_ecc_strength( + nand_writesize, nand_oobsize) >> 1; if (fcb->ecc_block_n_ecc_type == 0) { printf("MX28 NAND: Unsupported NAND geometry\n"); goto err; -- cgit v1.2.1