kernel: bump 5.4 to 5.4.108
[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 --- 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
42 {
43 struct map_info *map = mtd->priv;
44 struct cfi_private *cfi = map->fldrv_priv;
45 +
46 + if ((cfi->mfr == CFI_MFR_AMD) && (cfi->id == 0x2201))
47 + return;
48 +
49 if (cfi->cfiq->BufWriteTimeoutTyp) {
50 pr_debug("Using buffer write method\n");
51 mtd->_write = cfi_amdstd_write_buffers;