diff options
Diffstat (limited to 'common/cmd_flash.c')
-rw-r--r-- | common/cmd_flash.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/common/cmd_flash.c b/common/cmd_flash.c index 430a33e..a51b5e9 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -307,7 +307,9 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) ulong bank, addr_first, addr_last; int i, p, n, sect_first, sect_last; int rcode = 0; - +#ifdef CONFIG_HAS_DATAFLASH + int status; +#endif if (argc < 3) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; @@ -322,6 +324,24 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } +#ifdef CONFIG_HAS_DATAFLASH + if ((strcmp(argv[2], "all") != 0) && (strcmp(argv[2], "bank") != 0)) { + addr_first = simple_strtoul(argv[2], NULL, 16); + addr_last = simple_strtoul(argv[3], NULL, 16); + + if (addr_dataflash(addr_first) && addr_dataflash(addr_last)) { + status = dataflash_real_protect(p,addr_first,addr_last); + if (status < 0){ + printf("Bad DataFlash sector specification\n"); + return 1; + } + printf("%sProtect %d DataFlash Sectors\n", + p ? "" : "Un-", status); + return 0; + } + } +#endif + if (strcmp(argv[2], "all") == 0) { for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) { info = &flash_info[bank-1]; |