public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] tools: mxsboot: calculate ECC block level dynamically
@ 2015-08-11 11:44 Jörg Krause
  2015-08-11 11:51 ` Marek Vasut
  2015-08-11 12:10 ` Stefano Babic
  0 siblings, 2 replies; 4+ messages in thread
From: Jörg Krause @ 2015-08-11 11:44 UTC (permalink / raw)
  To: u-boot

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 <marex@denx.de>
Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
---
 tools/mxsboot.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/tools/mxsboot.c b/tools/mxsboot.c
index 185b327..15eec91 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;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 1/1] tools: mxsboot: calculate ECC block level dynamically
  2015-08-11 11:44 [U-Boot] [PATCH 1/1] tools: mxsboot: calculate ECC block level dynamically Jörg Krause
@ 2015-08-11 11:51 ` Marek Vasut
  2015-08-12 15:38   ` Stefano Babic
  2015-08-11 12:10 ` Stefano Babic
  1 sibling, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2015-08-11 11:51 UTC (permalink / raw)
  To: u-boot

On Tuesday, August 11, 2015 at 01:44:26 PM, J?rg Krause wrote:
> 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 <marex@denx.de>
> Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 1/1] tools: mxsboot: calculate ECC block level dynamically
  2015-08-11 11:44 [U-Boot] [PATCH 1/1] tools: mxsboot: calculate ECC block level dynamically Jörg Krause
  2015-08-11 11:51 ` Marek Vasut
@ 2015-08-11 12:10 ` Stefano Babic
  1 sibling, 0 replies; 4+ messages in thread
From: Stefano Babic @ 2015-08-11 12:10 UTC (permalink / raw)
  To: u-boot

On 11/08/2015 13:44, J?rg Krause wrote:
> 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 <marex@denx.de>
> Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
> ---
>  tools/mxsboot.c | 21 ++++-----------------
>  1 file changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/tools/mxsboot.c b/tools/mxsboot.c
> index 185b327..15eec91 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;
> 

Reviewed-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 1/1] tools: mxsboot: calculate ECC block level dynamically
  2015-08-11 11:51 ` Marek Vasut
@ 2015-08-12 15:38   ` Stefano Babic
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Babic @ 2015-08-12 15:38 UTC (permalink / raw)
  To: u-boot

On 11/08/2015 13:51, Marek Vasut wrote:
> On Tuesday, August 11, 2015 at 01:44:26 PM, J?rg Krause wrote:
>> 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 <marex@denx.de>
>> Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
> 
> Acked-by: Marek Vasut <marex@denx.de>
> 
> Best regards,
> Marek Vasut
> 

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-12 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-11 11:44 [U-Boot] [PATCH 1/1] tools: mxsboot: calculate ECC block level dynamically Jörg Krause
2015-08-11 11:51 ` Marek Vasut
2015-08-12 15:38   ` Stefano Babic
2015-08-11 12:10 ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox