mtd/drivers/mtd/maps ceiva.c,1.5,1.6 dc21285.c,1.12,1.13 edb7312.c,1.5,1.6 epxa10db-flash.c,1.7,1.8 h720x-flash.c,1.3,1.4 impa7.c,1.5,1.6 integrator-flash.c,1.10,1.11 iq80310.c,1.12,1.13 ocelot.c,1.9,1.10 physmap.c,1.24,1.25 sa1100-flash.c,1.32,1.33 solutionengine.c,1.7,1.8

David Woodhouse dwmw2 at infradead.org
Fri May 16 13:07:20 EDT 2003


Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv27751

Modified Files:
	ceiva.c dc21285.c edb7312.c epxa10db-flash.c h720x-flash.c 
	impa7.c integrator-flash.c iq80310.c ocelot.c physmap.c 
	sa1100-flash.c solutionengine.c 
Log Message:
Use new partition probe calls

Index: ceiva.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ceiva.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ceiva.c	14 May 2003 22:26:29 -0000	1.5
+++ ceiva.c	16 May 2003 17:07:15 -0000	1.6
@@ -271,6 +271,7 @@
 }
 
 static struct mtd_partition *parsed_parts;
+static const char *probes[] = { "cmdlinepart", "RedBoot", NULL };
 
 static void __init clps_locate_partitions(struct mtd_info *mtd)
 {
@@ -280,20 +281,11 @@
 		/*
 		 * Partition selection stuff.
 		 */
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-		nr_parts = parse_cmdline_partitions(mtd, &parsed_parts, "clps");
+		nr_parts = parse_mtd_partitions(mtd, probes, &parsed_parts, 0);
 		if (nr_parts > 0) {
 			part_type = "command line";
 			break;
 		}
-#endif
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-		nr_parts = parse_redboot_partitions(mtd, &parsed_parts, (void *)0);
-		if (nr_parts > 0) {
-			part_type = "RedBoot";
-			break;
-		}
-#endif
 #ifdef CONFIG_MTD_CEIVA_STATICMAP
 		nr_parts = clps_static_partitions(&parsed_parts);
 		if (nr_parts > 0) {

Index: dc21285.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dc21285.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- dc21285.c	14 May 2003 22:26:29 -0000	1.12
+++ dc21285.c	16 May 2003 17:07:15 -0000	1.13
@@ -108,9 +108,26 @@
 
 /* Partition stuff */
 static struct mtd_partition *dc21285_parts;
-		      
+#ifdef CONFIG_MTD_PARTITIONS
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+#endif
+  
 int __init init_dc21285(void)
 {
+
+	/* 
+	 * Flash timing is determined with bits 19-16 of the
+	 * CSR_SA110_CNTL.  The value is the number of wait cycles, or
+	 * 0 for 16 cycles (the default).  Cycles are 20 ns.
+	 * Here we use 7 for 140 ns flash chips.
+	 */
+	/* access time */
+	*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x000f0000) | (7 << 16));
+	/* burst time */
+	*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x00f00000) | (7 << 20));
+	/* tristate time */
+	*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x0f000000) | (7 << 24));
+
 	/* Determine buswidth */
 	switch (*CSR_SA110_CNTL & (3<<14)) {
 		case SA110_CNTL_ROMWIDTH_8: 
@@ -144,29 +161,14 @@
 			
 		/* partition fixup */
 
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-		nrparts = parse_redboot_partitions(mymtd, &dc21285_parts, (void *)0);
-#endif
+#ifdef CONFIG_MTD_PARTITIONS
+		nrparts = parse_mtd_partitions(mymtd, probes, &dc21285_parts, (void *)0);
 		if (nrparts > 0) {
 			add_mtd_partitions(mymtd, dc21285_parts, nrparts);
-		} else if (nrparts == 0) {
-			printk(KERN_NOTICE "RedBoot partition table failed\n");
-			add_mtd_device(mymtd);
+			return 0;
 		}
-
-		/* 
-		 * Flash timing is determined with bits 19-16 of the
-		 * CSR_SA110_CNTL.  The value is the number of wait cycles, or
-		 * 0 for 16 cycles (the default).  Cycles are 20 ns.
-		 * Here we use 7 for 140 ns flash chips.
-		 */
-		/* access time */
-		*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x000f0000) | (7 << 16));
-		/* burst time */
-		*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x00f00000) | (7 << 20));
-		/* tristate time */
-		*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x0f000000) | (7 << 24));
-
+#endif
+		add_mtd_device(mymtd);
 		return 0;
 	}
 
