f192ed7f9e6e5d55b258f4e2c7d6f278ecd927eb
[openwrt/staging/chunkeey.git] / target / linux / gemini / patches-4.19 / 0005-mtd-physmap_of-Move-custom-initialization.patch
1 From 58ecb60d53d43e8d584708722a2cf851ba88f9e1 Mon Sep 17 00:00:00 2001
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Thu, 11 Oct 2018 19:53:40 +0200
4 Subject: [PATCH 05/18] mtd: physmap_of: Move custom initialization
5
6 In order to be able to assign custom complex mappings
7 to the physmap_of plugin for Gemini, move the initialization
8 so that the simple map is initialized before we enter the
9 platform-specific functions so the latter can override
10 them.
11
12 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
13 ---
14 drivers/mtd/maps/physmap_of_core.c | 15 ++++++++-------
15 1 file changed, 8 insertions(+), 7 deletions(-)
16
17 diff --git a/drivers/mtd/maps/physmap_of_core.c b/drivers/mtd/maps/physmap_of_core.c
18 index 4129535b8e46..74ad753265f3 100644
19 --- a/drivers/mtd/maps/physmap_of_core.c
20 +++ b/drivers/mtd/maps/physmap_of_core.c
21 @@ -239,13 +239,6 @@ static int of_flash_probe(struct platform_device *dev)
22 else if (of_property_read_bool(dp, "little-endian"))
23 info->list[i].map.swap = CFI_LITTLE_ENDIAN;
24
25 - err = of_flash_probe_gemini(dev, dp, &info->list[i].map);
26 - if (err)
27 - goto err_out;
28 - err = of_flash_probe_versatile(dev, dp, &info->list[i].map);
29 - if (err)
30 - goto err_out;
31 -
32 err = -ENOMEM;
33 info->list[i].map.virt = ioremap(info->list[i].map.phys,
34 info->list[i].map.size);
35 @@ -257,6 +250,14 @@ static int of_flash_probe(struct platform_device *dev)
36
37 simple_map_init(&info->list[i].map);
38
39 + /* Variants can override map accessors */
40 + err = of_flash_probe_gemini(dev, dp, &info->list[i].map);
41 + if (err)
42 + goto err_out;
43 + err = of_flash_probe_versatile(dev, dp, &info->list[i].map);
44 + if (err)
45 + goto err_out;
46 +
47 /*
48 * On some platforms (e.g. MPC5200) a direct 1:1 mapping
49 * may cause problems with JFFS2 usage, as the local bus (LPB)
50 --
51 2.19.2
52