]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
nand: Don't call adjust_size_for_badblocks for erase
authorScott Wood <scottwood@freescale.com>
Thu, 20 Jun 2013 17:45:31 +0000 (12:45 -0500)
committerScott Wood <scottwood@freescale.com>
Fri, 21 Jun 2013 16:47:43 +0000 (11:47 -0500)
adjust_size_for_badblocks reduces the operation size to account
for the block skipping done by the read/write functions when an
interval (partition name or whole chip) is specified rather than a data
amount.

Erase does not do block skipping, except for erase.spread which takes
a data amount rather than an interval (and thus already does not call
adjust_size_for_badblocks).  Calling adjust_size_for_badblocks when
block skipping is not done means that if bad blocks are present,
the "nand erase.part" and "nand erase.chip" commands will fail to erase
blocks at the end of the interval.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Harvey Chapman <hchapman@3gfp.com>
Acked-by: Heiko Schocher <hs@denx.de>
common/cmd_nand.c

index 8b1e01ae8094f9a4236f6d9897a8e341121f987c..886212aa078a25c0da64a93ee8562b1ad3a8b9eb 100644 (file)
@@ -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
 }
 
 /* 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)
 {
  */
 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 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"
                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;
                                spread = 1;
                        } else if (!strcmp(&cmd[5], ".part")) {
                                args = 1;
-                               adjust_size = 1;
                        } else if (!strcmp(&cmd[5], ".chip")) {
                                args = 0;
                        } else if (!strcmp(&cmd[5], ".chip")) {
                                args = 0;
-                               adjust_size = 1;
                        } else {
                                goto usage;
                        }
                        } 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;
 
                                 &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));
                nand = &nand_info[dev];
 
                memset(&opts, 0, sizeof(opts));