* 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
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 @@
 	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 @@
 		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];