mtd: physmap_of: Add read-only fallback
[sfrench/cifs-2.6.git] / drivers / mtd / maps / physmap_of.c
index f35cd2081314d79f0c8742a7965f8868d624c764..ff26e979b1a17c243e1525adfceed3886d479ba1 100644 (file)
@@ -269,6 +269,16 @@ static int of_flash_probe(struct platform_device *dev)
                        info->list[i].mtd = obsolete_probe(dev,
                                                           &info->list[i].map);
                }
+
+               /* Fall back to mapping region as ROM */
+               if (!info->list[i].mtd) {
+                       dev_warn(&dev->dev,
+                               "do_map_probe() failed for type %s\n",
+                                probe_type);
+
+                       info->list[i].mtd = do_map_probe("map_rom",
+                                                        &info->list[i].map);
+               }
                mtd_list[i] = info->list[i].mtd;
 
                err = -ENXIO;