#include <common.h>
#include <div64.h>
+#include <malloc.h>
#include <config.h>
#include "nand.h"
}
}
-extern nand_info_t nand_info[];
-
void cmd_yaffs_tracemask(unsigned set, unsigned mask)
{
if (set)
char *mp = NULL;
struct nand_chip *chip;
+ mtd = get_nand_dev_by_index(flash_dev);
+ if (!mtd) {
+ pr_err("\nno NAND devices available\n");
+ return;
+ }
+
dev = calloc(1, sizeof(*dev));
mp = strdup(_mp);
- mtd = &nand_info[flash_dev];
-
if (!dev || !mp) {
/* Alloc error */
printf("Failed to allocate memory\n");
goto err;
}
- chip = mtd->priv;
+ chip = mtd_to_nand(mtd);
/* Check for any conflicts */
yaffs_dev_rewind();
dev = yaffs_next_dev();
if (!dev)
return;
- flash_dev =
- ((unsigned) dev->driver_context - (unsigned) nand_info)/
- sizeof(nand_info[0]);
+ flash_dev = nand_mtd_to_devnum(dev->driver_context);
printf("%-10s %5d 0x%05x 0x%05x %s",
dev->param.name, flash_dev,
dev->param.start_block, dev->param.end_block,
i++;
if (i > 32) {
printf("\n");
- i = 0;;
+ i = 0;
}
}
printf("\n");