public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] NAND
@ 2006-06-21  9:15 Savin Zlobec
  0 siblings, 0 replies; only message in thread
From: Savin Zlobec @ 2006-06-21  9:15 UTC (permalink / raw)
  To: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 112 bytes --]

Hi,

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

savin

[-- Attachment #2: nand_base.diff --]
[-- Type: text/x-patch, Size: 1212 bytes --]

--- drivers/mtd/nand/nand_base.c.orig	2006-06-21 10:48:00.000000000 +0200
+++ drivers/mtd/nand/nand_base.c	2006-06-21 11:10:38.000000000 +0200
@@ -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 */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-06-21  9:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-21  9:15 [PATCH] NAND Savin Zlobec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox