Skip to content

Commit 6792b7f

Browse files
geertumiquelraynal
authored andcommitted
mtd: physmap-core: Restore map_rom fallback
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: 642b1e8 ("mtd: maps: Merge physmap_of.c into physmap-core.c") Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/550e8c8c1da4c4baeb3d71ff79b14a18d4194f9e.1693407371.git.geert+renesas@glider.be
1 parent 3e01d52 commit 6792b7f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/mtd/maps/physmap-core.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,17 @@ static int physmap_flash_probe(struct platform_device *dev)
551551
if (info->probe_type) {
552552
info->mtds[i] = do_map_probe(info->probe_type,
553553
&info->maps[i]);
554+
555+
/* Fall back to mapping region as ROM */
556+
if (!info->mtds[i] && IS_ENABLED(CONFIG_MTD_ROM) &&
557+
strcmp(info->probe_type, "map_rom")) {
558+
dev_warn(&dev->dev,
559+
"map_probe() failed for type %s\n",
560+
info->probe_type);
561+
562+
info->mtds[i] = do_map_probe("map_rom",
563+
&info->maps[i]);
564+
}
554565
} else {
555566
int j;
556567

0 commit comments

Comments
 (0)