1 From f1f811410af297c848e9ec17eaa280d190fdce10 Mon Sep 17 00:00:00 2001
2 From: Mauri Sandberg <sandberg@mailfence.com>
3 Date: Tue, 23 Feb 2021 18:09:31 +0200
4 Subject: [PATCH] mtd: cfi_cmdset_0002: AMD chip 0x2201 - write words
6 Buffer writes do not work with AMD chip 0x2201. The chip in question
7 is a AMD/Spansion/Cypress Semiconductor S29GL256N and datasheet [1]
8 talks about writing buffers being possible. While waiting for a neater
9 solution resort to writing word-sized chunks only.
11 Without the patch kernel logs will be flooded with entries like below:
13 jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
14 jffs2_build_filesystem(): unlocking the mtd device...
16 jffs2_build_filesystem(): erasing all blocks after the end marker...
17 MTD do_write_buffer_wait(): software timeout, address:0x01ec000a.
18 jffs2: Write clean marker to block at 0x01920000 failed: -5
19 MTD do_write_buffer_wait(): software timeout, address:0x01e2000a.
20 jffs2: Write clean marker to block at 0x01880000 failed: -5
21 MTD do_write_buffer_wait(): software timeout, address:0x01e0000a.
22 jffs2: Write clean marker to block at 0x01860000 failed: -5
23 MTD do_write_buffer_wait(): software timeout, address:0x01dc000a.
24 jffs2: Write clean marker to block at 0x01820000 failed: -5
25 MTD do_write_buffer_wait(): software timeout, address:0x01da000a.
26 jffs2: Write clean marker to block at 0x01800000 failed: -5
29 Tested on a Buffalo wzr-hp-g300nh running kernel 5.10.16.
31 [1] https://www.cypress.com/file/219941/download
32 or https://datasheetspdf.com/pdf-file/565708/SPANSION/S29GL256N/1
34 Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
36 drivers/mtd/chips/cfi_cmdset_0002.c | 4 ++++
37 1 file changed, 4 insertions(+)
39 --- a/drivers/mtd/chips/cfi_cmdset_0002.c
40 +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
41 @@ -272,6 +272,10 @@ static void fixup_use_write_buffers(stru
43 struct map_info *map = mtd->priv;
44 struct cfi_private *cfi = map->fldrv_priv;
46 + if ((cfi->mfr == CFI_MFR_AMD) && (cfi->id == 0x2201))
49 if (cfi->cfiq->BufWriteTimeoutTyp) {
50 pr_debug("Using buffer write method\n");
51 mtd->_write = cfi_amdstd_write_buffers;