Skip to contentSkip to conversation

NAND

PATCH New Savin Zlobec 1 participant 1 message Jun 21, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NAND

Hi,

this patch fixes nand status handling in nand_write_oob_std and nand busy wait in nand_do_read_oob.

savin

mtd/nand/nand_base.c renamed from mtd/nand/nand_base.c.orig +5 -5
@@ -1174,11 +1174,11 @@
 	/* Send command to program the OOB data */
 	chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
 
 	status = chip->waitfunc(mtd, chip);
 
-	return status;
+	return status & NAND_STATUS_FAIL ? -EIO : 0;
 }
 
 /**
  * nand_write_oob_syndrome - [REPLACABLE] OOB data write function for HW ECC
  *			     with syndrome - only for large page flash !
@@ -1269,14 +1269,10 @@
 
 	while(1) {
 		sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd);
 		buf = nand_transfer_oob(chip, buf, ops);
 
-		readlen -= ops->ooblen;
-		if (!readlen)
-			break;
-
 		if (!(chip->options & NAND_NO_READRDY)) {
 			/*
 			 * Apply delay or wait for ready/busy pin. Do this
 			 * before the AUTOINCR check, so no problems arise if a
 			 * chip which does auto increment is marked as
@@ -1286,10 +1282,14 @@
 				udelay(chip->chip_delay);
 			else
 				nand_wait_ready(mtd);
 		}
 
+		readlen -= ops->ooblen;
+		if (!readlen)
+			break;
+
 		/* Increment page address */
 		realpage++;
 
 		page = realpage & chip->pagemask;
 		/* Check, if we cross a chip boundary */