Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: physmap_of: Add read-only fallback

Previously, when probing a CFI chip which was write-protected at the
hardware level, the probe would fail due to the fact it could not put
the chip into QUERY mode. This would result in no MTD devices being
created.

Add a fallback to probe using the map_rom driver if the user-selected
probe fails.

Signed-off-by: Joe Schultz <jschultz@xes-inc.com>
Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

authored by

Joe Schultz and committed by
Brian Norris
3fc1cf5f 106effbe

+10
+10
drivers/mtd/maps/physmap_of.c
··· 269 269 info->list[i].mtd = obsolete_probe(dev, 270 270 &info->list[i].map); 271 271 } 272 + 273 + /* Fall back to mapping region as ROM */ 274 + if (!info->list[i].mtd) { 275 + dev_warn(&dev->dev, 276 + "do_map_probe() failed for type %s\n", 277 + probe_type); 278 + 279 + info->list[i].mtd = do_map_probe("map_rom", 280 + &info->list[i].map); 281 + } 272 282 mtd_list[i] = info->list[i].mtd; 273 283 274 284 err = -ENXIO;