All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] atmel_nand: add sama5d2 chip support, which support up to 32bit pmecc
@ 2015-11-24  8:33 Josh Wu
  2015-11-24  8:34 ` [U-Boot] [PATCH 1/2] atmel_nand_ecc: update pmecc registers according to sama5d2 chip Josh Wu
  2015-11-24  8:34 ` [U-Boot] [PATCH 2/2] atmel_nand: Add 32 bit ecc support for " Josh Wu
  0 siblings, 2 replies; 8+ messages in thread
From: Josh Wu @ 2015-11-24  8:33 UTC (permalink / raw)
  To: u-boot

This patch set will enable sama5d2 chip pmecc support, it includes:
  1. update the pmecc registers and pmecc error location registers map.
  2. add 32bit ecc support.


Josh Wu (2):
  atmel_nand_ecc: update pmecc registers according to sama5d2 chip
  atmel_nand: Add 32 bit ecc support for sama5d2 chip

 drivers/mtd/nand/atmel_nand.c     | 10 +++++++++-
 drivers/mtd/nand/atmel_nand_ecc.h | 36 ++++++++++++++++++++++++++++++++----
 2 files changed, 41 insertions(+), 5 deletions(-)

-- 
1.9.1

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

* [U-Boot] [PATCH 1/2] atmel_nand_ecc: update pmecc registers according to sama5d2 chip
  2015-11-24  8:33 [U-Boot] [PATCH 0/2] atmel_nand: add sama5d2 chip support, which support up to 32bit pmecc Josh Wu
@ 2015-11-24  8:34 ` Josh Wu
  2016-02-02  8:18   ` Andreas Bießmann
  2016-02-02 10:50   ` [U-Boot] [U-Boot, " Andreas Bießmann
  2015-11-24  8:34 ` [U-Boot] [PATCH 2/2] atmel_nand: Add 32 bit ecc support for " Josh Wu
  1 sibling, 2 replies; 8+ messages in thread
From: Josh Wu @ 2015-11-24  8:34 UTC (permalink / raw)
  To: u-boot

1. add the pmecc register mapping for sama5d2.
2. add the pmecc error location register mapping for sama5d2.
3. add some new field that is different from old ip.
4. add sama5d2 pmecc ip version number.

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

 drivers/mtd/nand/atmel_nand_ecc.h | 36 ++++++++++++++++++++++++++++++++----
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand_ecc.h b/drivers/mtd/nand/atmel_nand_ecc.h
index 79e3994..e13f385 100644
--- a/drivers/mtd/nand/atmel_nand_ecc.h
+++ b/drivers/mtd/nand/atmel_nand_ecc.h
@@ -58,14 +58,23 @@ struct pmecc_regs {
 
 	/* 0x40 + sector_num * (0x40), Redundancy Registers */
 	struct {
+#ifdef CONFIG_SAMA5D2
+		u8 ecc[56];	/* PMECC Generated Redundancy Byte Per Sector */
+		u32 reserved1[2];
+#else
 		u8 ecc[44];	/* PMECC Generated Redundancy Byte Per Sector */
 		u32 reserved1[5];
+#endif
 	} ecc_port[PMECC_MAX_SECTOR_NUM];
 
 	/* 0x240 + sector_num * (0x40) Remainder Registers */
 	struct {
+#ifdef CONFIG_SAMA5D2
+		u32 rem[16];
+#else
 		u32 rem[12];
 		u32 reserved2[4];
+#endif
 	} rem_port[PMECC_MAX_SECTOR_NUM];
 	u32 reserved3[16];	/* 0x440-0x47C Reserved */
 };
