summaryrefslogtreecommitdiff
path: root/common/cmd_nand.c
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-08-22 16:49:42 -0500
committerScott Wood <scottwood@freescale.com>2012-09-17 17:32:10 -0500
commiteee623a5049963d0c085be37128bbd22bee1ba1e (patch)
tree315346f1597dbeebd2a0d071325bac7fea9de16f /common/cmd_nand.c
parentd62e9caaaf7e6f5c7d86c9ea19170bfa5adda8be (diff)
downloadu-boot-imx-eee623a5049963d0c085be37128bbd22bee1ba1e.zip
u-boot-imx-eee623a5049963d0c085be37128bbd22bee1ba1e.tar.gz
u-boot-imx-eee623a5049963d0c085be37128bbd22bee1ba1e.tar.bz2
nand: Add support for unlock.invert
NAND unlock command allows an invert bit to be set to unlock all but the selected page range. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> [scottwood@freescale.com: updated docs and added comment about invert bit] Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'common/cmd_nand.c')
-rw-r--r--common/cmd_nand.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index a91ccf4..f737c06 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -749,11 +749,18 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
return 0;
}
- if (strcmp(cmd, "unlock") == 0) {
+ if (strncmp(cmd, "unlock", 5) == 0) {
+ int allexcept = 0;
+
+ s = strchr(cmd, '.');
+
+ if (s && !strcmp(s, ".allexcept"))
+ allexcept = 1;
+
if (arg_off_size(argc - 2, argv + 2, &dev, &off, &size) < 0)
return 1;
- if (!nand_unlock(&nand_info[dev], off, size)) {
+ if (!nand_unlock(&nand_info[dev], off, size, allexcept)) {
puts("NAND flash successfully unlocked\n");
} else {
puts("Error unlocking NAND flash, "
@@ -807,7 +814,7 @@ U_BOOT_CMD(
"\n"
"nand lock [tight] [status]\n"
" bring nand to lock state or display locked pages\n"
- "nand unlock [offset] [size] - unlock section"
+ "nand unlock[.allexcept] [offset] [size] - unlock section"
#endif
#ifdef CONFIG_ENV_OFFSET_OOB
"\n"