public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* mtd: cfi_cmdset_0002: Read data 3 times to check write operation status
@ 2018-04-24  5:54 IKEGAMI Tokunori
  2018-04-24 11:04 ` Joakim Tjernlund
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: IKEGAMI Tokunori @ 2018-04-24  5:54 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org; +Cc: PACKHAM Chris

Hi,

Let us consult to change mtd cfi_cmdset_0002 to read data 3 times as below patch.
Can we change the mtd cfi_cmdset_0002 driver like this?
If any comment or concern please let us know.

>From d924822c996b9c0eccc815e5018a0c3ea6077137 Mon Sep 17 00:00:00 2001
From: Tokunori Ikegami <ikegami@allied-telesis.co.jp>
Date: Tue, 24 Apr 2018 13:26:37 +0900
Subject: [PATCH 2/2] mtd: cfi_cmdset_0002: Read data 3 times to check write
 operation status

Cypress S29GLxxxP flash is needed to read data 3 times to check DQ6 toggles.
Actually the read data is sometimes changed by the 3rd reading.
Also this is caused on other flash device also.
The flash write failure is possible to be caused by the error.
To resolve the issue change the read number of times to 3 from 2.
---
 drivers/mtd/chips/cfi_cmdset_0002.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 56aa6b75213d..dc7667ff134a 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -743,12 +743,13 @@ static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd)
  */
 static int __xipram chip_ready(struct map_info *map, unsigned long addr)
 {
-	map_word d, t;
+	map_word r1, r2, r3;
 
-	d = map_read(map, addr);
-	t = map_read(map, addr);
+	r1 = map_read(map, addr);
+	r2 = map_read(map, addr);
+	r3 = map_read(map, addr);
 
-	return map_word_equal(map, d, t);
+	return map_word_equal(map, r1, r2) && map_word_equal(map, r2, r3);
 }
 
 /*
-- 
2.16.1

Regards,
Ikegami

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

end of thread, other threads:[~2018-05-09 14:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-24  5:54 mtd: cfi_cmdset_0002: Read data 3 times to check write operation status IKEGAMI Tokunori
2018-04-24 11:04 ` Joakim Tjernlund
2018-04-24 14:08   ` IKEGAMI Tokunori
2018-04-24 17:21     ` Joakim Tjernlund
2018-04-25  0:11       ` IKEGAMI Tokunori
2018-04-25  2:17 ` [PATCH] " smtpuser
2018-05-09 14:00 ` Boris Brezillon
2018-05-09 14:32   ` IKEGAMI Tokunori

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