Skip to contentSkip to conversation

mtd/nand: Fix IFC driver to support 2K NAND page

PATCH New Prabhakar Kushwaha 2 participants 2 messages Jan 20, 2012 – Feb 20, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mtd/nand: Fix IFC driver to support 2K NAND page

1) OOB area should be updated irrespective of NAND page size. Earlier it was updated only for 512byte NAND page.

2) During OOB update fbcr should be equal to OOB size.

---
Based upon git://git.denx.de/u-boot.git (branch master)

Changes for v2- Incorporated Scott's comments from linuxppc-dev mailing list

	 http://patchwork.ozlabs.org/patch/135010/

- Added missed NAND_CMD_READOOB
- Updated function as per Scott's advice

 drivers/mtd/nand/fsl_ifc_nand.c |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)
drivers/mtd/nand/fsl_ifc_nand.c +13 -14
index cd1a434..27d2028 100644
@@ -452,21 +452,19 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
 			out_be32(&ifc->ifc_nand.nand_fir1,
 				 (IFC_FIR_OP_CW1 << IFC_NAND_FIR1_OP5_SHIFT));
 
-			if (column >= mtd->writesize) {
-				/* OOB area --> READOOB */
-				column -= mtd->writesize;
-				nand_fcr0 |= NAND_CMD_READOOB <<
-						IFC_NAND_FCR0_CMD0_SHIFT;
-				ctrl->oob = 1;
-			} else if (column < 256) {
-				/* First 256 bytes --> READ0 */
-				nand_fcr0 |= NAND_CMD_READ0 << FCR_CMD0_SHIFT;
-			} else {
-				/* Second 256 bytes --> READ1 */
-				nand_fcr0 |= NAND_CMD_READ1 << FCR_CMD0_SHIFT;
-			}
+			if (column >= mtd->writesize)
+				nand_fcr0 |=
+				NAND_CMD_READOOB << IFC_NAND_FCR0_CMD0_SHIFT;
+			else
+				nand_fcr0 |=
+				NAND_CMD_READ0 << IFC_NAND_FCR0_CMD0_SHIFT;
 		}
 
+		if (column >= mtd->writesize) {
+			/* OOB area --> READOOB */
+			column -= mtd->writesize;
+			ctrl->oob = 1;
+		}
 		out_be32(&ifc->ifc_nand.nand_fcr0, nand_fcr0);
 		set_addr(mtd, column, page_addr, ctrl->oob);
 		return;
@@ -475,7 +473,8 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
 	/* PAGEPROG reuses all of the setup from SEQIN and adds the length */
 	case NAND_CMD_PAGEPROG:
 		if (ctrl->oob)
-			out_be32(&ifc->ifc_nand.nand_fbcr, ctrl->index);
+			out_be32(&ifc->ifc_nand.nand_fbcr,
+					ctrl->index - ctrl->column);
 		else
 			out_be32(&ifc->ifc_nand.nand_fbcr, 0);
 
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH v2 1/1 mtd/nand: Fix IFC driver to support 2K NAND page

Quoted 10 lines · Prabhakar Kushwaha

1) OOB area should be updated irrespective of NAND page size. Earlier it was updated only for 512byte NAND page.

2) During OOB update fbcr should be equal to OOB size.

---
Based upon git://git.denx.de/u-boot.git (branch master)

Quoted 8 lines

Changes for v2- Incorporated Scott's comments from linuxppc-dev mailing list

	 http://patchwork.ozlabs.org/patch/135010/

- Added missed NAND_CMD_READOOB
- Updated function as per Scott's advice

 drivers/mtd/nand/fsl_ifc_nand.c |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

Applied to u-boot-nand-flash

-Scott