diff mbox

[2/2] mtd-physmap: add support users can assign the probe type in board files

Message ID 1263541814-6642-2-git-send-email-21cnbao@gmail.com
State Accepted
Commit 78ef7fab0eb0a5b159842bac89aed74bb0aa7bfe
Headers show

Commit Message

Barry Song Jan. 15, 2010, 7:50 a.m. UTC
There are three reasons to add this support:
1. users probably know the interface type of their flashs, then probe
can be faster if they give the right type in platform data since wrong
types will not be detected.
2. sometimes, detecting can cause destory to system. For example, for
kernel XIP, detecting can cause NOR enter a mode instructions can not
be fetched right, which will make kernel crash.
3. For a new probe which is not listed in the rom_probe_types, if users
assign it in board files, physmap can still probe it.

Signed-off-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
---
 drivers/mtd/maps/physmap.c  |    8 ++++++--
 include/linux/mtd/physmap.h |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Mike Frysinger May 23, 2010, 7:23 a.m. UTC | #1
On Fri, Jan 15, 2010 at 03:50, Barry Song wrote:
> There are three reasons to add this support:
> 1. users probably know the interface type of their flashs, then probe
> can be faster if they give the right type in platform data since wrong
> types will not be detected.
> 2. sometimes, detecting can cause destory to system. For example, for
> kernel XIP, detecting can cause NOR enter a mode instructions can not
> be fetched right, which will make kernel crash.
> 3. For a new probe which is not listed in the rom_probe_types, if users
> assign it in board files, physmap can still probe it.

any input on this patch ?  doesnt seem to be in post 2.6.34 merges ...
-mike
diff mbox

Patch

diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index d9603f7..3b89099 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -136,8 +136,12 @@  static int physmap_flash_probe(struct platform_device *dev)
 		simple_map_init(&info->map[i]);
 
 		probe_type = rom_probe_types;
-		for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++)
-			info->mtd[i] = do_map_probe(*probe_type, &info->map[i]);
+		if (physmap_data->probe_type == NULL) {
+			for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++)
+				info->mtd[i] = do_map_probe(*probe_type, &info->map[i]);
+		} else
+			info->mtd[i] = do_map_probe(physmap_data->probe_type, &info->map[i]);
+
 		if (info->mtd[i] == NULL) {
 			dev_err(&dev->dev, "map_probe failed\n");
 			err = -ENXIO;
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 76f7cab..bcfd9f7 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -25,6 +25,7 @@  struct physmap_flash_data {
 	void			(*set_vpp)(struct map_info *, int);
 	unsigned int		nr_parts;
 	unsigned int		pfow_base;
+	char                    *probe_type;
 	struct mtd_partition	*parts;
 };