@@ -176,17 +178,16 @@
 
 static void __exit cleanup_dc21285(void)
 {
-	if (mymtd) {
-		del_mtd_device(mymtd);
-		map_destroy(mymtd);
-		mymtd = NULL;
-	}
-	if (dc21285_map.map_priv_1) {
-		iounmap((void *)dc21285_map.map_priv_1);
-		dc21285_map.map_priv_1 = 0;
-	}
-	if(dc21285_parts)
+#ifdef CONFIG_MTD_PARTITIONS
+	if (dc21285_parts) {
+		del_mtd_partitions(mymtd);
 		kfree(dc21285_parts);
+	} else
+#endif
+		del_mtd_device(mymtd);
+
+	map_destroy(mymtd);
+	iounmap((void *)dc21285_map.map_priv_1);
 }
 
 module_init(init_dc21285);

Index: edb7312.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/edb7312.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- edb7312.c	14 May 2003 22:26:29 -0000	1.5
+++ edb7312.c	16 May 2003 17:07:15 -0000	1.6
@@ -67,6 +67,7 @@
 };
 
 #define NB_OF(x) (sizeof (x) / sizeof (x[0]))
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
 
 #endif
 
@@ -100,11 +101,10 @@
 		set_module_owner(mymtd);
 
 #ifdef CONFIG_MTD_PARTITIONS
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-		mtd_parts_nb = parse_cmdline_partitions(mymtd, &mtd_parts, MTDID);
+		mtd_parts_nb = parse_mtd_partitions(mymtd, probes, &mtd_parts, MTDID);
 		if (mtd_parts_nb > 0)
-		  part_type = "command line";
-#endif
+		  part_type = "detected";
+
 		if (mtd_parts_nb == 0)
 		{
 			mtd_parts = static_partitions;

Index: epxa10db-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/epxa10db-flash.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- epxa10db-flash.c	14 May 2003 22:26:29 -0000	1.7
+++ epxa10db-flash.c	16 May 2003 17:07:15 -0000	1.8
@@ -53,6 +53,7 @@
 	.phys =		FLASH_START,
 };
 
+static const char *probes[] = { "RedBoot", "afs", NULL };
 
 static int __init epxa_mtd_init(void)
 {
@@ -85,23 +86,14 @@
 		}
 	}
 
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-	nr_parts = parse_redboot_partitions(mymtd, &parts, (void *)0);
+#ifdef CONFIG_MTD_PARTITIONS
+	nr_parts = parse_mtd_partitions(mymtd, probes, &parts, 0);
 
 	if (nr_parts > 0) {
 		add_mtd_partitions(mymtd, parts, nr_parts);
 		return 0;
 	}
 #endif
