]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_nand.c
MIPS: qemu-malta: add reset support
[karo-tx-uboot.git] / common / cmd_nand.c
index f20223cffc4061add0426afa96102535300b7854..886212aa078a25c0da64a93ee8562b1ad3a8b9eb 100644 (file)
@@ -62,8 +62,8 @@ static int nand_dump(nand_info_t *nand, ulong off, int only_oob, int repeat)
        ops.oobbuf = oobbuf;
        ops.len = nand->writesize;
        ops.ooblen = nand->oobsize;
-       ops.mode = MTD_OOB_RAW;
-       i = nand->read_oob(nand, addr, &ops);
+       ops.mode = MTD_OPS_RAW;
+       i = mtd_read_oob(nand, addr, &ops);
        if (i < 0) {
                printf("Error (%d) reading page %08lx\n", i, off);
                free(datbuf);
@@ -404,13 +404,13 @@ static int raw_access(nand_info_t *nand, ulong addr, loff_t off, ulong count,
                        .oobbuf = ((u8 *)addr) + nand->writesize,
                        .len = nand->writesize,
                        .ooblen = nand->oobsize,
-                       .mode = MTD_OOB_RAW
+                       .mode = MTD_OPS_RAW
                };
 
                if (read)
-                       ret = nand->read_oob(nand, off, &ops);
+                       ret = mtd_read_oob(nand, off, &ops);
                else
-                       ret = nand->write_oob(nand, off, &ops);
+                       ret = mtd_write_oob(nand, off, &ops);
 
                if (ret) {
                        printf("%s: error at offset %llx, ret %d\n",
@@ -426,7 +426,7 @@ static int raw_access(nand_info_t *nand, ulong addr, loff_t off, ulong count,
 }
 
 /* Adjust a chip/partition size down for bad blocks so we don't
- * read/write/erase past the end of a chip/partition by accident.
+ * read/write past the end of a chip/partition by accident.
  */
 static void adjust_size_for_badblocks(loff_t *size, loff_t offset, int dev)
 {
@@ -546,7 +546,6 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                int scrub = !strncmp(cmd, "scrub", 5);
                int spread = 0;
                int args = 2;
-               int adjust_size = 0;
                const char *scrub_warn =
                        "Warning: "
                        "scrub option will erase all factory set bad blocks!\n"
@@ -563,10 +562,8 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                spread = 1;
                        } else if (!strcmp(&cmd[5], ".part")) {
                                args = 1;
-                               adjust_size = 1;
                        } else if (!strcmp(&cmd[5], ".chip")) {
                                args = 0;
-                               adjust_size = 1;
                        } else {
                                goto usage;
                        }
@@ -586,10 +583,6 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                 &maxsize) != 0)
                        return 1;
 
-               /* size is unspecified */
-               if (adjust_size && !scrub)
-                       adjust_size_for_badblocks(&size, off, dev);
-
                nand = &nand_info[dev];
 
                memset(&opts, 0, sizeof(opts));
@@ -715,13 +708,13 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        mtd_oob_ops_t ops = {
                                .oobbuf = (u8 *)addr,
                                .ooblen = rwsize,
-                               .mode = MTD_OOB_RAW
+                               .mode = MTD_OPS_RAW
                        };
 
                        if (read)
-                               ret = nand->read_oob(nand, off, &ops);
+                               ret = mtd_read_oob(nand, off, &ops);
                        else
-                               ret = nand->write_oob(nand, off, &ops);
+                               ret = mtd_write_oob(nand, off, &ops);
                } else if (raw) {
                        ret = raw_access(nand, addr, off, pagecount, read);
                } else {
@@ -764,7 +757,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                while (argc > 0) {
                        addr = simple_strtoul(*argv, NULL, 16);
 
-                       if (nand->block_markbad(nand, addr)) {
+                       if (mtd_block_markbad(nand, addr)) {
                                printf("block 0x%08lx NOT marked "
                                        "as bad! ERROR %d\n",
                                        addr, ret);