public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH][CFI] Wrong cache invalidation bug fix
@ 2007-12-03 16:34 massimo cirillo
  2007-12-03 17:12 ` Nicolas Pitre
  0 siblings, 1 reply; 9+ messages in thread
From: massimo cirillo @ 2007-12-03 16:34 UTC (permalink / raw)
  To: Nico, joern, linux-mtd

Hi,

We encountered the problem with cache invalidation in CFI driver. It
causes corruptions of data read from flash.

The problem is investigated. The original code performs cache
invalidation from "adr" to "adr + len" in do_write_buffer(). Since len
and adr could be updated in the code before invalidation - it causes
improper setting of cache invalidation regions.
The following patch fixes this problem. This patch has been verified
on our OMAP based platform.
Could you please acknowledge and commit this patch?

Thanks a lot.

Signed-off-by Massimo Cirillo <maxcir@gmail.com> and Giuseppe D'Eliseo
<giuseppedeliseo@gmail.com>

------

diff -aur a/drivers/mtd/chips/cfi_cmdset_0001.c
b/drivers/mtd/chips/cfi_cmdset_0001.c

--- a/drivers/mtd/chips/cfi_cmdset_0001.c	2007-11-20 20:15:02.000000000 +0300
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c	2007-11-29 19:42:08.000000000 +0300
@@ -1530,9 +1530,12 @@
 	int ret, wbufsize, word_gap, words;
 	const struct kvec *vec;
 	unsigned long vec_seek;
+	unsigned long initial_adr;
+	int initial_len=len;

 	wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
 	adr += chip->start;
+	initial_adr = adr;
 	cmd_adr = adr & ~(wbufsize-1);

 	/* Let's determine this according to the interleave only once */
@@ -1636,7 +1639,7 @@
 	chip->state = FL_WRITING;

 	ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
-				   adr, len,
+				   initial_adr, initial_len,
 				   chip->buffer_write_time);
 	if (ret) {
 		map_write(map, CMD(0x70), cmd_adr);

------

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-01-30  1:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-03 16:34 [PATCH][CFI] Wrong cache invalidation bug fix massimo cirillo
2007-12-03 17:12 ` Nicolas Pitre
2007-12-04  0:08   ` Jörn Engel
     [not found]     ` <62cbdcd90712130248mc82d9cdp781fde10dd73d1b3@mail.gmail.com>
2007-12-13 10:54       ` massimo cirillo
2008-01-11  9:44         ` Uli Luckas
2007-12-05 15:58   ` massimo cirillo
2008-01-11 10:50     ` Alexey Korolev
2008-01-11 11:03       ` David Woodhouse
2008-01-30  1:40         ` Jared Hulbert

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