-#ifdef CONFIG_MTD_AFS_PARTS
-	nr_parts = parse_afs_partitions(mymtd, &parts, (void *)0);
-
-	if (nr_parts > 0) {
-		add_mtd_partitions(mymtd, parts, nr_parts);
-		return 0;
-	}
-#endif
-
 	/* No recognised partitioning schemes found - use defaults */
 	nr_parts = epxa_default_partitions(mymtd, &parts);
 	if (nr_parts > 0) {

Index: h720x-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/h720x-flash.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- h720x-flash.c	14 May 2003 22:26:30 -0000	1.3
+++ h720x-flash.c	16 May 2003 17:07:16 -0000	1.4
@@ -59,6 +59,7 @@
 
 static int                   nr_mtd_parts;
 static struct mtd_partition *mtd_parts;
+static const char *probes[] = { "cmdlinepart", NULL };
 
 /*
  * Initialize FLASH support
@@ -90,8 +91,8 @@
 	if (mymtd) {
 		set_module_owner(mymtd);
 
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-		nr_mtd_parts = parse_cmdline_partitions(mymtd, &mtd_parts, h720x_map.name);
+#ifdef CONFIG_MTD_PARTITIONS
+		nr_mtd_parts = parse_mtd_partitions(mymtd, probes, &mtd_parts, 0);
 		if (nr_mtd_parts > 0)
 			part_type = "command line";
 #endif

Index: impa7.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/impa7.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- impa7.c	14 May 2003 22:26:30 -0000	1.5
+++ impa7.c	16 May 2003 17:07:16 -0000	1.6
@@ -71,6 +71,7 @@
 
 static int                   mtd_parts_nb = 0;
 static struct mtd_partition *mtd_parts    = 0;
+static const char *probes[] = { "cmdlinepart", NULL };
 
 int __init init_impa7(void)
 {
@@ -111,11 +112,10 @@
 			add_mtd_device(impa7_mtd[i]);
 			devicesfound++;
 #ifdef CONFIG_MTD_PARTITIONS
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-			sprintf(mtdid, MTDID, i);
-			mtd_parts_nb = parse_cmdline_partitions(impa7_mtd[i], 
-								&mtd_parts, 
-								mtdid);
+			mtd_parts_nb = parse_mtd_partitions(impa7_mtd[i], 
+							    probes,
+							    &mtd_parts, 
+							    0);
 			if (mtd_parts_nb > 0)
 			  part_type = "command line";
 #endif

Index: integrator-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/integrator-flash.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- integrator-flash.c	14 May 2003 22:26:30 -0000	1.10
+++ integrator-flash.c	16 May 2003 17:07:16 -0000	1.11
@@ -161,6 +161,7 @@
 
 static struct mtd_info *mtd;
 static struct mtd_partition *parts;
+static const char *probes[] = { "RedBoot", "afs", NULL };
 
 static int __init armflash_cfi_init(void *base, u_int size)
 {
@@ -189,7 +190,7 @@
 
 	set_module_owner(mtd);
 
-	ret = parse_afs_partitions(mtd, &parts, (void *)0);
+	ret = parse_mtd_partitions(mtd, probes, &parts, (void *)0);
 	if (ret > 0) {
 		ret = add_mtd_partitions(mtd, parts, ret);
 		if (ret)

Index: iq80310.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/iq80310.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- iq80310.c	14 May 2003 22:26:30 -0000	1.12
+++ iq80310.c	16 May 2003 17:07:16 -0000	1.13
@@ -59,13 +59,14 @@
 
 static struct mtd_info *mymtd;
 static struct mtd_partition *parsed_parts;
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
 
 static int __init init_iq80310(void)
 {
 	struct mtd_partition *parts;
 	int nb_parts = 0;
 	int parsed_nr_parts = 0;
-	char *part_type = "static";
+	int ret;
 
 	iq80310_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
 	if (!iq80310_map.virt) {
@@ -81,16 +82,10 @@
 	}
 	set_module_owner(mymtd);
 
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-	if (parsed_nr_parts == 0) {
-		int ret = parse_redboot_partitions(mymtd, &parsed_parts, (void *)0);
-
-		if (ret > 0) {
-			part_type = "RedBoot";
-			parsed_nr_parts = ret;
-		}
-	}
-#endif
+	ret = parse_mtd_partitions(mymtd, probes, &parsed_parts, 0);
+
+	if (ret > 0)
+		parsed_nr_parts = ret;
 
 	if (parsed_nr_parts > 0) {
 		parts = parsed_parts;
@@ -99,7 +94,6 @@
 		parts = iq80310_partitions;
 		nb_parts = NB_OF(iq80310_partitions);
 	}
-	printk(KERN_NOTICE "Using %s partition definition\n", part_type);
 	add_mtd_partitions(mymtd, parts, nb_parts);
 	return 0;
 }

Index: ocelot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ocelot.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ocelot.c	14 May 2003 22:26:30 -0000	1.9
+++ ocelot.c	16 May 2003 17:07:16 -0000	1.10
@@ -59,6 +59,8 @@
 	.phys = NVRAM_WINDOW_ADDR,
 };
 
+static const char *probes[] = { "RedBoot", NULL };
+
 static int __init init_ocelot_maps(void)
 {
 	void *pld;
@@ -127,9 +129,9 @@
 	add_mtd_device(nvram_mtd);
 
 	set_module_owner(flash_mtd);
-	nr_parts = parse_redboot_partitions(flash_mtd, &parsed_parts, (void *)0);
+	nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0);
 
-	if (nr_parts)
+	if (nr_parts > 0)
 		add_mtd_partitions(flash_mtd, parsed_parts, nr_parts);
 	else
 		add_mtd_device(flash_mtd);

Index: physmap.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/physmap.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- physmap.c	14 May 2003 22:26:31 -0000	1.24
+++ physmap.c	16 May 2003 17:07:16 -0000	1.25
@@ -11,10 +11,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/config.h>
-
-#ifdef CONFIG_MTD_PARTITIONS
 #include <linux/mtd/partitions.h>
-#endif
 
 #define WINDOW_ADDR CONFIG_MTD_PHYSMAP_START
 #define WINDOW_SIZE CONFIG_MTD_PHYSMAP_LEN
@@ -31,40 +28,38 @@
 };
 
 #ifdef CONFIG_MTD_PARTITIONS
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-static struct mtd_partition *mtd_parts = 0;
-static int                   mtd_parts_nb = 0;
-#else
+static struct mtd_partition *mtd_parts;
+static int                   mtd_parts_nb;
+
 static struct mtd_partition physmap_partitions[] = {
-/* Put your own partition definitions here */
 #if 0
+/* Put your own partition definitions here */
 	{
 		.name =		"bootROM",
 		.size =		0x80000,
-		.offset =		0,
+		.offset =	0,
 		.mask_flags =	MTD_WRITEABLE,  /* force read-only */
 	}, {
 		.name =		"zImage",
 		.size =		0x100000,
-		.offset =		MTDPART_OFS_APPEND,
+		.offset =	MTDPART_OFS_APPEND,
 		.mask_flags =	MTD_WRITEABLE,  /* force read-only */
 	}, {
 		.name =		"ramdisk.gz",
 		.size =		0x300000,
-		.offset =		MTDPART_OFS_APPEND,
+		.offset =	MTDPART_OFS_APPEND,
 		.mask_flags =	MTD_WRITEABLE,  /* force read-only */
 	}, {
 		.name =		"User FS",
 		.size =		MTDPART_SIZ_FULL,
-		.offset =		MTDPART_OFS_APPEND,
+		.offset =	MTDPART_OFS_APPEND,
 	}
 #endif
 };
 
 #define NUM_PARTITIONS	(sizeof(physmap_partitions)/sizeof(struct mtd_partition))
 
