kernel: split patches folder up into backport, pending and hack folders
[openwrt/openwrt.git] / target / linux / generic / backport-4.9 / 061-v4.10-0002-mtd-spi-nor-fix-spansion-quad-enable.patch
1 From 807c16253319ee6ccf8873ae64f070f7eb532cd5 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Jo=C3=ABl=20Esponde?= <joel.esponde@honeywell.com>
3 Date: Wed, 23 Nov 2016 12:47:40 +0100
4 Subject: [PATCH] mtd: spi-nor: fix spansion quad enable
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 With the S25FL127S nor flash part, each writing to the configuration
10 register takes hundreds of ms. During that time, no more accesses to
11 the flash should be done (even reads).
12
13 This commit adds a wait loop after the register writing until the flash
14 finishes its work.
15
16 This issue could make rootfs mounting fail when the latter was done too
17 much closely to this quad enable bit setting step. And in this case, a
18 driver as UBIFS may try to recover the filesystem and may broke it
19 completely.
20
21 Signed-off-by: Joël Esponde <joel.esponde@honeywell.com>
22 Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
23 ---
24 drivers/mtd/spi-nor/spi-nor.c | 7 +++++++
25 1 file changed, 7 insertions(+)
26
27 --- a/drivers/mtd/spi-nor/spi-nor.c
28 +++ b/drivers/mtd/spi-nor/spi-nor.c
29 @@ -1256,6 +1256,13 @@ static int spansion_quad_enable(struct s
30 return -EINVAL;
31 }
32
33 + ret = spi_nor_wait_till_ready(nor);
34 + if (ret) {
35 + dev_err(nor->dev,
36 + "timeout while writing configuration register\n");
37 + return ret;
38 + }
39 +
40 /* read back and check it */
41 ret = read_cr(nor);
42 if (!(ret > 0 && (ret & CR_QUAD_EN_SPAN))) {