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

mtd-physmap: add support users can assign the probe type in board files

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>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Barry Song and committed by
David Woodhouse
78ef7fab 73ee5760

+7 -2
+6 -2
drivers/mtd/maps/physmap.c
··· 136 136 simple_map_init(&info->map[i]); 137 137 138 138 probe_type = rom_probe_types; 139 - for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++) 140 - info->mtd[i] = do_map_probe(*probe_type, &info->map[i]); 139 + if (physmap_data->probe_type == NULL) { 140 + for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++) 141 + info->mtd[i] = do_map_probe(*probe_type, &info->map[i]); 142 + } else 143 + info->mtd[i] = do_map_probe(physmap_data->probe_type, &info->map[i]); 144 + 141 145 if (info->mtd[i] == NULL) { 142 146 dev_err(&dev->dev, "map_probe failed\n"); 143 147 err = -ENXIO;
+1
include/linux/mtd/physmap.h
··· 25 25 void (*set_vpp)(struct map_info *, int); 26 26 unsigned int nr_parts; 27 27 unsigned int pfow_base; 28 + char *probe_type; 28 29 struct mtd_partition *parts; 29 30 }; 30 31