[PATCH] do_write_oneword and do_erase_oneblock I/O problems

Lars Munch lars at segv.dk
Mon Nov 20 15:41:30 EST 2006


Hi All

I have searched the archives but I could not find an answer to my
problems so here goes:

I am using an SST39VF6401B flash, and hence cfi_cmdset_0002.c on
linux-2.6.19-rc5. Whenever I try to erase or write to the flash I get
I/O errors.

What happens is, first the command is written to the flash, then the
function enters an for(;;) loop waiting chip_ready, immediately after
chip_ready succeeds the chip_good test fails:

        /* Did we succeed? */
        if (!chip_good(map, adr, map_word_ff(map))) {

If I add a small delay after the for(;;) loop and just before the
!chip_good test in do_write_oneword and do_erase_oneblock problems
disappear??  Should we wait here or is there a better way to fix this?

Please see attached patch. Comments?

Thanks
Lars Munch
-------------- next part --------------
--- linux-2.6.19-rc5/drivers/mtd/chips/cfi_cmdset_0002.c	2006-11-08 03:24:20.000000000 +0100
+++ linux-2.6.19-rc5-ks8695/drivers/mtd/chips/cfi_cmdset_0002.c	2006-11-20 20:01:54.000000000 +0100
@@ -1064,6 +1064,9 @@
 		/* Latency issues. Drop the lock, wait a while and retry */
 		UDELAY(map, chip, adr, 1);
 	}
+
+        UDELAY(map, chip, adr, 1000000/HZ);
+
 	/* Did we succeed? */
 	if (!chip_good(map, adr, datum)) {
 		/* reset on all failures. */
@@ -1588,6 +1591,9 @@
 		/* Latency issues. Drop the lock, wait a while and retry */
 		UDELAY(map, chip, adr, 1000000/HZ);
 	}
+
+	UDELAY(map, chip, adr, 1000000/HZ);
+
 	/* Did we succeed? */
 	if (!chip_good(map, adr, map_word_ff(map))) {
 		/* reset on all failures. */


More information about the linux-mtd mailing list