[U-Boot] Fix fsl_elbc_nand driver

Andrei Yakimov ayakimov at iptec-inc.com
Tue May 19 04:16:29 CEST 2015


This is my best try. I have test it with my old u-boot,
but not with master. Do not have a bench for it.
This is not very important patch. I do not find 
any other ONFI user in u-boot.
Andrei

>From d76b4ae8e866affa15dd9da860574d0600969d57 Mon Sep 17 00:00:00 2001
From: Andrei Yakimov <ayakimov at iptec-inc.com>
Date: Mon, 18 May 2015 18:50:12 -0700
Subject: [PATCH] ONFI detect reading only first parameter page.

NAND_CMD_PARAM read only first parameter page. Need to read all 3
(as per ONFI spec) due to no error correction for this area

Signed-off-by: Andrei Yakimov <ayakimov at iptec-inc.com>
---

 drivers/mtd/nand/fsl_elbc_nand.c |    9 +++++----
 drivers/mtd/nand/fsl_ifc_nand.c  |   10 ++++++----
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/nand/fsl_elbc_nand.c
b/drivers/mtd/nand/fsl_elbc_nand.c
index e85832d..8ac470f 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -336,11 +336,12 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd,
unsigned int command,
 				    (FIR_OP_RBW << FIR_OP2_SHIFT));
 		out_be32(&lbc->fcr, command << FCR_CMD0_SHIFT);
 		/*
-		 * although currently it's 8 bytes for READID, we always read
-		 * the maximum 256 bytes(for PARAM)
+		 * although currently it's 8 bytes for READID
+		 * param page containg at least 3 copy for
+		 * robustnes, we need to read them all.
 		 */
-		out_be32(&lbc->fbcr, 256);
-		ctrl->read_bytes = 256;
+		out_be32(&lbc->fbcr, (command == NAND_CMD_PARAM) ? 786 : 8);
+		ctrl->read_bytes = (command == NAND_CMD_PARAM) ? 786 : 8;
 		ctrl->use_mdr = 1;
 		ctrl->mdr = column;
 		set_addr(mtd, 0, 0, 0);
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c
b/drivers/mtd/nand/fsl_ifc_nand.c
index 79fa88b..ee96a62 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -459,11 +459,13 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd,
unsigned int command,
 		ifc_out32(&ifc->ifc_nand.row3, column);
 
 		/*
-		 * although currently it's 8 bytes for READID, we always read
-		 * the maximum 256 bytes(for PARAM)
+		 * although currently it's 8 bytes for READID
+		 * param page containg at least 3 copy for
+		 * robustnes, we need to read them all.
 		 */
-		ifc_out32(&ifc->ifc_nand.nand_fbcr, 256);
-		ctrl->read_bytes = 256;
+		ifc_out32(&ifc->ifc_nand.nand_fbcr,
+			  (command == NAND_CMD_PARAM) ? 786 : 8);
+		ctrl->read_bytes = (command == NAND_CMD_PARAM) ? 786 : 8;
 
 		set_addr(mtd, 0, 0, 0);
 		fsl_ifc_run_command(mtd);
-- 
1.7.7.6





More information about the U-Boot mailing list