Skip to contentSkip to conversation

MTD: mphysmap driver resurrection

PATCH In review Alexander Belyakov 2 participants 4 messages Jun 14, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MTD: mphysmap driver resurrection

Quoted 5 lines · Josh Boyer

Somehow I just think it was forgotten. Care enough to send a patch (or git tree) to resurrect it?

josh

The patch just contains mphysmap driver code from one of the latest CVS snapshots.

-------

drivers/mtd/maps/Kconfig +0 -0
diff -uNr a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
@@ -60,6 +60,92 @@

Ignore this option if you use run-time physmap configuration (i.e., run-time calling physmap_configure()).

+config MTD_MULTI_PHYSMAP
+ tristate "multiple CFI Flash devices in physical memory map"
+ depends on MTD_CFI
+ help
+ Similar to MTD_PHYSMAP, just allows several seperate mappings.
+
+config MTD_MULTI_PHYSMAP_1_NAME
+ string "1st mapping name"
+ depends on MTD_MULTI_PHYSMAP
+ default ""
+
+config MTD_MULTI_PHYSMAP_1_START
+ hex "1st mapping start"
+ depends on MTD_MULTI_PHYSMAP
+ default "0x00000000"
+
+config MTD_MULTI_PHYSMAP_1_LEN
+ hex "1st mapping length"
+ depends on MTD_MULTI_PHYSMAP
+ default "0x00000000"
+
+config MTD_MULTI_PHYSMAP_1_WIDTH
+ int "1st mapping bus width - 0 disables mapping"
+ depends on MTD_MULTI_PHYSMAP
+ default "2"
+
+config MTD_MULTI_PHYSMAP_2_NAME
+ string "2nd mapping name"
+ depends on MTD_MULTI_PHYSMAP
+ default ""
+
+config MTD_MULTI_PHYSMAP_2_START
+ hex "2nd mapping start"
+ depends on MTD_MULTI_PHYSMAP
+ default "0x00000000"
+
+config MTD_MULTI_PHYSMAP_2_LEN
+ hex "2nd mapping length"
+ depends on MTD_MULTI_PHYSMAP
+ default "0x00000000"
+
+config MTD_MULTI_PHYSMAP_2_WIDTH
+ int "2nd mapping bus width - 0 disables mapping"
+ depends on MTD_MULTI_PHYSMAP
+ default "2"
+
+config MTD_MULTI_PHYSMAP_3_NAME
+ string "3rd mapping name"
+ depends on MTD_MULTI_PHYSMAP
+ default ""
+
+config MTD_MULTI_PHYSMAP_3_START
+ hex "3rd mapping start"
+ depends on MTD_MULTI_PHYSMAP
+ default "0x00000000"
+
+config MTD_MULTI_PHYSMAP_3_LEN
+ hex "3rd mapping length"
+ depends on MTD_MULTI_PHYSMAP
+ default "0x00000000"
+
+config MTD_MULTI_PHYSMAP_3_WIDTH
+ int "3rd mapping bus width - 0 disables mapping"
+ depends on MTD_MULTI_PHYSMAP
+ default "2"
+
+config MTD_MULTI_PHYSMAP_4_NAME
+ string "4th mapping name"
+ depends on MTD_MULTI_PHYSMAP
+ default ""
+
+config MTD_MULTI_PHYSMAP_4_START
+ hex "4th mapping start"
+ depends on MTD_MULTI_PHYSMAP
+ default "0x00000000"
+
+config MTD_MULTI_PHYSMAP_4_LEN
+ hex "4th mapping length"
+ depends on MTD_MULTI_PHYSMAP
+ default "0x00000000"
+
+config MTD_MULTI_PHYSMAP_4_WIDTH
+ int "4th mapping bus width - 0 disables mapping"
+ depends on MTD_MULTI_PHYSMAP
+ default "2"
+
config MTD_SUN_UFLASH

	tristate "Sun Microsystems userflash support"
	depends on SPARC && MTD_CFI
drivers/mtd/maps/Makefile +0 -0
diff -uNr a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
@@ -26,6 +26,7 @@

obj-$(CONFIG_MTD_CEIVA) += ceiva.o
obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o
obj-$(CONFIG_MTD_PHYSMAP) += physmap.o
+obj-$(CONFIG_MTD_MULTI_PHYSMAP) += mphysmap.o
obj-$(CONFIG_MTD_PNC2000) += pnc2000.o
obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o
obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o

drivers/mtd/maps/mphysmap.c +56 -0

56 lines not on this page · raw message

"map_rom", NULL };
+ const char **type;
+ struct mtd_info* mtd;
+#ifdef CONFIG_MTD_PARTITIONS

