Skip to content

Commit

Permalink
mtd: physmap-core: Restore map_rom fallback
Browse files Browse the repository at this point in the history
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
  • Loading branch information
geertu authored and miquelraynal committed Sep 11, 2023
1 parent 3e01d52 commit 6792b7f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/mtd/maps/physmap-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,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;

Expand Down

0 comments on commit 6792b7f

Please sign in to comment.