Kconfig: Create a new tools menu
[J-u-boot.git] / fs / yaffs2 / yaffs_uboot_glue.c
index 50000a135b54f229e4aa914939ab6c554bdab0c4..7a15a02974d07c6b2aee58eb767cda7ca5bfd3ef 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <common.h>
 #include <div64.h>
+#include <malloc.h>
 
 #include <config.h>
 #include "nand.h"
@@ -141,8 +142,6 @@ static const char *yaffs_error_str(void)
        }
 }
 
-extern nand_info_t nand_info[];
-
 void cmd_yaffs_tracemask(unsigned set, unsigned mask)
 {
        if (set)
@@ -168,11 +167,15 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,
        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");
@@ -192,7 +195,7 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,
                goto err;
        }
 
-       chip =  mtd->priv;
+       chip =  mtd_to_nand(mtd);
 
        /* Check for any conflicts */
        yaffs_dev_rewind();
@@ -260,9 +263,7 @@ void cmd_yaffs_dev_ls(void)
                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,
@@ -324,7 +325,7 @@ void read_a_file(char *fn)
                i++;
                if (i > 32) {
                        printf("\n");
-                       i = 0;;
+                       i = 0;
                }
        }
        printf("\n");
This page took 0.027823 seconds and 4 git commands to generate.