[U-Boot,2/5] mtd: atmel_nand: enable PMECC support for 8k bytes page NAND flash
diff mbox

Message ID 1382089595-5235-3-git-send-email-josh.wu@atmel.com
State Accepted
Delegated to: Scott Wood
Headers show

Commit Message

Josh Wu Oct. 18, 2013, 9:46 a.m. UTC
increase the delay to 75us to support the 8k bytes page nand flash

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 Nov. 14, 2013, 1:15 a.m. UTC | #1
On Fri, Oct 18, 2013 at 05:46:31PM +0800, Wu, Josh wrote:
> @@ -840,6 +841,13 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,
>  		nand->ecc.steps = 1;
>  		nand->ecc.bytes = host->pmecc_bytes_per_sector *
>  				       host->pmecc_sector_number;
> +
> +		if (nand->ecc.bytes > MTD_MAX_ECCPOS_ENTRIES_LARGE) {
> +			dev_err(host->dev, "too large eccpos entries. max support ecc.bytes is %d\n",
> +					MTD_MAX_ECCPOS_ENTRIES_LARGE);
> +			return -EINVAL;
> +		}

I won't hold up acceptance over this, but wouldn't it be more useful to
show the actual ecc.bytes rather than the constant limit which could be
easily looked up in the source?  Or better, print both.

-Scott

Patch
diff mbox

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index da83f06..2320afe 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -827,6 +827,7 @@  static int atmel_pmecc_nand_init_params(struct nand_chip *nand,
 	switch (mtd->writesize) {
 	case 2048:
 	case 4096:
+	case 8192:
 		host->pmecc_degree = (sector_size == 512) ?
 			PMECC_GF_DIMENSION_13 : PMECC_GF_DIMENSION_14;
 		host->pmecc_cw_len = (1 << host->pmecc_degree) - 1;
@@ -840,6 +841,13 @@  static int atmel_pmecc_nand_init_params(struct nand_chip *nand,
 		nand->ecc.steps = 1;
 		nand->ecc.bytes = host->pmecc_bytes_per_sector *
 				       host->pmecc_sector_number;
+
+		if (nand->ecc.bytes > MTD_MAX_ECCPOS_ENTRIES_LARGE) {
+			dev_err(host->dev, "too large eccpos entries. max support ecc.bytes is %d\n",
+					MTD_MAX_ECCPOS_ENTRIES_LARGE);
+			return -EINVAL;
+		}
+
 		if (nand->ecc.bytes > mtd->oobsize - 2) {
 			printk(KERN_ERR "No room for ECC bytes\n");
 			return -EINVAL;
@@ -1186,7 +1194,7 @@  int atmel_nand_chip_init(int devnum, ulong base_addr)
 #ifdef CONFIG_SYS_NAND_READY_PIN
 	nand->dev_ready = at91_nand_ready;
 #endif
-	nand->chip_delay = 20;
+	nand->chip_delay = 75;
 
 	ret = nand_scan_ident(mtd, CONFIG_SYS_NAND_MAX_CHIPS, NULL);
 	if (ret)