@@ -76,6 +85,7 @@ struct pmecc_regs {
 #define		PMECC_CFG_BCH_ERR8		(2 << 0)
 #define		PMECC_CFG_BCH_ERR12		(3 << 0)
 #define		PMECC_CFG_BCH_ERR24		(4 << 0)
+#define		PMECC_CFG_BCH_ERR32		(5 << 0)
 
 #define		PMECC_CFG_SECTOR512		(0 << 4)
 #define		PMECC_CFG_SECTOR1024		(1 << 4)
@@ -120,19 +130,31 @@ struct pmecc_errloc_regs {
 	u32 elimr;	/* 0x0C Error Location Interrupt Mask Register */
 	u32 elisr;	/* 0x20 Error Location Interrupt Status Register */
 	u32 reserved0;	/* 0x24 Reserved */
+#ifdef CONFIG_SAMA5D2
+	u32 sigma[33];	/* 0x28-0xA8 Error Location Sigma Registers */
+	u32 el[32];	/* 0xAC-0x128 Error Location Registers */
+
+	/*
+	 * 0x12C-0x1FC:
+	 *   Reserved for SAMA5D2.
+	 */
+	u32 reserved1[53];
+#else
 	u32 sigma[25];	/* 0x28-0x88 Error Location Sigma Registers */
 	u32 el[24];	/* 0x8C-0xE8 Error Location Registers */
 	u32 reserved1[5];	/* 0xEC-0xFC Reserved */
+#endif
 
 	/*
-	 * 0x100-0x1F8:
-	 *   Reserved for AT91SAM9X5, AT91SAM9N12.
-	 *   HSMC registers for SAMA5D3, SAMA5D4.
+	 * SAMA5 chip HSMC registers start here. But for 9X5 chip it is just
+	 * reserved.
+	 *
+	 * Offset 0x00-0xF8:
 	 */
 	u32 reserved2[63];
 
 	/*
-	 * 0x1FC:
+	 * Offset 0xFC:
 	 *   PMECC version for AT91SAM9X5, AT91SAM9N12.
 	 *   HSMC version for SAMA5D3, SAMA5D4. Can refer as PMECC version.
 	 */
@@ -148,10 +170,16 @@ struct pmecc_errloc_regs {
 #define		PMERRLOC_DISABLE		(1 << 0)
 
 /* For Error Location Interrupt Status Register */
+#ifdef CONFIG_SAMA5D2
+#define		PMERRLOC_ERR_NUM_MASK		(0x3f << 8)
+#else
 #define		PMERRLOC_ERR_NUM_MASK		(0x1f << 8)
+#endif
+
 #define		PMERRLOC_CALC_DONE		(1 << 0)
 
 /* PMECC IP version */
+#define PMECC_VERSION_SAMA5D2			0x210
 #define PMECC_VERSION_SAMA5D4			0x113
 #define PMECC_VERSION_SAMA5D3			0x112
 #define PMECC_VERSION_AT91SAM9N12		0x102
-- 
1.9.1

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

* [U-Boot] [PATCH 2/2] atmel_nand: Add 32 bit ecc support for sama5d2 chip
  2015-11-24  8:33 [U-Boot] [PATCH 0/2] atmel_nand: add sama5d2 chip support, which support up to 32bit pmecc Josh Wu
  2015-11-24  8:34 ` [U-Boot] [PATCH 1/2] atmel_nand_ecc: update pmecc registers according to sama5d2 chip Josh Wu
@ 2015-11-24  8:34 ` Josh Wu
  2015-12-08  1:32   ` Scott Wood
                     ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Josh Wu @ 2015-11-24  8:34 UTC (permalink / raw)
  To: u-boot

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(-)

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 ) */
-- 
1.9.1

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

* [U-Boot] [PATCH 2/2] atmel_nand: Add 32 bit ecc support for sama5d2 chip
  2015-11-24  8:34 ` [U-Boot] [PATCH 2/2] atmel_nand: Add 32 bit ecc support for " Josh Wu
@ 2015-12-08  1:32   ` Scott Wood
  2016-02-02  8:21   ` Andreas Bießmann
  2016-02-02 10:50   ` [U-Boot] [U-Boot, " Andreas Bießmann
  2 siblings, 0 replies; 8+ messages in thread
From: Scott Wood @ 2015-12-08  1:32 UTC (permalink / raw)
  To: u-boot

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

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

* [U-Boot] [PATCH 1/2] atmel_nand_ecc: update pmecc registers according to sama5d2 chip
  2015-11-24  8:34 ` [U-Boot] [PATCH 1/2] atmel_nand_ecc: update pmecc registers according to sama5d2 chip Josh Wu
@ 2016-02-02  8:18   ` Andreas Bießmann
  2016-02-02 10:50   ` [U-Boot] [U-Boot, " Andreas Bießmann
  1 sibling, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2016-02-02  8:18 UTC (permalink / raw)
  To: u-boot

On 24.11.2015 09:34, Josh Wu wrote:
> 1. add the pmecc register mapping for sama5d2.
> 2. add the pmecc error location register mapping for sama5d2.
> 3. add some new field that is different from old ip.
> 4. add sama5d2 pmecc ip version number.
> 
> Signed-off-by: Josh Wu <josh.wu@atmel.com>

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

> ---
> 
>  drivers/mtd/nand/atmel_nand_ecc.h | 36 ++++++++++++++++++++++++++++++++----
>  1 file changed, 32 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/nand/atmel_nand_ecc.h b/drivers/mtd/nand/atmel_nand_ecc.h
> index 79e3994..e13f385 100644
> --- a/drivers/mtd/nand/atmel_nand_ecc.h
> +++ b/drivers/mtd/nand/atmel_nand_ecc.h
> @@ -58,14 +58,23 @@ struct pmecc_regs {
>  
>  	/* 0x40 + sector_num * (0x40), Redundancy Registers */
>  	struct {
> +#ifdef CONFIG_SAMA5D2
> +		u8 ecc[56];	/* PMECC Generated Redundancy Byte Per Sector */
> +		u32 reserved1[2];
> +#else
>  		u8 ecc[44];	/* PMECC Generated Redundancy Byte Per Sector */
>  		u32 reserved1[5];
> +#endif
>  	} ecc_port[PMECC_MAX_SECTOR_NUM];
>  
>  	/* 0x240 + sector_num * (0x40) Remainder Registers */
>  	struct {
> +#ifdef CONFIG_SAMA5D2
> +		u32 rem[16];
> +#else
>  		u32 rem[12];
>  		u32 reserved2[4];
> +#endif
>  	} rem_port[PMECC_MAX_SECTOR_NUM];
>  	u32 reserved3[16];	/* 0x440-0x47C Reserved */
>  };
> @@ -76,6 +85,7 @@ struct pmecc_regs {
>  #define		PMECC_CFG_BCH_ERR8		(2 << 0)
>  #define		PMECC_CFG_BCH_ERR12		(3 << 0)
>  #define		PMECC_CFG_BCH_ERR24		(4 << 0)
> +#define		PMECC_CFG_BCH_ERR32		(5 << 0)
>  
>  #define		PMECC_CFG_SECTOR512		(0 << 4)
>  #define		PMECC_CFG_SECTOR1024		(1 << 4)
> @@ -120,19 +130,31 @@ struct pmecc_errloc_regs {
>  	u32 elimr;	/* 0x0C Error Location Interrupt Mask Register */
>  	u32 elisr;	/* 0x20 Error Location Interrupt Status Register */
>  	u32 reserved0;	/* 0x24 Reserved */
> +#ifdef CONFIG_SAMA5D2
> +	u32 sigma[33];	/* 0x28-0xA8 Error Location Sigma Registers */
> +	u32 el[32];	/* 0xAC-0x128 Error Location Registers */
> +
> +	/*
> +	 * 0x12C-0x1FC:
> +	 *   Reserved for SAMA5D2.
> +	 */
> +	u32 reserved1[53];
> +#else
>  	u32 sigma[25];	/* 0x28-0x88 Error Location Sigma Registers */
>  	u32 el[24];	/* 0x8C-0xE8 Error Location Registers */
>  	u32 reserved1[5];	/* 0xEC-0xFC Reserved */
> +#endif
>  
>  	/*
> -	 * 0x100-0x1F8:
> -	 *   Reserved for AT91SAM9X5, AT91SAM9N12.
> -	 *   HSMC registers for SAMA5D3, SAMA5D4.
> +	 * SAMA5 chip HSMC registers start here. But for 9X5 chip it is just
> +	 * reserved.
> +	 *
> +	 * Offset 0x00-0xF8:
>  	 */
>  	u32 reserved2[63];
>  
>  	/*
> -	 * 0x1FC:
> +	 * Offset 0xFC:
>  	 *   PMECC version for AT91SAM9X5, AT91SAM9N12.
>  	 *   HSMC version for SAMA5D3, SAMA5D4. Can refer as PMECC version.
>  	 */
> @@ -148,10 +170,16 @@ struct pmecc_errloc_regs {
>  #define		PMERRLOC_DISABLE		(1 << 0)
>  
>  /* For Error Location Interrupt Status Register */
> +#ifdef CONFIG_SAMA5D2
> +#define		PMERRLOC_ERR_NUM_MASK		(0x3f << 8)
> +#else
>  #define		PMERRLOC_ERR_NUM_MASK		(0x1f << 8)
> +#endif
> +
>  #define		PMERRLOC_CALC_DONE		(1 << 0)
>  
>  /* PMECC IP version */
> +#define PMECC_VERSION_SAMA5D2			0x210
>  #define PMECC_VERSION_SAMA5D4			0x113
>  #define PMECC_VERSION_SAMA5D3			0x112
>  #define PMECC_VERSION_AT91SAM9N12		0x102
> 

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

* [U-Boot] [PATCH 2/2] atmel_nand: Add 32 bit ecc support for sama5d2 chip
  2015-11-24  8:34 ` [U-Boot] [PATCH 2/2] atmel_nand: Add 32 bit ecc support for " Josh Wu
  2015-12-08  1:32   ` Scott Wood
@ 2016-02-02  8:21   ` Andreas Bießmann
  2016-02-02 10:50   ` [U-Boot] [U-Boot, " Andreas Bießmann
  2 siblings, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2016-02-02  8:21 UTC (permalink / raw)
  To: u-boot

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 ) */
> 

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

* [U-Boot] [U-Boot, 1/2] atmel_nand_ecc: update pmecc registers according to sama5d2 chip
  2015-11-24  8:34 ` [U-Boot] [PATCH 1/2] atmel_nand_ecc: update pmecc registers according to sama5d2 chip Josh Wu
  2016-02-02  8:18   ` Andreas Bießmann
@ 2016-02-02 10:50   ` Andreas Bießmann
  1 sibling, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2016-02-02 10:50 UTC (permalink / raw)
  To: u-boot

Dear Josh Wu,

Josh Wu <josh.wu@atmel.com> writes:
>1. add the pmecc register mapping for sama5d2.
>2. add the pmecc error location register mapping for sama5d2.
>3. add some new field that is different from old ip.
>4. add sama5d2 pmecc ip version number.
>
>Signed-off-by: Josh Wu <josh.wu@atmel.com>
>Reviewed-by: Andreas Bie?mann <andreas.devel@googlemail.com>
>---
>
> drivers/mtd/nand/atmel_nand_ecc.h | 36 ++++++++++++++++++++++++++++++++----
> 1 file changed, 32 insertions(+), 4 deletions(-)

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

Best regards,
Andreas Bie?mann

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

* [U-Boot] [U-Boot, 2/2] atmel_nand: Add 32 bit ecc support for sama5d2 chip
  2015-11-24  8:34 ` [U-Boot] [PATCH 2/2] atmel_nand: Add 32 bit ecc support for " Josh Wu
  2015-12-08  1:32   ` Scott Wood
  2016-02-02  8:21   ` Andreas Bießmann
@ 2016-02-02 10:50   ` Andreas Bießmann
  2 siblings, 0 replies; 8+ messages in thread
From: Andreas Bießmann @ 2016-02-02 10:50 UTC (permalink / raw)
  To: u-boot

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

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

end of thread, other threads:[~2016-02-02 10:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-24  8:33 [U-Boot] [PATCH 0/2] atmel_nand: add sama5d2 chip support, which support up to 32bit pmecc Josh Wu
2015-11-24  8:34 ` [U-Boot] [PATCH 1/2] atmel_nand_ecc: update pmecc registers according to sama5d2 chip Josh Wu
2016-02-02  8:18   ` Andreas Bießmann
2016-02-02 10:50   ` [U-Boot] [U-Boot, " Andreas Bießmann
2015-11-24  8:34 ` [U-Boot] [PATCH 2/2] atmel_nand: Add 32 bit ecc support for " Josh Wu
2015-12-08  1:32   ` Scott Wood
2016-02-02  8:21   ` Andreas Bießmann
2016-02-02 10:50   ` [U-Boot] [U-Boot, " Andreas Bießmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.