]> git.sur5r.net Git - u-boot/blobdiff - drivers/mtd/onenand/onenand_uboot.c
mtd: Introduce CONFIG_MTD_DEVICE to select compilation of mtdcore.o
[u-boot] / drivers / mtd / onenand / onenand_uboot.c
index 4541b221772b35d140eae003fd821077b6116807..9823b5b47839e389e54e89bb36219b1b0904c707 100644 (file)
@@ -20,6 +20,7 @@
 
 struct mtd_info onenand_mtd;
 struct onenand_chip onenand_chip;
+static __attribute__((unused)) char dev_name[] = "onenand0";
 
 void onenand_init(void)
 {
@@ -41,4 +42,13 @@ void onenand_init(void)
 
        puts("OneNAND: ");
        print_size(onenand_mtd.size, "\n");
+
+#ifdef CONFIG_MTD_DEVICE
+       /*
+        * Add MTD device so that we can reference it later
+        * via the mtdcore infrastructure (e.g. ubi).
+        */
+       onenand_mtd.name = dev_name;
+       add_mtd_device(&onenand_mtd);
+#endif
 }