diff mbox

[U-Boot,2/2] atmel_nand: Add 32 bit ecc support for sama5d2 chip

Message ID 1448354042-27066-3-git-send-email-josh.wu@atmel.com
State Accepted
Commit 258b21fc69c93172d8e4afaeff3a7303740ce7c6
Delegated to: Andreas Bießmann
Headers show

Commit Message

Josh Wu Nov. 24, 2015, 8:34 a.m. UTC
Also if minimum ecc requirment is bigger then what we support, then just
use our maxium pmecc support.
But it is not safe, so we'll output a warning about this.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---

 drivers/mtd/nand/atmel_nand.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Scott Wood Dec. 8, 2015, 1:32 a.m. UTC | #1
On Tue, 2015-11-24 at 16:34 +0800, Josh Wu wrote:
> Also if minimum ecc requirment is bigger then what we support, then just
> use our maxium pmecc support.
> But it is not safe, so we'll output a warning about this.
> 
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
> 
>  drivers/mtd/nand/atmel_nand.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)

Acked-by: Scott Wood <scottwood@freescale.com>

-Scott
Andreas Bießmann Feb. 2, 2016, 8:21 a.m. UTC | #2
On 24.11.2015 09:34, Josh Wu wrote:
> Also if minimum ecc requirment is bigger then what we support, then just
> use our maxium pmecc support.
> But it is not safe, so we'll output a warning about this.
> 
> Signed-off-by: Josh Wu <josh.wu@atmel.com>

Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>

> ---
> 
>  drivers/mtd/nand/atmel_nand.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
> index 2967eee..bb54e0f 100644
> --- a/drivers/mtd/nand/atmel_nand.c
> +++ b/drivers/mtd/nand/atmel_nand.c
> @@ -80,6 +80,7 @@ static struct nand_ecclayout atmel_pmecc_oobinfo;
>   *                8-bits                13-bytes                 14-bytes
>   *               12-bits                20-bytes                 21-bytes
>   *               24-bits                39-bytes                 42-bytes
> + *               32-bits                52-bytes                 56-bytes
>   */
>  static int pmecc_get_ecc_bytes(int cap, int sector_size)
>  {
> @@ -638,6 +639,9 @@ static void atmel_pmecc_core_init(struct mtd_info *mtd)
>  	case 24:
>  		val = PMECC_CFG_BCH_ERR24;
>  		break;
> +	case 32:
> +		val = PMECC_CFG_BCH_ERR32;
> +		break;
>  	}
>  
>  	if (host->pmecc_sector_size == 512)
> @@ -723,7 +727,11 @@ static int pmecc_choose_ecc(struct atmel_nand_host *host,
>  		else if (*cap <= 24)
>  			host->pmecc_corr_cap = 24;
>  		else
> -			return -EINVAL;
> +#ifdef CONFIG_SAMA5D2
> +			host->pmecc_corr_cap = 32;
> +#else
> +			host->pmecc_corr_cap = 24;
> +#endif
>  	}
>  	if (host->pmecc_sector_size == 0) {
>  		/* use the most fitable sector size (the near smaller one ) */
>
Andreas Bießmann Feb. 2, 2016, 10:50 a.m. UTC | #3
Dear Josh Wu,

Josh Wu <josh.wu@atmel.com> writes:
>Also if minimum ecc requirment is bigger then what we support, then just
>use our maxium pmecc support.
>But it is not safe, so we'll output a warning about this.
>
>Signed-off-by: Josh Wu <josh.wu@atmel.com>
>Acked-by: Scott Wood <scottwood@freescale.com>
>Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
>---
>
> drivers/mtd/nand/atmel_nand.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bießmann
diff mbox

Patch

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 2967eee..bb54e0f 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -80,6 +80,7 @@  static struct nand_ecclayout atmel_pmecc_oobinfo;
  *                8-bits                13-bytes                 14-bytes
  *               12-bits                20-bytes                 21-bytes
  *               24-bits                39-bytes                 42-bytes
+ *               32-bits                52-bytes                 56-bytes
  */
 static int pmecc_get_ecc_bytes(int cap, int sector_size)
 {
@@ -638,6 +639,9 @@  static void atmel_pmecc_core_init(struct mtd_info *mtd)
 	case 24:
 		val = PMECC_CFG_BCH_ERR24;
 		break;
+	case 32:
+		val = PMECC_CFG_BCH_ERR32;
+		break;
 	}
 
 	if (host->pmecc_sector_size == 512)
@@ -723,7 +727,11 @@  static int pmecc_choose_ecc(struct atmel_nand_host *host,
 		else if (*cap <= 24)
 			host->pmecc_corr_cap = 24;
 		else
-			return -EINVAL;
+#ifdef CONFIG_SAMA5D2
+			host->pmecc_corr_cap = 32;
+#else
+			host->pmecc_corr_cap = 24;
+#endif
 	}
 	if (host->pmecc_sector_size == 0) {
 		/* use the most fitable sector size (the near smaller one ) */