3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
11 * Copied from FADS ROM, Dan Malek (dmalek@jlc.net)
16 #ifdef CONFIG_HAS_DATAFLASH
17 #include <dataflash.h>
22 #include <linux/compiler.h>
24 DECLARE_GLOBAL_DATA_PTR;
26 #ifndef CONFIG_SYS_MEMTEST_SCRATCH
27 #define CONFIG_SYS_MEMTEST_SCRATCH 0
30 static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
32 /* Display values from last command.
33 * Memory modify remembered values are different from display memory.
35 static uint dp_last_addr, dp_last_size;
36 static uint dp_last_length = 0x40;
37 static uint mm_last_addr, mm_last_size;
39 static ulong base_address = 0;
44 * md{.b, .w, .l, .q} {addr} {len}
46 #define DISP_LINE_LEN 16
47 static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
50 #if defined(CONFIG_HAS_DATAFLASH)
51 ulong nbytes, linebytes;
56 /* We use the last specified parameters, unless new ones are
61 length = dp_last_length;
66 if ((flag & CMD_FLAG_REPEAT) == 0) {
67 /* New command specified. Check for a size specification.
68 * Defaults to long if no or incorrect specification.
70 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
73 /* Address is specified since argc > 1
75 addr = simple_strtoul(argv[1], NULL, 16);
78 /* If another parameter, it is the length to display.
79 * Length is the number of objects, not number of bytes.
82 length = simple_strtoul(argv[2], NULL, 16);
85 #if defined(CONFIG_HAS_DATAFLASH)
88 * We buffer all read data, so we can make sure data is read only
89 * once, and all accesses are with the specified bus width.
91 nbytes = length * size;
93 char linebuf[DISP_LINE_LEN];
95 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
97 rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
98 p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
99 print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
107 } while (nbytes > 0);
110 # if defined(CONFIG_BLACKFIN)
111 /* See if we're trying to display L1 inst */
112 if (addr_bfin_on_chip_mem(addr)) {
113 char linebuf[DISP_LINE_LEN];
114 ulong linebytes, nbytes = length * size;
116 linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
117 memcpy(linebuf, (void *)addr, linebytes);
118 print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size);
126 } while (nbytes > 0);
131 ulong bytes = size * length;
132 const void *buf = map_sysmem(addr, bytes);
134 /* Print the lines. */
135 print_buffer(addr, buf, size, length, DISP_LINE_LEN / size);
142 dp_last_length = length;
147 static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
149 return mod_mem (cmdtp, 1, flag, argc, argv);
151 static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
153 return mod_mem (cmdtp, 0, flag, argc, argv);
156 static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
158 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
168 if ((argc < 3) || (argc > 4))
169 return CMD_RET_USAGE;
171 /* Check for size specification.
173 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
176 /* Address is specified since argc > 1
178 addr = simple_strtoul(argv[1], NULL, 16);
179 addr += base_address;
181 /* Get the value to write.
183 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
184 writeval = simple_strtoull(argv[2], NULL, 16);
186 writeval = simple_strtoul(argv[2], NULL, 16);
191 count = simple_strtoul(argv[3], NULL, 16);
196 bytes = size * count;
197 buf = map_sysmem(addr, bytes);
198 while (count-- > 0) {
200 *((u32 *)buf) = (u32)writeval;
201 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
203 *((u64 *)buf) = (u64)writeval;
206 *((u16 *)buf) = (u16)writeval;
208 *((u8 *)buf) = (u8)writeval;
215 #ifdef CONFIG_MX_CYCLIC
216 int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
222 return CMD_RET_USAGE;
224 count = simple_strtoul(argv[3], NULL, 10);
227 do_mem_md (NULL, 0, 3, argv);
229 /* delay for <count> ms... */
230 for (i=0; i<count; i++)
233 /* check for ctrl-c to abort... */
243 int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
249 return CMD_RET_USAGE;
251 count = simple_strtoul(argv[3], NULL, 10);
254 do_mem_mw (NULL, 0, 3, argv);
256 /* delay for <count> ms... */
257 for (i=0; i<count; i++)
260 /* check for ctrl-c to abort... */
269 #endif /* CONFIG_MX_CYCLIC */
271 static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
273 ulong addr1, addr2, count, ngood, bytes;
277 const void *buf1, *buf2, *base;
278 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
285 return CMD_RET_USAGE;
287 /* Check for size specification.
289 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
291 type = size == 8 ? "double word" :
293 size == 2 ? "halfword" : "byte";
295 addr1 = simple_strtoul(argv[1], NULL, 16);
296 addr1 += base_address;
298 addr2 = simple_strtoul(argv[2], NULL, 16);
299 addr2 += base_address;
301 count = simple_strtoul(argv[3], NULL, 16);
303 #ifdef CONFIG_HAS_DATAFLASH
304 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
305 puts ("Comparison with DataFlash space not supported.\n\r");
310 #ifdef CONFIG_BLACKFIN
311 if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) {
312 puts ("Comparison with L1 instruction memory not supported.\n\r");
317 bytes = size * count;
318 base = buf1 = map_sysmem(addr1, bytes);
319 buf2 = map_sysmem(addr2, bytes);
320 for (ngood = 0; ngood < count; ++ngood) {
322 word1 = *(u32 *)buf1;
323 word2 = *(u32 *)buf2;
324 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
325 } else if (size == 8) {
326 word1 = *(u64 *)buf1;
327 word2 = *(u64 *)buf2;
329 } else if (size == 2) {
330 word1 = *(u16 *)buf1;
331 word2 = *(u16 *)buf2;
336 if (word1 != word2) {
337 ulong offset = buf1 - base;
338 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
339 printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
340 type, (void *)(addr1 + offset), size, word1,
341 type, (void *)(addr2 + offset), size, word2);
343 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
344 type, (ulong)(addr1 + offset), size, word1,
345 type, (ulong)(addr2 + offset), size, word2);
354 /* reset watchdog from time to time */
355 if ((ngood % (64 << 10)) == 0)
361 printf("Total of %ld %s(s) were the same\n", ngood, type);
365 static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
367 ulong addr, dest, count, bytes;
373 return CMD_RET_USAGE;
375 /* Check for size specification.
377 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
380 addr = simple_strtoul(argv[1], NULL, 16);
381 addr += base_address;
383 dest = simple_strtoul(argv[2], NULL, 16);
384 dest += base_address;
386 count = simple_strtoul(argv[3], NULL, 16);
389 puts ("Zero length ???\n");
393 #ifndef CONFIG_SYS_NO_FLASH
394 /* check if we are copying to Flash */
395 if ( (addr2info(dest) != NULL)
396 #ifdef CONFIG_HAS_DATAFLASH
397 && (!addr_dataflash(dest))
402 puts ("Copy to Flash... ");
404 rc = flash_write ((char *)addr, dest, count*size);
414 #ifdef CONFIG_HAS_DATAFLASH
415 /* Check if we are copying from RAM or Flash to DataFlash */
416 if (addr_dataflash(dest) && !addr_dataflash(addr)){
419 puts ("Copy to DataFlash... ");
421 rc = write_dataflash (dest, addr, count*size);
424 dataflash_perror (rc);
431 /* Check if we are copying from DataFlash to RAM */
432 if (addr_dataflash(addr) && !addr_dataflash(dest)
433 #ifndef CONFIG_SYS_NO_FLASH
434 && (addr2info(dest) == NULL)
438 rc = read_dataflash(addr, count * size, (char *) dest);
440 dataflash_perror (rc);
446 if (addr_dataflash(addr) && addr_dataflash(dest)){
447 puts ("Unsupported combination of source/destination.\n\r");
452 #ifdef CONFIG_BLACKFIN
453 /* See if we're copying to/from L1 inst */
454 if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) {
455 memcpy((void *)dest, (void *)addr, count * size);
460 bytes = size * count;
461 buf = map_sysmem(dest, bytes);
462 src = map_sysmem(addr, bytes);
463 while (count-- > 0) {
465 *((u32 *)buf) = *((u32 *)src);
466 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
468 *((u64 *)buf) = *((u64 *)src);
471 *((u16 *)buf) = *((u16 *)src);
473 *((u8 *)buf) = *((u8 *)src);
477 /* reset watchdog from time to time */
478 if ((count % (64 << 10)) == 0)
484 static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
488 /* Set new base address.
490 base_address = simple_strtoul(argv[1], NULL, 16);
492 /* Print the current base address.
494 printf("Base Address: 0x%08lx\n", base_address);
498 static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
501 ulong addr, length, i, bytes;
503 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
507 volatile u16 *shortp;
512 return CMD_RET_USAGE;
515 * Check for a size specification.
516 * Defaults to long if no or incorrect specification.
518 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
521 /* Address is always specified.
523 addr = simple_strtoul(argv[1], NULL, 16);
525 /* Length is the number of objects, not number of bytes.
527 length = simple_strtoul(argv[2], NULL, 16);
529 bytes = size * length;
530 buf = map_sysmem(addr, bytes);
532 /* We want to optimize the loops to run as fast as possible.
533 * If we have only one object, just run infinite loops.
536 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
558 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
596 int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
598 ulong addr, length, i, bytes;
600 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
607 volatile u16 *shortp;
612 return CMD_RET_USAGE;
615 * Check for a size specification.
616 * Defaults to long if no or incorrect specification.
618 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
621 /* Address is always specified.
623 addr = simple_strtoul(argv[1], NULL, 16);
625 /* Length is the number of objects, not number of bytes.
627 length = simple_strtoul(argv[2], NULL, 16);
630 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
631 data = simple_strtoull(argv[3], NULL, 16);
633 data = simple_strtoul(argv[3], NULL, 16);
636 bytes = size * length;
637 buf = map_sysmem(addr, bytes);
639 /* We want to optimize the loops to run as fast as possible.
640 * If we have only one object, just run infinite loops.
643 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
665 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
698 #endif /* CONFIG_LOOPW */
700 #ifdef CONFIG_CMD_MEMTEST
701 static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
712 vu_long anti_pattern;
714 static const ulong bitpattern[] = {
715 0x00000001, /* single bit */
716 0x00000003, /* two adjacent bits */
717 0x00000007, /* three adjacent bits */
718 0x0000000F, /* four adjacent bits */
719 0x00000005, /* two non-adjacent bits */
720 0x00000015, /* three non-adjacent bits */
721 0x00000055, /* four non-adjacent bits */
722 0xaaaaaaaa, /* alternating 1/0 */
725 num_words = (end_addr - start_addr) / sizeof(vu_long);
728 * Data line test: write a pattern to the first
729 * location, write the 1's complement to a 'parking'
730 * address (changes the state of the data bus so a
731 * floating bus doesn't give a false OK), and then
732 * read the value back. Note that we read it back
733 * into a variable because the next time we read it,
734 * it might be right (been there, tough to explain to
735 * the quality guys why it prints a failure when the
736 * "is" and "should be" are obviously the same in the
739 * Rather than exhaustively testing, we test some
740 * patterns by shifting '1' bits through a field of
741 * '0's and '0' bits through a field of '1's (i.e.
742 * pattern and ~pattern).
745 for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) {
747 for (; val != 0; val <<= 1) {
749 *dummy = ~val; /* clear the test data off the bus */
751 if (readback != val) {
752 printf("FAILURE (data line): "
753 "expected %08lx, actual %08lx\n",
762 if (readback != ~val) {
763 printf("FAILURE (data line): "
764 "Is %08lx, should be %08lx\n",
774 * Based on code whose Original Author and Copyright
775 * information follows: Copyright (c) 1998 by Michael
776 * Barr. This software is placed into the public
777 * domain and may be used for any purpose. However,
778 * this notice must not be changed or removed and no
779 * warranty is either expressed or implied by its
780 * publication or distribution.
786 * Description: Test the address bus wiring in a
787 * memory region by performing a walking
788 * 1's test on the relevant bits of the
789 * address and checking for aliasing.
790 * This test will find single-bit
791 * address failures such as stuck-high,
792 * stuck-low, and shorted pins. The base
793 * address and size of the region are
794 * selected by the caller.
796 * Notes: For best results, the selected base
797 * address should have enough LSB 0's to
798 * guarantee single address bit changes.
799 * For example, to test a 64-Kbyte
800 * region, select a base address on a
801 * 64-Kbyte boundary. Also, select the
802 * region size as a power-of-two if at
805 * Returns: 0 if the test succeeds, 1 if the test fails.
807 pattern = (vu_long) 0xaaaaaaaa;
808 anti_pattern = (vu_long) 0x55555555;
810 debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words);
812 * Write the default pattern at each of the
813 * power-of-two offsets.
815 for (offset = 1; offset < num_words; offset <<= 1)
816 addr[offset] = pattern;
819 * Check for address bits stuck high.
822 addr[test_offset] = anti_pattern;
824 for (offset = 1; offset < num_words; offset <<= 1) {
826 if (temp != pattern) {
827 printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
828 " expected 0x%.8lx, actual 0x%.8lx\n",
829 start_addr + offset*sizeof(vu_long),
836 addr[test_offset] = pattern;
840 * Check for addr bits stuck low or shorted.
842 for (test_offset = 1; test_offset < num_words; test_offset <<= 1) {
843 addr[test_offset] = anti_pattern;
845 for (offset = 1; offset < num_words; offset <<= 1) {
847 if ((temp != pattern) && (offset != test_offset)) {
848 printf("\nFAILURE: Address bit stuck low or"
849 " shorted @ 0x%.8lx: expected 0x%.8lx,"
851 start_addr + offset*sizeof(vu_long),
858 addr[test_offset] = pattern;
862 * Description: Test the integrity of a physical
863 * memory device by performing an
864 * increment/decrement test over the
865 * entire region. In the process every
866 * storage bit in the device is tested
867 * as a zero and a one. The base address
868 * and the size of the region are
869 * selected by the caller.
871 * Returns: 0 if the test succeeds, 1 if the test fails.
876 * Fill memory with a known pattern.
878 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
880 addr[offset] = pattern;
884 * Check each location and invert it for the second pass.
886 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
889 if (temp != pattern) {
890 printf("\nFAILURE (read/write) @ 0x%.8lx:"
891 " expected 0x%.8lx, actual 0x%.8lx)\n",
892 start_addr + offset*sizeof(vu_long),
899 anti_pattern = ~pattern;
900 addr[offset] = anti_pattern;
904 * Check each location for the inverted pattern and zero it.
906 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
908 anti_pattern = ~pattern;
910 if (temp != anti_pattern) {
911 printf("\nFAILURE (read/write): @ 0x%.8lx:"
912 " expected 0x%.8lx, actual 0x%.8lx)\n",
913 start_addr + offset*sizeof(vu_long),
925 static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
926 vu_long pattern, int iteration)
934 /* Alternate the pattern */
939 * Flip the pattern each time to make lots of zeros and
940 * then, the next time, lots of ones. We decrement
941 * the "negative" patterns and increment the "positive"
942 * patterns to preserve this feature.
944 if (pattern & 0x80000000)
945 pattern = -pattern; /* complement & increment */
949 length = (end_addr - start_addr) / sizeof(ulong);
951 printf("\rPattern %08lX Writing..."
953 "\b\b\b\b\b\b\b\b\b\b",
956 for (addr = buf, val = pattern; addr < end; addr++) {
964 for (addr = buf, val = pattern; addr < end; addr++) {
967 if (readback != val) {
968 ulong offset = addr - buf;
970 printf("\nMem error @ 0x%08X: "
971 "found %08lX, expected %08lX\n",
972 (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
985 * Perform a memory test. A more complete alternative test can be
986 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
987 * interrupted by ctrl-c or by a failure of one of the sub-tests.
989 static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
993 vu_long *buf, *dummy;
996 ulong errs = 0; /* number of errors, or -1 if interrupted */
999 #if defined(CONFIG_SYS_ALT_MEMTEST)
1000 const int alt_test = 1;
1002 const int alt_test = 0;
1006 start = simple_strtoul(argv[1], NULL, 16);
1008 start = CONFIG_SYS_MEMTEST_START;
1011 end = simple_strtoul(argv[2], NULL, 16);
1013 end = CONFIG_SYS_MEMTEST_END;
1016 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
1021 iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16);
1023 iteration_limit = 0;
1025 printf("Testing %08x ... %08x:\n", (uint)start, (uint)end);
1026 debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__,
1029 buf = map_sysmem(start, end - start);
1030 dummy = map_sysmem(CONFIG_SYS_MEMTEST_SCRATCH, sizeof(vu_long));
1032 !iteration_limit || iteration < iteration_limit;
1039 printf("Iteration: %6d\r", iteration + 1);
1042 errs = mem_test_alt(buf, start, end, dummy);
1044 errs = mem_test_quick(buf, start, end, pattern,
1052 * Work-around for eldk-4.2 which gives this warning if we try to
1053 * case in the unmap_sysmem() call:
1054 * warning: initialization discards qualifiers from pointer target type
1057 void *vbuf = (void *)buf;
1058 void *vdummy = (void *)dummy;
1061 unmap_sysmem(vdummy);
1065 /* Memory test was aborted - write a newline to finish off */
1069 printf("Tested %d iteration(s) with %lu errors.\n",
1074 return ret; /* not reached */
1076 #endif /* CONFIG_CMD_MEMTEST */
1081 * mm{.b, .w, .l, .q} {addr}
1082 * nm{.b, .w, .l, .q} {addr}
1085 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
1088 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1097 return CMD_RET_USAGE;
1099 #ifdef CONFIG_BOOT_RETRY_TIME
1100 reset_cmd_timeout(); /* got a good command to get here */
1102 /* We use the last specified parameters, unless new ones are
1105 addr = mm_last_addr;
1106 size = mm_last_size;
1108 if ((flag & CMD_FLAG_REPEAT) == 0) {
1109 /* New command specified. Check for a size specification.
1110 * Defaults to long if no or incorrect specification.
1112 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1115 /* Address is specified since argc > 1
1117 addr = simple_strtoul(argv[1], NULL, 16);
1118 addr += base_address;
1121 #ifdef CONFIG_HAS_DATAFLASH
1122 if (addr_dataflash(addr)){
1123 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
1128 #ifdef CONFIG_BLACKFIN
1129 if (addr_bfin_on_chip_mem(addr)) {
1130 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
1135 /* Print the address, followed by value. Then accept input for
1136 * the next value. A non-converted value exits.
1139 ptr = map_sysmem(addr, size);
1140 printf("%08lx:", addr);
1142 printf(" %08x", *((u32 *)ptr));
1143 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1145 printf(" %016llx", *((u64 *)ptr));
1148 printf(" %04x", *((u16 *)ptr));
1150 printf(" %02x", *((u8 *)ptr));
1152 nbytes = readline (" ? ");
1153 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1154 /* <CR> pressed as only input, don't modify current
1155 * location and move to next. "-" pressed will go back.
1158 addr += nbytes ? -size : size;
1160 #ifdef CONFIG_BOOT_RETRY_TIME
1161 reset_cmd_timeout(); /* good enough to not time out */
1164 #ifdef CONFIG_BOOT_RETRY_TIME
1165 else if (nbytes == -2) {
1166 break; /* timed out, exit the command */
1171 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1172 i = simple_strtoull(console_buffer, &endp, 16);
1174 i = simple_strtoul(console_buffer, &endp, 16);
1176 nbytes = endp - console_buffer;
1178 #ifdef CONFIG_BOOT_RETRY_TIME
1179 /* good enough to not time out
1181 reset_cmd_timeout();
1185 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1201 mm_last_addr = addr;
1202 mm_last_size = size;
1206 #ifdef CONFIG_CMD_CRC32
1208 static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1215 return CMD_RET_USAGE;
1219 #ifdef CONFIG_HASH_VERIFY
1220 if (strcmp(*av, "-v") == 0) {
1221 flags |= HASH_FLAG_VERIFY;
1227 return hash_command("crc32", flags, cmdtp, flag, ac, av);
1232 /**************************************************/
1234 md, 3, 1, do_mem_md,
1236 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1237 "[.b, .w, .l, .q] address [# of objects]"
1239 "[.b, .w, .l] address [# of objects]"
1245 mm, 2, 1, do_mem_mm,
1246 "memory modify (auto-incrementing address)",
1247 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1248 "[.b, .w, .l, .q] address"
1250 "[.b, .w, .l] address"
1256 nm, 2, 1, do_mem_nm,
1257 "memory modify (constant address)",
1258 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1259 "[.b, .w, .l, .q] address"
1261 "[.b, .w, .l] address"
1266 mw, 4, 1, do_mem_mw,
1267 "memory write (fill)",
1268 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1269 "[.b, .w, .l, .q] address value [count]"
1271 "[.b, .w, .l] address value [count]"
1276 cp, 4, 1, do_mem_cp,
1278 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1279 "[.b, .w, .l, .q] source target count"
1281 "[.b, .w, .l] source target count"
1286 cmp, 4, 1, do_mem_cmp,
1288 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1289 "[.b, .w, .l, .q] addr1 addr2 count"
1291 "[.b, .w, .l] addr1 addr2 count"
1295 #ifdef CONFIG_CMD_CRC32
1297 #ifndef CONFIG_CRC32_VERIFY
1300 crc32, 4, 1, do_mem_crc,
1301 "checksum calculation",
1302 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1305 #else /* CONFIG_CRC32_VERIFY */
1308 crc32, 5, 1, do_mem_crc,
1309 "checksum calculation",
1310 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1311 "-v address count crc\n - verify crc of memory area"
1314 #endif /* CONFIG_CRC32_VERIFY */
1318 #ifdef CONFIG_CMD_MEMINFO
1319 __weak void board_show_dram(ulong size)
1322 print_size(size, "\n");
1325 static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
1326 char * const argv[])
1328 board_show_dram(gd->ram_size);
1335 base, 2, 1, do_mem_base,
1336 "print or set address offset",
1337 "\n - print address offset for memory commands\n"
1338 "base off\n - set address offset for memory commands to 'off'"
1342 loop, 3, 1, do_mem_loop,
1343 "infinite loop on address range",
1344 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1345 "[.b, .w, .l, .q] address number_of_objects"
1347 "[.b, .w, .l] address number_of_objects"
1353 loopw, 4, 1, do_mem_loopw,
1354 "infinite write loop on address range",
1355 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1356 "[.b, .w, .l, .q] address number_of_objects data_to_write"
1358 "[.b, .w, .l] address number_of_objects data_to_write"
1361 #endif /* CONFIG_LOOPW */
1363 #ifdef CONFIG_CMD_MEMTEST
1365 mtest, 5, 1, do_mem_mtest,
1366 "simple RAM read/write test",
1367 "[start [end [pattern [iterations]]]]"
1369 #endif /* CONFIG_CMD_MEMTEST */
1371 #ifdef CONFIG_MX_CYCLIC
1373 mdc, 4, 1, do_mem_mdc,
1374 "memory display cyclic",
1375 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1376 "[.b, .w, .l, .q] address count delay(ms)"
1378 "[.b, .w, .l] address count delay(ms)"
1383 mwc, 4, 1, do_mem_mwc,
1384 "memory write cyclic",
1385 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1386 "[.b, .w, .l, .q] address value delay(ms)"
1388 "[.b, .w, .l] address value delay(ms)"
1391 #endif /* CONFIG_MX_CYCLIC */
1393 #ifdef CONFIG_CMD_MEMINFO
1395 meminfo, 3, 1, do_mem_info,
1396 "display memory information",