]> git.itanic.dy.fi Git - linux-stable/commitdiff
mtd: physmap-core: Restore map_rom fallback
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 30 Aug 2023 15:00:34 +0000 (17:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 10:16:21 +0000 (12:16 +0200)
commit 6792b7fce610bcd1cf3e07af3607fe7e2c38c1d8 upstream.

When the exact mapping type driver was not available, the old
physmap_of_core driver fell back to mapping the region as ROM.
Unfortunately this feature was lost when the DT and pdata cases were
merged.  Revive this useful feature.

Fixes: 642b1e8dbed7bbbf ("mtd: maps: Merge physmap_of.c into physmap-core.c")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/550e8c8c1da4c4baeb3d71ff79b14a18d4194f9e.1693407371.git.geert+renesas@glider.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/maps/physmap-core.c

index c73854da513633a04f66fb76bde8e3b46ae14221..19dad5a23f94454a9cb30172efbcc020e4e5737c 100644 (file)
@@ -552,6 +552,17 @@ static int physmap_flash_probe(struct platform_device *dev)
                if (info->probe_type) {
                        info->mtds[i] = do_map_probe(info->probe_type,
                                                     &info->maps[i]);
+
+                       /* Fall back to mapping region as ROM */
+                       if (!info->mtds[i] && IS_ENABLED(CONFIG_MTD_ROM) &&
+                           strcmp(info->probe_type, "map_rom")) {
+                               dev_warn(&dev->dev,
+                                        "map_probe() failed for type %s\n",
+                                        info->probe_type);
+
+                               info->mtds[i] = do_map_probe("map_rom",
+                                                            &info->maps[i]);
+                       }
                } else {
                        int j;