static ulong base_address[CONFIG_SYS_MAX_NAND_DEVICE] = CONFIG_SYS_NAND_BASE_LIST;
static const char default_nand_name[] = "nand";
+static __attribute__((unused)) char dev_name[CONFIG_SYS_MAX_NAND_DEVICE][8];
static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand,
ulong base_addr)
{
int maxchips = CONFIG_SYS_NAND_MAX_CHIPS;
+ int __attribute__((unused)) i = 0;
if (maxchips < 1)
maxchips = 1;
mtd->name = (char *)default_nand_name;
else
mtd->name += gd->reloc_off;
+
+#ifdef CONFIG_MTD_PARTITIONS
+ /*
+ * Add MTD device so that we can reference it later
+ * via the mtdcore infrastructure (e.g. ubi).
+ */
+ sprintf(dev_name[i], "nand%d", i);
+ mtd->name = dev_name[i++];
+ add_mtd_device(mtd);
+#endif
} else
mtd->name = NULL;
} else {
struct mtd_info onenand_mtd;
struct onenand_chip onenand_chip;
+static __attribute__((unused)) char dev_name[] = "onenand0";
void onenand_init(void)
{
puts("OneNAND: ");
print_size(onenand_mtd.size, "\n");
+
+#ifdef CONFIG_MTD_PARTITIONS
+ /*
+ * 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
}