-#endif
-#endif
+#endif /* CONFIG_MTD_PARTITIONS */
 
 int __init init_physmap(void)
 {
@@ -89,27 +84,27 @@
 	if (mymtd) {
 		set_module_owner(mymtd);
 
-		add_mtd_device(mymtd);
 #ifdef CONFIG_MTD_PARTITIONS
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-		mtd_parts_nb = parse_cmdline_partitions(mymtd, &mtd_parts, 
-							"phys");
+		mtd_parts_nb = parse_mtd_partitions(mymtd, probes, 
+						    &mtd_parts, 0);
+
 		if (mtd_parts_nb > 0)
 		{
-			printk(KERN_NOTICE 
-			       "Using command line partition definition\n");
 			add_mtd_partitions (mymtd, mtd_parts, mtd_parts_nb);
+			return 0;
 		}
-#else
+
 		if (NUM_PARTITIONS != 0) 
 		{
 			printk(KERN_NOTICE 
 			       "Using physmap partition definition\n");
 			add_mtd_partitions (mymtd, physmap_partitions, NUM_PARTITIONS);
+			return 0;
 		}
 
 #endif
-#endif
+		add_mtd_device(mymtd);
+
 		return 0;
 	}
 
@@ -119,14 +114,22 @@
 
 static void __exit cleanup_physmap(void)
 {
-	if (mymtd) {
+#ifdef CONFIG_MTD_PARTITIONS
+	if (mtd_parts_nb) {
+		del_mtd_partitions(mymtd);
+		kfree(mtd_parts);
+	} else if (NUM_PARTITIONS) {
+		del_mtd_partions(mymtd);
+	} else {
 		del_mtd_device(mymtd);
-		map_destroy(mymtd);
-	}
-	if (physmap_map.virt) {
-		iounmap((void *)physmap_map.virt);
-		physmap_map.virt = 0;
 	}
+#else
+	del_mtd_device(mymtd);
+#endif
+	map_destroy(mymtd);
+
+	iounmap((void *)physmap_map.virt);
+	physmap_map.virt = 0;
 }
 
 module_init(init_physmap);

Index: sa1100-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sa1100-flash.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- sa1100-flash.c	14 May 2003 22:26:31 -0000	1.32
+++ sa1100-flash.c	16 May 2003 17:07:16 -0000	1.33
@@ -717,17 +717,15 @@
 };
 #endif
 
-extern int parse_bootldr_partitions(struct mtd_info *master, struct mtd_partition **pparts);
-
 static struct mtd_partition *parsed_parts;
 static struct mtd_info *mymtd;
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
 
 int __init sa1100_mtd_init(void)
 {
 	struct mtd_partition *parts;
 	int nb_parts = 0, ret;
 	int parsed_nr_parts = 0;
-	const char *part_type;
 	unsigned long base = -1UL;
 
 	/* Default flash buswidth */
@@ -736,7 +734,6 @@
 	/*
 	 * Static partition definition selection
 	 */
-	part_type = "static";
 
 #ifdef CONFIG_SA1100_ADSBITSY
 	if (machine_is_adsbitsy()) {
@@ -918,25 +915,10 @@
 	/*
 	 * Dynamic partition selection stuff (might override the static ones)
 	 */
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-	if (parsed_nr_parts == 0) {
-		int ret = parse_redboot_partitions(mymtd, &parsed_parts, (void *)0);
-
-		if (ret > 0) {
-			part_type = "RedBoot";
-			parsed_nr_parts = ret;
-		}
-	}
-#endif
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-	if (parsed_nr_parts == 0) {
-		int ret = parse_cmdline_partitions(mymtd, &parsed_parts, "sa1100");
-		if (ret > 0) {
-			part_type = "Command Line";
-			parsed_nr_parts = ret;
-		}
-	}
-#endif
+	int ret = parse_mtd_partitions(mymtd, probes, &parsed_parts, 0);
+
+	if (ret > 0)
+		parsed_nr_parts = ret;
 
 	if (parsed_nr_parts > 0) {
 		parts = parsed_parts;
@@ -947,7 +929,6 @@
 		printk(KERN_NOTICE "SA1100 flash: no partition info available, registering whole flash at once\n");
 		add_mtd_device(mymtd);
 	} else {
-		printk(KERN_NOTICE "Using %s partition definition\n", part_type);
 		add_mtd_partitions(mymtd, parts, nb_parts);
 	}
 	return 0;

Index: solutionengine.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/solutionengine.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- solutionengine.c	14 May 2003 22:26:31 -0000	1.7
+++ solutionengine.c	16 May 2003 17:07:16 -0000	1.8
@@ -35,6 +35,8 @@
 	.buswidth = 4,
 };
 
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+
 #ifdef CONFIG_MTD_SUPERH_RESERVE
 static struct mtd_partition superh_se_partitions[] = {
 	/* Reserved for boot code, read-only */
@@ -92,15 +94,10 @@
 		add_mtd_device(eprom_mtd);
 	}
 
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-	nr_parts = parse_redboot_partitions(flash_mtd, &parsed_parts, (void *)0);
-	if (nr_parts > 0)
-		printk(KERN_NOTICE "Found RedBoot partition table.\n");
-	else if (nr_parts < 0)
-		printk(KERN_NOTICE "Error looking for RedBoot partitions.\n");
-#endif /* CONFIG_MTD_REDBOOT_PARTS */
+	nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0);
+
 #if CONFIG_MTD_SUPERH_RESERVE
-	if (nr_parts == 0) {
+	if (nr_parts <= 0) {
 		printk(KERN_NOTICE "Using configured partition at 0x%08x.\n",
 		       CONFIG_MTD_SUPERH_RESERVE);
 		parsed_parts = superh_se_partitions;




More information about the linux-mtd-cvs mailing list