[PATCH 6/6] of: partitions: create bb device for nand flashes

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 22 03:27:23 EDT 2013


For nand flashes automatically create a bb device for each partion.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/of/partition.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index a78466b..2d70cf5 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -21,6 +21,7 @@
 #include <of.h>
 #include <malloc.h>
 #include <linux/mtd/mtd.h>
+#include <nand.h>
 
 int of_parse_partitions(struct cdev *cdev, struct device_node *node)
 {
@@ -56,6 +57,9 @@ int of_parse_partitions(struct cdev *cdev, struct device_node *node)
 
 		devfs_add_partition(cdev->name, offset, size, flags, filename);
 
+		if (cdev->mtd && cdev->mtd->type == MTD_NANDFLASH)
+			dev_add_bb_dev(filename, NULL);
+
 		free(filename);
 	}
 
-- 
1.8.2.rc2




More information about the barebox mailing list