3c80872ef4cb9160b633029c5de7d0828d9bce26
[openwrt/openwrt.git] / target / linux / ath79 / patches-5.4 / 471-mtd-cfi_cmdset_0002-AMD-chip-0x2201-write-words.patch
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
5
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.
10
11 Without the patch kernel logs will be flooded with entries like below:
12
13 jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
14 jffs2_build_filesystem(): unlocking the mtd device...
15 done.
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
27 ...
28
29 Tested on a Buffalo wzr-hp-g300nh running kernel 5.10.16.
30
31 [1] https://www.cypress.com/file/219941/download
32 or https://datasheetspdf.com/pdf-file/565708/SPANSION/S29GL256N/1
33
34 Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
35 ---
36 drivers/mtd/chips/cfi_cmdset_0002.c | 4 ++++
37 1 file changed, 4 insertions(+)
38
39 diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
40 index a1f3e1031c3d..28b6f3583f8a 100644
41 --- a/drivers/mtd/chips/cfi_cmdset_0002.c
42 +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
43 @@ -272,6 +272,10 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)
44 {
45 struct map_info *map = mtd->priv;
46 struct cfi_private *cfi = map->fldrv_priv;
47 +
48 + if ((cfi->mfr == CFI_MFR_AMD) && (cfi->id == 0x2201))
49 + return;
50 +
51 if (cfi->cfiq->BufWriteTimeoutTyp) {
52 pr_debug("Using buffer write method\n");
53 mtd->_write = cfi_amdstd_write_buffers;
54
55 base-commit: 5de15b610f785f0e188fefb707f0b19de156968a
56 --
57 2.25.1
58