diff options
author | Tom Rini <trini@ti.com> | 2012-09-18 07:55:07 -0700 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-09-18 07:55:07 -0700 |
commit | c413a004ea62d0ff150c85615348c59ea456bb34 (patch) | |
tree | 8caa6ccf4f53821b723a75a82436daa9464769b0 /common | |
parent | 037e9d33db9fc86c1e671d64077b2d1a19df7f24 (diff) | |
parent | 9c60e75e05dab5a0197728b6a940aaac02762936 (diff) | |
download | u-boot-imx-c413a004ea62d0ff150c85615348c59ea456bb34.zip u-boot-imx-c413a004ea62d0ff150c85615348c59ea456bb34.tar.gz u-boot-imx-c413a004ea62d0ff150c85615348c59ea456bb34.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-nand-flash
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_nand.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/common/cmd_nand.c b/common/cmd_nand.c index a91ccf4..9c6dabe 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -231,12 +231,18 @@ print: #ifdef CONFIG_CMD_NAND_LOCK_UNLOCK static void print_status(ulong start, ulong end, ulong erasesize, int status) { + /* + * Micron NAND flash (e.g. MT29F4G08ABADAH4) BLOCK LOCK READ STATUS is + * not the same as others. Instead of bit 1 being lock, it is + * #lock_tight. To make the driver support either format, ignore bit 1 + * and use only bit 0 and bit 2. + */ printf("%08lx - %08lx: %08lx blocks %s%s%s\n", start, end - 1, (end - start) / erasesize, ((status & NAND_LOCK_STATUS_TIGHT) ? "TIGHT " : ""), - ((status & NAND_LOCK_STATUS_LOCK) ? "LOCK " : ""), + (!(status & NAND_LOCK_STATUS_UNLOCK) ? "LOCK " : ""), ((status & NAND_LOCK_STATUS_UNLOCK) ? "UNLOCK " : "")); } @@ -749,11 +755,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 +820,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" |