mtd: cfi_cmdset_0002: Read data 3 times to check write operation status

IKEGAMI Tokunori ikegami at allied-telesis.co.jp
Mon Apr 23 22:54:43 PDT 2018


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 at 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




More information about the linux-mtd mailing list