[PATCH] [MTD] cs553x_nand.c: support partitions; cs553x_cleanup() fix

Indrek Kruusa indrek.kruusa at artecdesign.ee
Tue Jan 2 09:21:44 EST 2007


Hi!

Patch for drivers/mtd/nand/cs553x_nand.c:
- support partitions
- cs553x_cleanup(): try the cleanup for all chip selects

Signed-off-by: Indrek Kruusa <indrek.kruusa at artecdesign.ee>


--- cs553x_nand.c_git	2007-01-02 15:13:06.000000000 +0200
+++ cs553x_nand.c	2007-01-02 15:45:38.000000000 +0200
@@ -273,12 +273,21 @@
 	return 0;
 }
 
+
+#ifdef CONFIG_MTD_PARTITIONS
+const char *part_probes[] = { "cmdlinepart", NULL };
+#endif
+
+
 static int __init cs553x_init(void)
 {
 	int err = -ENXIO;
 	int i;
 	uint64_t val;
 
+	int mtd_parts_nb = 0;
+	struct mtd_partition *mtd_parts = 0;
+
 	/* If the CPU isn't a Geode GX or LX, abort */
 	if (!is_geode())
 		return -ENXIO;
@@ -307,9 +316,20 @@
 	   do mtdconcat etc. if we want to. */
 	for (i = 0; i < NR_CS553X_CONTROLLERS; i++) {
 		if (cs553x_mtd[i]) {
-			add_mtd_device(cs553x_mtd[i]);
 
 			/* If any devices registered, return success. Else the last error. */
+#ifdef CONFIG_MTD_PARTITIONS
+			cs553x_mtd[i]->name = "cs553x_nand";
+			mtd_parts_nb = parse_mtd_partitions(cs553x_mtd[i], part_probes, &mtd_parts, 0);
+			if (mtd_parts_nb > 0) {
+				printk(KERN_NOTICE "Using command line partition definition\n");
+				add_mtd_partitions(cs553x_mtd[i], mtd_parts, mtd_parts_nb);
+			} else {
+				add_mtd_device(cs553x_mtd[i]);
+			}
+#else
+			add_mtd_device(cs553x_mtd[i]);
+#endif
 			err = 0;
 		}
 	}
@@ -329,7 +349,7 @@
 		void __iomem *mmio_base;
 
 		if (!mtd)
-			break;
+			continue;
 
 		this = cs553x_mtd[i]->priv;
 		mmio_base = this->IO_ADDR_R;




More information about the linux-mtd mailing list