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)
17 #ifdef CONFIG_HAS_DATAFLASH
18 #include <dataflash.h>
23 #include <linux/compiler.h>
25 DECLARE_GLOBAL_DATA_PTR;
27 #ifndef CONFIG_SYS_MEMTEST_SCRATCH
28 #define CONFIG_SYS_MEMTEST_SCRATCH 0
31 static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
33 /* Display values from last command.
34 * Memory modify remembered values are different from display memory.
36 static uint dp_last_addr, dp_last_size;
37 static uint dp_last_length = 0x40;
38 static uint mm_last_addr, mm_last_size;
40 static ulong base_address = 0;
45 * md{.b, .w, .l, .q} {addr} {len}
47 #define DISP_LINE_LEN 16
48 static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
51 #if defined(CONFIG_HAS_DATAFLASH)
52 ulong nbytes, linebytes;
57 /* We use the last specified parameters, unless new ones are
62 length = dp_last_length;
67 if ((flag & CMD_FLAG_REPEAT) == 0) {
68 /* New command specified. Check for a size specification.
69 * Defaults to long if no or incorrect specification.
71 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
74 /* Address is specified since argc > 1
76 addr = simple_strtoul(argv[1], NULL, 16);
79 /* If another parameter, it is the length to display.
80 * Length is the number of objects, not number of bytes.
83 length = simple_strtoul(argv[2], NULL, 16);
86 #if defined(CONFIG_HAS_DATAFLASH)
89 * We buffer all read data, so we can make sure data is read only
90 * once, and all accesses are with the specified bus width.
92 nbytes = length * size;
94 char linebuf[DISP_LINE_LEN];
96 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
98 rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
99 p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
100 print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
108 } while (nbytes > 0);
111 # if defined(CONFIG_BLACKFIN)
112 /* See if we're trying to display L1 inst */
113 if (addr_bfin_on_chip_mem(addr)) {
114 char linebuf[DISP_LINE_LEN];
115 ulong linebytes, nbytes = length * size;
117 linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
118 memcpy(linebuf, (void *)addr, linebytes);
119 print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size);
127 } while (nbytes > 0);
132 ulong bytes = size * length;
133 const void *buf = map_sysmem(addr, bytes);
135 /* Print the lines. */
136 print_buffer(addr, buf, size, length, DISP_LINE_LEN / size);
143 dp_last_length = length;
148 static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
150 return mod_mem (cmdtp, 1, flag, argc, argv);
152 static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
154 return mod_mem (cmdtp, 0, flag, argc, argv);
157 static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
159 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
169 if ((argc < 3) || (argc > 4))
170 return CMD_RET_USAGE;
172 /* Check for size specification.
174 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
177 /* Address is specified since argc > 1
179 addr = simple_strtoul(argv[1], NULL, 16);
180 addr += base_address;
182 /* Get the value to write.
184 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
185 writeval = simple_strtoull(argv[2], NULL, 16);
187 writeval = simple_strtoul(argv[2], NULL, 16);
192 count = simple_strtoul(argv[3], NULL, 16);
197 bytes = size * count;
198 buf = map_sysmem(addr, bytes);
199 while (count-- > 0) {
201 *((u32 *)buf) = (u32)writeval;
202 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
204 *((u64 *)buf) = (u64)writeval;
207 *((u16 *)buf) = (u16)writeval;
209 *((u8 *)buf) = (u8)writeval;
216 #ifdef CONFIG_MX_CYCLIC
217 int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
223 return CMD_RET_USAGE;
225 count = simple_strtoul(argv[3], NULL, 10);
228 do_mem_md (NULL, 0, 3, argv);
230 /* delay for <count> ms... */
231 for (i=0; i<count; i++)
234 /* check for ctrl-c to abort... */
244 int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
250 return CMD_RET_USAGE;
252 count = simple_strtoul(argv[3], NULL, 10);
255 do_mem_mw (NULL, 0, 3, argv);
257 /* delay for <count> ms... */
258 for (i=0; i<count; i++)
261 /* check for ctrl-c to abort... */
270 #endif /* CONFIG_MX_CYCLIC */
272 static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
274 ulong addr1, addr2, count, ngood, bytes;
278 const void *buf1, *buf2, *base;
279 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
286 return CMD_RET_USAGE;
288 /* Check for size specification.
290 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
292 type = size == 8 ? "double word" :
294 size == 2 ? "halfword" : "byte";
296 addr1 = simple_strtoul(argv[1], NULL, 16);
297 addr1 += base_address;
299 addr2 = simple_strtoul(argv[2], NULL, 16);
300 addr2 += base_address;
302 count = simple_strtoul(argv[3], NULL, 16);
304 #ifdef CONFIG_HAS_DATAFLASH
305 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
306 puts ("Comparison with DataFlash space not supported.\n\r");
311 #ifdef CONFIG_BLACKFIN
312 if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) {
313 puts ("Comparison with L1 instruction memory not supported.\n\r");
318 bytes = size * count;
319 base = buf1 = map_sysmem(addr1, bytes);
320 buf2 = map_sysmem(addr2, bytes);
321 for (ngood = 0; ngood < count; ++ngood) {
323 word1 = *(u32 *)buf1;
324 word2 = *(u32 *)buf2;
325 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
326 } else if (size == 8) {
327 word1 = *(u64 *)buf1;
328 word2 = *(u64 *)buf2;
330 } else if (size == 2) {
331 word1 = *(u16 *)buf1;
332 word2 = *(u16 *)buf2;
337 if (word1 != word2) {
338 ulong offset = buf1 - base;
339 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
340 printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
341 type, (void *)(addr1 + offset), size, word1,
342 type, (void *)(addr2 + offset), size, word2);
344 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
345 type, (ulong)(addr1 + offset), size, word1,
346 type, (ulong)(addr2 + offset), size, word2);
355 /* reset watchdog from time to time */
356 if ((ngood % (64 << 10)) == 0)
362 printf("Total of %ld %s(s) were the same\n", ngood, type);
366 static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
368 ulong addr, dest, count, bytes;
374 return CMD_RET_USAGE;
376 /* Check for size specification.
378 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
381 addr = simple_strtoul(argv[1], NULL, 16);
382 addr += base_address;
384 dest = simple_strtoul(argv[2], NULL, 16);
385 dest += base_address;
387 count = simple_strtoul(argv[3], NULL, 16);
390 puts ("Zero length ???\n");
394 #ifndef CONFIG_SYS_NO_FLASH
395 /* check if we are copying to Flash */
396 if ( (addr2info(dest) != NULL)
397 #ifdef CONFIG_HAS_DATAFLASH
398 && (!addr_dataflash(dest))
403 puts ("Copy to Flash... ");
405 rc = flash_write ((char *)addr, dest, count*size);
415 #ifdef CONFIG_HAS_DATAFLASH
416 /* Check if we are copying from RAM or Flash to DataFlash */
417 if (addr_dataflash(dest) && !addr_dataflash(addr)){
420 puts ("Copy to DataFlash... ");
422 rc = write_dataflash (dest, addr, count*size);
425 dataflash_perror (rc);
432 /* Check if we are copying from DataFlash to RAM */
433 if (addr_dataflash(addr) && !addr_dataflash(dest)
434 #ifndef CONFIG_SYS_NO_FLASH
435 && (addr2info(dest) == NULL)
439 rc = read_dataflash(addr, count * size, (char *) dest);
441 dataflash_perror (rc);
447 if (addr_dataflash(addr) && addr_dataflash(dest)){
448 puts ("Unsupported combination of source/destination.\n\r");
453 #ifdef CONFIG_BLACKFIN
454 /* See if we're copying to/from L1 inst */
455 if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) {
456 memcpy((void *)dest, (void *)addr, count * size);
461 bytes = size * count;
462 buf = map_sysmem(dest, bytes);
463 src = map_sysmem(addr, bytes);
464 while (count-- > 0) {
466 *((u32 *)buf) = *((u32 *)src);
467 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
469 *((u64 *)buf) = *((u64 *)src);
472 *((u16 *)buf) = *((u16 *)src);
474 *((u8 *)buf) = *((u8 *)src);
478 /* reset watchdog from time to time */
479 if ((count % (64 << 10)) == 0)
485 static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
489 /* Set new base address.
491 base_address = simple_strtoul(argv[1], NULL, 16);
493 /* Print the current base address.
495 printf("Base Address: 0x%08lx\n", base_address);
499 static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
502 ulong addr, length, i, bytes;
504 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
508 volatile u16 *shortp;
513 return CMD_RET_USAGE;
516 * Check for a size specification.
517 * Defaults to long if no or incorrect specification.
519 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
522 /* Address is always specified.
524 addr = simple_strtoul(argv[1], NULL, 16);
526 /* Length is the number of objects, not number of bytes.
528 length = simple_strtoul(argv[2], NULL, 16);
530 bytes = size * length;
531 buf = map_sysmem(addr, bytes);
533 /* We want to optimize the loops to run as fast as possible.
534 * If we have only one object, just run infinite loops.
537 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
559 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
597 int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
599 ulong addr, length, i, bytes;
601 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
608 volatile u16 *shortp;
613 return CMD_RET_USAGE;
616 * Check for a size specification.
617 * Defaults to long if no or incorrect specification.
619 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
622 /* Address is always specified.
624 addr = simple_strtoul(argv[1], NULL, 16);
626 /* Length is the number of objects, not number of bytes.
628 length = simple_strtoul(argv[2], NULL, 16);
631 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
632 data = simple_strtoull(argv[3], NULL, 16);
634 data = simple_strtoul(argv[3], NULL, 16);
637 bytes = size * length;
638 buf = map_sysmem(addr, bytes);
640 /* We want to optimize the loops to run as fast as possible.
641 * If we have only one object, just run infinite loops.
644 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
666 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
699 #endif /* CONFIG_LOOPW */
701 #ifdef CONFIG_CMD_MEMTEST
702 static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
713 vu_long anti_pattern;
715 static const ulong bitpattern[] = {
716 0x00000001, /* single bit */
717 0x00000003, /* two adjacent bits */
718 0x00000007, /* three adjacent bits */
719 0x0000000F, /* four adjacent bits */
720 0x00000005, /* two non-adjacent bits */
721 0x00000015, /* three non-adjacent bits */
722 0x00000055, /* four non-adjacent bits */
723 0xaaaaaaaa, /* alternating 1/0 */
726 num_words = (end_addr - start_addr) / sizeof(vu_long);
729 * Data line test: write a pattern to the first
730 * location, write the 1's complement to a 'parking'
731 * address (changes the state of the data bus so a
732 * floating bus doesn't give a false OK), and then
733 * read the value back. Note that we read it back
734 * into a variable because the next time we read it,
735 * it might be right (been there, tough to explain to
736 * the quality guys why it prints a failure when the
737 * "is" and "should be" are obviously the same in the
740 * Rather than exhaustively testing, we test some
741 * patterns by shifting '1' bits through a field of
742 * '0's and '0' bits through a field of '1's (i.e.
743 * pattern and ~pattern).
746 for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) {
748 for (; val != 0; val <<= 1) {
750 *dummy = ~val; /* clear the test data off the bus */
752 if (readback != val) {
753 printf("FAILURE (data line): "
754 "expected %08lx, actual %08lx\n",
763 if (readback != ~val) {
764 printf("FAILURE (data line): "
765 "Is %08lx, should be %08lx\n",
775 * Based on code whose Original Author and Copyright
776 * information follows: Copyright (c) 1998 by Michael
777 * Barr. This software is placed into the public
778 * domain and may be used for any purpose. However,
779 * this notice must not be changed or removed and no
780 * warranty is either expressed or implied by its
781 * publication or distribution.
787 * Description: Test the address bus wiring in a
788 * memory region by performing a walking
789 * 1's test on the relevant bits of the
790 * address and checking for aliasing.
791 * This test will find single-bit
792 * address failures such as stuck-high,
793 * stuck-low, and shorted pins. The base
794 * address and size of the region are
795 * selected by the caller.
797 * Notes: For best results, the selected base
798 * address should have enough LSB 0's to
799 * guarantee single address bit changes.
800 * For example, to test a 64-Kbyte
801 * region, select a base address on a
802 * 64-Kbyte boundary. Also, select the
803 * region size as a power-of-two if at
806 * Returns: 0 if the test succeeds, 1 if the test fails.
808 pattern = (vu_long) 0xaaaaaaaa;
809 anti_pattern = (vu_long) 0x55555555;
811 debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words);
813 * Write the default pattern at each of the
814 * power-of-two offsets.
816 for (offset = 1; offset < num_words; offset <<= 1)
817 addr[offset] = pattern;
820 * Check for address bits stuck high.
823 addr[test_offset] = anti_pattern;
825 for (offset = 1; offset < num_words; offset <<= 1) {
827 if (temp != pattern) {
828 printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
829 " expected 0x%.8lx, actual 0x%.8lx\n",
830 start_addr + offset*sizeof(vu_long),
837 addr[test_offset] = pattern;
841 * Check for addr bits stuck low or shorted.
843 for (test_offset = 1; test_offset < num_words; test_offset <<= 1) {
844 addr[test_offset] = anti_pattern;
846 for (offset = 1; offset < num_words; offset <<= 1) {
848 if ((temp != pattern) && (offset != test_offset)) {
849 printf("\nFAILURE: Address bit stuck low or"
850 " shorted @ 0x%.8lx: expected 0x%.8lx,"
852 start_addr + offset*sizeof(vu_long),
859 addr[test_offset] = pattern;
863 * Description: Test the integrity of a physical
864 * memory device by performing an
865 * increment/decrement test over the
866 * entire region. In the process every
867 * storage bit in the device is tested
868 * as a zero and a one. The base address
869 * and the size of the region are
870 * selected by the caller.
872 * Returns: 0 if the test succeeds, 1 if the test fails.
877 * Fill memory with a known pattern.
879 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
881 addr[offset] = pattern;
885 * Check each location and invert it for the second pass.
887 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
890 if (temp != pattern) {
891 printf("\nFAILURE (read/write) @ 0x%.8lx:"
892 " expected 0x%.8lx, actual 0x%.8lx)\n",
893 start_addr + offset*sizeof(vu_long),
900 anti_pattern = ~pattern;
901 addr[offset] = anti_pattern;
905 * Check each location for the inverted pattern and zero it.
907 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
909 anti_pattern = ~pattern;
911 if (temp != anti_pattern) {
912 printf("\nFAILURE (read/write): @ 0x%.8lx:"
913 " expected 0x%.8lx, actual 0x%.8lx)\n",
914 start_addr + offset*sizeof(vu_long),
926 static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
927 vu_long pattern, int iteration)
935 /* Alternate the pattern */
940 * Flip the pattern each time to make lots of zeros and
941 * then, the next time, lots of ones. We decrement
942 * the "negative" patterns and increment the "positive"
943 * patterns to preserve this feature.
945 if (pattern & 0x80000000)
946 pattern = -pattern; /* complement & increment */
950 length = (end_addr - start_addr) / sizeof(ulong);
952 printf("\rPattern %08lX Writing..."
954 "\b\b\b\b\b\b\b\b\b\b",
957 for (addr = buf, val = pattern; addr < end; addr++) {
965 for (addr = buf, val = pattern; addr < end; addr++) {
968 if (readback != val) {
969 ulong offset = addr - buf;
971 printf("\nMem error @ 0x%08X: "
972 "found %08lX, expected %08lX\n",
973 (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
986 * Perform a memory test. A more complete alternative test can be
987 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
988 * interrupted by ctrl-c or by a failure of one of the sub-tests.
990 static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
994 vu_long *buf, *dummy;
997 ulong errs = 0; /* number of errors, or -1 if interrupted */
1000 #if defined(CONFIG_SYS_ALT_MEMTEST)
1001 const int alt_test = 1;
1003 const int alt_test = 0;
1007 start = simple_strtoul(argv[1], NULL, 16);
1009 start = CONFIG_SYS_MEMTEST_START;
1012 end = simple_strtoul(argv[2], NULL, 16);
1014 end = CONFIG_SYS_MEMTEST_END;
1017 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
1022 iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16);
1024 iteration_limit = 0;
1026 printf("Testing %08x ... %08x:\n", (uint)start, (uint)end);
1027 debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__,
1030 buf = map_sysmem(start, end - start);
1031 dummy = map_sysmem(CONFIG_SYS_MEMTEST_SCRATCH, sizeof(vu_long));
1033 !iteration_limit || iteration < iteration_limit;
1040 printf("Iteration: %6d\r", iteration + 1);
1043 errs = mem_test_alt(buf, start, end, dummy);
1045 errs = mem_test_quick(buf, start, end, pattern,
1053 * Work-around for eldk-4.2 which gives this warning if we try to
1054 * case in the unmap_sysmem() call:
1055 * warning: initialization discards qualifiers from pointer target type
1058 void *vbuf = (void *)buf;
1059 void *vdummy = (void *)dummy;
1062 unmap_sysmem(vdummy);
1066 /* Memory test was aborted - write a newline to finish off */
1070 printf("Tested %d iteration(s) with %lu errors.\n",
1075 return ret; /* not reached */
1077 #endif /* CONFIG_CMD_MEMTEST */
1082 * mm{.b, .w, .l, .q} {addr}
1083 * nm{.b, .w, .l, .q} {addr}
1086 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
1089 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1098 return CMD_RET_USAGE;
1100 #ifdef CONFIG_BOOT_RETRY_TIME
1101 reset_cmd_timeout(); /* got a good command to get here */
1103 /* We use the last specified parameters, unless new ones are
1106 addr = mm_last_addr;
1107 size = mm_last_size;
1109 if ((flag & CMD_FLAG_REPEAT) == 0) {
1110 /* New command specified. Check for a size specification.
1111 * Defaults to long if no or incorrect specification.
1113 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1116 /* Address is specified since argc > 1
1118 addr = simple_strtoul(argv[1], NULL, 16);
1119 addr += base_address;
1122 #ifdef CONFIG_HAS_DATAFLASH
1123 if (addr_dataflash(addr)){
1124 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
1129 #ifdef CONFIG_BLACKFIN
1130 if (addr_bfin_on_chip_mem(addr)) {
1131 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
1136 /* Print the address, followed by value. Then accept input for
1137 * the next value. A non-converted value exits.
1140 ptr = map_sysmem(addr, size);
1141 printf("%08lx:", addr);
1143 printf(" %08x", *((u32 *)ptr));
1144 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1146 printf(" %016llx", *((u64 *)ptr));
1149 printf(" %04x", *((u16 *)ptr));
1151 printf(" %02x", *((u8 *)ptr));
1153 nbytes = cli_readline(" ? ");
1154 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1155 /* <CR> pressed as only input, don't modify current
1156 * location and move to next. "-" pressed will go back.
1159 addr += nbytes ? -size : size;
1161 #ifdef CONFIG_BOOT_RETRY_TIME
1162 reset_cmd_timeout(); /* good enough to not time out */
1165 #ifdef CONFIG_BOOT_RETRY_TIME
1166 else if (nbytes == -2) {
1167 break; /* timed out, exit the command */
1172 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1173 i = simple_strtoull(console_buffer, &endp, 16);
1175 i = simple_strtoul(console_buffer, &endp, 16);
1177 nbytes = endp - console_buffer;
1179 #ifdef CONFIG_BOOT_RETRY_TIME
1180 /* good enough to not time out
1182 reset_cmd_timeout();
1186 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1202 mm_last_addr = addr;
1203 mm_last_size = size;
1207 #ifdef CONFIG_CMD_CRC32
1209 static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1216 return CMD_RET_USAGE;
1220 #ifdef CONFIG_HASH_VERIFY
1221 if (strcmp(*av, "-v") == 0) {
1222 flags |= HASH_FLAG_VERIFY;
1228 return hash_command("crc32", flags, cmdtp, flag, ac, av);
1233 /**************************************************/
1235 md, 3, 1, do_mem_md,
1237 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1238 "[.b, .w, .l, .q] address [# of objects]"
1240 "[.b, .w, .l] address [# of objects]"
1246 mm, 2, 1, do_mem_mm,
1247 "memory modify (auto-incrementing address)",
1248 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1249 "[.b, .w, .l, .q] address"
1251 "[.b, .w, .l] address"
1257 nm, 2, 1, do_mem_nm,
1258 "memory modify (constant address)",
1259 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1260 "[.b, .w, .l, .q] address"
1262 "[.b, .w, .l] address"
1267 mw, 4, 1, do_mem_mw,
1268 "memory write (fill)",
1269 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1270 "[.b, .w, .l, .q] address value [count]"
1272 "[.b, .w, .l] address value [count]"
1277 cp, 4, 1, do_mem_cp,
1279 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1280 "[.b, .w, .l, .q] source target count"
1282 "[.b, .w, .l] source target count"
1287 cmp, 4, 1, do_mem_cmp,
1289 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1290 "[.b, .w, .l, .q] addr1 addr2 count"
1292 "[.b, .w, .l] addr1 addr2 count"
1296 #ifdef CONFIG_CMD_CRC32
1298 #ifndef CONFIG_CRC32_VERIFY
1301 crc32, 4, 1, do_mem_crc,
1302 "checksum calculation",
1303 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1306 #else /* CONFIG_CRC32_VERIFY */
1309 crc32, 5, 1, do_mem_crc,
1310 "checksum calculation",
1311 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1312 "-v address count crc\n - verify crc of memory area"
1315 #endif /* CONFIG_CRC32_VERIFY */
1319 #ifdef CONFIG_CMD_MEMINFO
1320 __weak void board_show_dram(ulong size)
1323 print_size(size, "\n");
1326 static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
1327 char * const argv[])
1329 board_show_dram(gd->ram_size);
1336 base, 2, 1, do_mem_base,
1337 "print or set address offset",
1338 "\n - print address offset for memory commands\n"
1339 "base off\n - set address offset for memory commands to 'off'"
1343 loop, 3, 1, do_mem_loop,
1344 "infinite loop on address range",
1345 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1346 "[.b, .w, .l, .q] address number_of_objects"
1348 "[.b, .w, .l] address number_of_objects"
1354 loopw, 4, 1, do_mem_loopw,
1355 "infinite write loop on address range",
1356 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1357 "[.b, .w, .l, .q] address number_of_objects data_to_write"
1359 "[.b, .w, .l] address number_of_objects data_to_write"
1362 #endif /* CONFIG_LOOPW */
1364 #ifdef CONFIG_CMD_MEMTEST
1366 mtest, 5, 1, do_mem_mtest,
1367 "simple RAM read/write test",
1368 "[start [end [pattern [iterations]]]]"
1370 #endif /* CONFIG_CMD_MEMTEST */
1372 #ifdef CONFIG_MX_CYCLIC
1374 mdc, 4, 1, do_mem_mdc,
1375 "memory display cyclic",
1376 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1377 "[.b, .w, .l, .q] address count delay(ms)"
1379 "[.b, .w, .l] address count delay(ms)"
1384 mwc, 4, 1, do_mem_mwc,
1385 "memory write cyclic",
1386 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1387 "[.b, .w, .l, .q] address value delay(ms)"
1389 "[.b, .w, .l] address value delay(ms)"
1392 #endif /* CONFIG_MX_CYCLIC */
1394 #ifdef CONFIG_CMD_MEMINFO
1396 meminfo, 3, 1, do_mem_info,
1397 "display memory information",