mediatek: v5.15: backport spi-mem ecc support
[openwrt/staging/ldir.git] / target / linux / mediatek / patches-5.15 / 120-08-v5.18-mtd-spinand-Delay-a-little-bit-the-dirmap-creation.patch
1 From 94ef3c35b935a63f6c156957c92f6cf33c9a8dae Mon Sep 17 00:00:00 2001
2 From: Miquel Raynal <miquel.raynal@bootlin.com>
3 Date: Thu, 27 Jan 2022 10:18:02 +0100
4 Subject: [PATCH 08/15] mtd: spinand: Delay a little bit the dirmap creation
5
6 As we will soon tweak the dirmap creation to act a little bit
7 differently depending on the picked ECC engine, we need to initialize
8 dirmaps after ECC engines. This should not have any effect as dirmaps
9 are not yet used at this point.
10
11 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
12 Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
13 Link: https://lore.kernel.org/linux-mtd/20220127091808.1043392-8-miquel.raynal@bootlin.com
14 (cherry picked from commit dc4c2cbf0be2d4a8e2a65013ea2815bb2c8ba949)
15 ---
16 drivers/mtd/nand/spi/core.c | 16 ++++++++--------
17 1 file changed, 8 insertions(+), 8 deletions(-)
18
19 diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
20 index 2c8685f1f2fa..bb6b026b558b 100644
21 --- a/drivers/mtd/nand/spi/core.c
22 +++ b/drivers/mtd/nand/spi/core.c
23 @@ -1208,14 +1208,6 @@ static int spinand_init(struct spinand_device *spinand)
24 if (ret)
25 goto err_free_bufs;
26
27 - ret = spinand_create_dirmaps(spinand);
28 - if (ret) {
29 - dev_err(dev,
30 - "Failed to create direct mappings for read/write operations (err = %d)\n",
31 - ret);
32 - goto err_manuf_cleanup;
33 - }
34 -
35 ret = nanddev_init(nand, &spinand_ops, THIS_MODULE);
36 if (ret)
37 goto err_manuf_cleanup;
38 @@ -1250,6 +1242,14 @@ static int spinand_init(struct spinand_device *spinand)
39 mtd->ecc_strength = nanddev_get_ecc_conf(nand)->strength;
40 mtd->ecc_step_size = nanddev_get_ecc_conf(nand)->step_size;
41
42 + ret = spinand_create_dirmaps(spinand);
43 + if (ret) {
44 + dev_err(dev,
45 + "Failed to create direct mappings for read/write operations (err = %d)\n",
46 + ret);
47 + goto err_cleanup_ecc_engine;
48 + }
49 +
50 return 0;
51
52 err_cleanup_ecc_engine:
53 --
54 2.35.1
55