aboutsummaryrefslogtreecommitdiff
path: root/common/cmd_flash.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-12-06 23:55:10 +0000
committerwdenk <wdenk>2003-12-06 23:55:10 +0000
commit5779d8d985d95104ad74332f5fa3cb6c67645509 (patch)
treefe9c2bacd2e097b24c4968ae8e929bd28d74c167 /common/cmd_flash.c
parent8bf3b005ddee3eee179ec961e1c2bd0693e3b79d (diff)
* Patch by Nicolas Lacressonnière, 12 Nov 2003:
update for for Atmel AT91RM9200DK development kit: - support for environment variables in DataFlash - Atmel DataFlash AT45DB1282 support * Patch by Jeff Carr, 11 Nov 2003: add support for new version of 8270 processors * Patches by George G. Davis, 05 Nov 2003: - only pass the ARM linux initrd tag to the kernel when an initrd is actually present - update omap1510inn configuration file
Diffstat (limited to 'common/cmd_flash.c')
-rw-r--r--common/cmd_flash.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/common/cmd_flash.c b/common/cmd_flash.c
index 430a33e22..a51b5e998 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];