mtd: physmap_of: Add read-only fallback

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Feb 16 18:59:03 PST 2015


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=3fc1cf5f0af4b625adff03c610f188fa8bc89911
Commit:     3fc1cf5f0af4b625adff03c610f188fa8bc89911
Parent:     106effbe18fa481c9355604dafe8095c9e418319
Author:     Joe Schultz <jschultz at xes-inc.com>
AuthorDate: Thu Sep 25 12:20:08 2014 -0500
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Jan 9 23:22:40 2015 -0800

    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 at xes-inc.com>
    Signed-off-by: Aaron Sierra <asierra at xes-inc.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/maps/physmap_of.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index f35cd20..ff26e97 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -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;



More information about the linux-mtd-cvs mailing list