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

smtpuser smtpuser at allied-telesis.co.jp
Tue Apr 24 19:17:26 PDT 2018

From: Tokunori Ikegami <ikegami at allied-telesis.co.jp>

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.

Signed-off-by: Tokunori Ikegami <ikegami at allied-telesis.co.jp>
Cc: Chris Packham <chris.packham at alliedtelesis.co.nz>
Cc: David Woodhouse <dwmw2 at infradead.org>
Cc: Boris Brezillon <boris.brezillon at free-electrons.com>
Cc: Marek Vasut <marek.vasut at gmail.com>
Cc: Richard Weinberger <richard at nod.at>
Cc: Cyrille Pitchen <cyrille.pitchen at wedev4u.fr>
Cc: linux-mtd at lists.infradead.org
I have just updated the patch to add Signed-off-by and Cc lines.
This patch will be sent by git-send-email.
Also for our company mail system the sender mail address is needed to be set as smtpuser <smtpuser at allied-telesis.co.jp>.
But do not reply to the email address smtpuser <smtpuser at allied-telesis.co.jp>.
Please reply to my email address Tokunori Ikegami <ikegami at allied-telesis.co.jp> if any comemnt or problem.
Sorry for inconvinient about this.

 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);

More information about the linux-mtd mailing list