+       struct mtd_partition* mtd_parts;
+       int mtd_parts_nb;
+       static const char *part_probes[] __initdata = {

+#ifdef CONFIG_MTD_CMDLINE_PARTS
+ "cmdlinepart",
+#endif
+#ifdef CONFIG_MTD_REDBOOT_PARTS
+ "RedBoot",
+#endif
+ NULL};
+#endif
+ map->virt = ioremap(map->phys, map->size);
+ if (!map->virt)
+ return -EIO;
+
+ simple_map_init(map);
+ mtd = NULL;
+ type = rom_probe_types;
+ for(; !mtd && *type; type++) {
+ mtd = do_map_probe(*type, map);
+ }
+
+ if (!mtd) {
+ iounmap(map->virt);
+ return -ENXIO;
+ }
+
+ map->map_priv_1 = (unsigned long)mtd;
+ mtd->owner = THIS_MODULE;
+
+#ifdef CONFIG_MTD_PARTITIONS
+ mtd_parts_nb = parse_mtd_partitions(mtd, part_probes,
+ &mtd_parts, 0);
+ if (mtd_parts_nb > 0)
+ {
+ add_mtd_partitions (mtd, mtd_parts, mtd_parts_nb);
+ map->map_priv_2=(unsigned long)mtd_parts;
+ }
+ else
+ {
+ add_mtd_device(mtd);
+ map->map_priv_2=(unsigned long)NULL;
+ };
+#else
+ add_mtd_device(mtd);
+#endif
+ return 0;
+}
+
+
+static void mphysmap_unmap_device(struct map_info *map)
+{
+ struct mtd_info* mtd = (struct mtd_info*)map->map_priv_1;
+#ifdef CONFIG_MTD_PARTITIONS
+ struct mtd_partition* mtd_parts=(struct mtd_partition*)map->map_priv_2;
+#endif
+ BUG_ON(!mtd);
+ if (!map->virt)
+ return;
+
+#ifdef CONFIG_MTD_PARTITIONS
+ if (mtd_parts)
+ {
+ del_mtd_partitions(mtd);
+ kfree(mtd_parts);
+ }
+ else
+ del_mtd_device(mtd);
+#else
+ del_mtd_device(mtd);
+#endif
+ map_destroy(mtd);
+ iounmap(map->virt);
+
+ map->map_priv_1 = 0;
+ map->map_priv_2 = 0;
+ map->virt = NULL;
+}
+
+
+
+
+static int __init mphysmap_init(void)
+{
+ int i;
+ down(&map_mutex);
+ for (i=0;
+ i<sizeof(mphysmap_static_maps)/sizeof(mphysmap_static_maps[0]);
+ i++)
+ {
+ if (strcmp(mphysmap_static_maps[i].name,"")!=0 &&
+ mphysmap_static_maps[i].size!=0 &&
+ mphysmap_static_maps[i].bankwidth!=0)
+ {
+ mphysmap_map_device(&mphysmap_static_maps[i]);
+ };
+ };
+ up(&map_mutex);
+ return 0;
+}
+
+
+static void __exit mphysmap_exit(void)
+{
+ int i;
+ down(&map_mutex);
+ for (i=0;
+ i<sizeof(mphysmap_static_maps)/sizeof(mphysmap_static_maps[0]);
+ i++)
+ {
+ if (strcmp(mphysmap_static_maps[i].name,"")!=0 &&
+ mphysmap_static_maps[i].size!=0 &&
+ mphysmap_static_maps[i].bankwidth!=0)
+ {
+ mphysmap_unmap_device(&mphysmap_static_maps[i]);
+ };
+ };
+ up(&map_mutex);
+}
+
+
+module_init(mphysmap_init);
+module_exit(mphysmap_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("JЎrn Engel <[email protected]>"); +MODULE_DESCRIPTION("Generic configurable extensible MTD map driver");

#1 lore raw
Quoted 2 lines · Alexander Belyakov

The patch just contains mphysmap driver code from one of the latest CVS snapshots.

Nak. We ought to be able to use the existing physmap driver for this, and just register multiple platform_devices for it.

And this file isn't valid UTF-8, either.

Signature · 1 line
dwmw2
#2 lore raw
Quoted 6 lines · David Woodhouse
Quoted 2 lines · Alexander Belyakov

The patch just contains mphysmap driver code from one of the latest CVS snapshots.

Nak. We ought to be able to use the existing physmap driver for this, and just register multiple platform_devices for it.

Ok. Just posted it in case of unintentional (as Josh mentioned) driver exclusion.

btw, is it possible to find somewhere a kind of list of features/drivers/patches which were removed/reverted during migration to GIT?

Thanks,
Alexander

#3 lore raw
Quoted 6 lines · Alexander Belyakov

Ok. Just posted it in case of unintentional (as Josh mentioned) driver exclusion.

btw, is it possible to find somewhere a kind of list of features/drivers/patches which were removed/reverted during migration to GIT?

Unfortunately not. I did a quick pass through the CVS tree, pulling in the bits which obviously made sense. In general, that didn't include new map drivers, since I actually want to kill as many map drivers as possible in favour of platform_device stuff.

Signature · 1 line
dwmw2