1 // SPDX-License-Identifier: GPL-2.0+
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
10 * Copied from FADS ROM, Dan Malek (dmalek@jlc.net)
15 #include <bootretry.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 ulong dp_last_addr, dp_last_size;
37 static ulong dp_last_length = 0x40;
38 static ulong 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[])
50 ulong addr, length, bytes;
55 /* We use the last specified parameters, unless new ones are
60 length = dp_last_length;
65 if ((flag & CMD_FLAG_REPEAT) == 0) {
66 /* New command specified. Check for a size specification.
67 * Defaults to long if no or incorrect specification.
69 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
72 /* Address is specified since argc > 1
74 addr = simple_strtoul(argv[1], NULL, 16);
77 /* If another parameter, it is the length to display.
78 * Length is the number of objects, not number of bytes.
81 length = simple_strtoul(argv[2], NULL, 16);
84 bytes = size * length;
85 buf = map_sysmem(addr, bytes);
87 /* Print the lines. */
88 print_buffer(addr, buf, size, length, DISP_LINE_LEN / size);
93 dp_last_length = length;
98 static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
100 return mod_mem (cmdtp, 1, flag, argc, argv);
102 static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
104 return mod_mem (cmdtp, 0, flag, argc, argv);
107 static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
109 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
119 if ((argc < 3) || (argc > 4))
120 return CMD_RET_USAGE;
122 /* Check for size specification.
124 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
127 /* Address is specified since argc > 1
129 addr = simple_strtoul(argv[1], NULL, 16);
130 addr += base_address;
132 /* Get the value to write.
134 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
135 writeval = simple_strtoull(argv[2], NULL, 16);
137 writeval = simple_strtoul(argv[2], NULL, 16);
142 count = simple_strtoul(argv[3], NULL, 16);
147 bytes = size * count;
148 start = map_sysmem(addr, bytes);
150 while (count-- > 0) {
152 *((u32 *)buf) = (u32)writeval;
153 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
155 *((u64 *)buf) = (u64)writeval;
158 *((u16 *)buf) = (u16)writeval;
160 *((u8 *)buf) = (u8)writeval;
167 #ifdef CONFIG_MX_CYCLIC
168 static int do_mem_mdc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
174 return CMD_RET_USAGE;
176 count = simple_strtoul(argv[3], NULL, 10);
179 do_mem_md (NULL, 0, 3, argv);
181 /* delay for <count> ms... */
182 for (i=0; i<count; i++)
185 /* check for ctrl-c to abort... */
195 static int do_mem_mwc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
201 return CMD_RET_USAGE;
203 count = simple_strtoul(argv[3], NULL, 10);
206 do_mem_mw (NULL, 0, 3, argv);
208 /* delay for <count> ms... */
209 for (i=0; i<count; i++)
212 /* check for ctrl-c to abort... */
221 #endif /* CONFIG_MX_CYCLIC */
223 static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
225 ulong addr1, addr2, count, ngood, bytes;
229 const void *buf1, *buf2, *base;
230 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
237 return CMD_RET_USAGE;
239 /* Check for size specification.
241 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
243 type = size == 8 ? "double word" :
245 size == 2 ? "halfword" : "byte";
247 addr1 = simple_strtoul(argv[1], NULL, 16);
248 addr1 += base_address;
250 addr2 = simple_strtoul(argv[2], NULL, 16);
251 addr2 += base_address;
253 count = simple_strtoul(argv[3], NULL, 16);
255 bytes = size * count;
256 base = buf1 = map_sysmem(addr1, bytes);
257 buf2 = map_sysmem(addr2, bytes);
258 for (ngood = 0; ngood < count; ++ngood) {
260 word1 = *(u32 *)buf1;
261 word2 = *(u32 *)buf2;
262 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
263 } else if (size == 8) {
264 word1 = *(u64 *)buf1;
265 word2 = *(u64 *)buf2;
267 } else if (size == 2) {
268 word1 = *(u16 *)buf1;
269 word2 = *(u16 *)buf2;
274 if (word1 != word2) {
275 ulong offset = buf1 - base;
276 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
277 printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
278 type, (void *)(addr1 + offset), size, word1,
279 type, (void *)(addr2 + offset), size, word2);
281 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
282 type, (ulong)(addr1 + offset), size, word1,
283 type, (ulong)(addr2 + offset), size, word2);
292 /* reset watchdog from time to time */
293 if ((ngood % (64 << 10)) == 0)
299 printf("Total of %ld %s(s) were the same\n", ngood, type);
303 static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
305 ulong addr, dest, count;
310 return CMD_RET_USAGE;
312 /* Check for size specification.
314 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
317 addr = simple_strtoul(argv[1], NULL, 16);
318 addr += base_address;
320 dest = simple_strtoul(argv[2], NULL, 16);
321 dest += base_address;
323 count = simple_strtoul(argv[3], NULL, 16);
326 puts ("Zero length ???\n");
330 src = map_sysmem(addr, count * size);
331 dst = map_sysmem(dest, count * size);
333 #ifdef CONFIG_MTD_NOR_FLASH
334 /* check if we are copying to Flash */
335 if (addr2info((ulong)dst)) {
338 puts ("Copy to Flash... ");
340 rc = flash_write((char *)src, (ulong)dst, count * size);
354 memcpy(dst, src, count * size);
361 static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
365 /* Set new base address.
367 base_address = simple_strtoul(argv[1], NULL, 16);
369 /* Print the current base address.
371 printf("Base Address: 0x%08lx\n", base_address);
375 static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
378 ulong addr, length, i, bytes;
380 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
384 volatile u16 *shortp;
389 return CMD_RET_USAGE;
392 * Check for a size specification.
393 * Defaults to long if no or incorrect specification.
395 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
398 /* Address is always specified.
400 addr = simple_strtoul(argv[1], NULL, 16);
402 /* Length is the number of objects, not number of bytes.
404 length = simple_strtoul(argv[2], NULL, 16);
406 bytes = size * length;
407 buf = map_sysmem(addr, bytes);
409 /* We want to optimize the loops to run as fast as possible.
410 * If we have only one object, just run infinite loops.
413 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
435 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
473 static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int argc,
476 ulong addr, length, i, bytes;
478 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
485 volatile u16 *shortp;
490 return CMD_RET_USAGE;
493 * Check for a size specification.
494 * Defaults to long if no or incorrect specification.
496 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
499 /* Address is always specified.
501 addr = simple_strtoul(argv[1], NULL, 16);
503 /* Length is the number of objects, not number of bytes.
505 length = simple_strtoul(argv[2], NULL, 16);
508 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
509 data = simple_strtoull(argv[3], NULL, 16);
511 data = simple_strtoul(argv[3], NULL, 16);
514 bytes = size * length;
515 buf = map_sysmem(addr, bytes);
517 /* We want to optimize the loops to run as fast as possible.
518 * If we have only one object, just run infinite loops.
521 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
543 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
576 #endif /* CONFIG_LOOPW */
578 #ifdef CONFIG_CMD_MEMTEST
579 static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
590 vu_long anti_pattern;
592 static const ulong bitpattern[] = {
593 0x00000001, /* single bit */
594 0x00000003, /* two adjacent bits */
595 0x00000007, /* three adjacent bits */
596 0x0000000F, /* four adjacent bits */
597 0x00000005, /* two non-adjacent bits */
598 0x00000015, /* three non-adjacent bits */
599 0x00000055, /* four non-adjacent bits */
600 0xaaaaaaaa, /* alternating 1/0 */
603 num_words = (end_addr - start_addr) / sizeof(vu_long);
606 * Data line test: write a pattern to the first
607 * location, write the 1's complement to a 'parking'
608 * address (changes the state of the data bus so a
609 * floating bus doesn't give a false OK), and then
610 * read the value back. Note that we read it back
611 * into a variable because the next time we read it,
612 * it might be right (been there, tough to explain to
613 * the quality guys why it prints a failure when the
614 * "is" and "should be" are obviously the same in the
617 * Rather than exhaustively testing, we test some
618 * patterns by shifting '1' bits through a field of
619 * '0's and '0' bits through a field of '1's (i.e.
620 * pattern and ~pattern).
623 for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) {
625 for (; val != 0; val <<= 1) {
627 *dummy = ~val; /* clear the test data off the bus */
629 if (readback != val) {
630 printf("FAILURE (data line): "
631 "expected %08lx, actual %08lx\n",
640 if (readback != ~val) {
641 printf("FAILURE (data line): "
642 "Is %08lx, should be %08lx\n",
652 * Based on code whose Original Author and Copyright
653 * information follows: Copyright (c) 1998 by Michael
654 * Barr. This software is placed into the public
655 * domain and may be used for any purpose. However,
656 * this notice must not be changed or removed and no
657 * warranty is either expressed or implied by its
658 * publication or distribution.
664 * Description: Test the address bus wiring in a
665 * memory region by performing a walking
666 * 1's test on the relevant bits of the
667 * address and checking for aliasing.
668 * This test will find single-bit
669 * address failures such as stuck-high,
670 * stuck-low, and shorted pins. The base
671 * address and size of the region are
672 * selected by the caller.
674 * Notes: For best results, the selected base
675 * address should have enough LSB 0's to
676 * guarantee single address bit changes.
677 * For example, to test a 64-Kbyte
678 * region, select a base address on a
679 * 64-Kbyte boundary. Also, select the
680 * region size as a power-of-two if at
683 * Returns: 0 if the test succeeds, 1 if the test fails.
685 pattern = (vu_long) 0xaaaaaaaa;
686 anti_pattern = (vu_long) 0x55555555;
688 debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words);
690 * Write the default pattern at each of the
691 * power-of-two offsets.
693 for (offset = 1; offset < num_words; offset <<= 1)
694 addr[offset] = pattern;
697 * Check for address bits stuck high.
700 addr[test_offset] = anti_pattern;
702 for (offset = 1; offset < num_words; offset <<= 1) {
704 if (temp != pattern) {
705 printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
706 " expected 0x%.8lx, actual 0x%.8lx\n",
707 start_addr + offset*sizeof(vu_long),
714 addr[test_offset] = pattern;
718 * Check for addr bits stuck low or shorted.
720 for (test_offset = 1; test_offset < num_words; test_offset <<= 1) {
721 addr[test_offset] = anti_pattern;
723 for (offset = 1; offset < num_words; offset <<= 1) {
725 if ((temp != pattern) && (offset != test_offset)) {
726 printf("\nFAILURE: Address bit stuck low or"
727 " shorted @ 0x%.8lx: expected 0x%.8lx,"
729 start_addr + offset*sizeof(vu_long),
736 addr[test_offset] = pattern;
740 * Description: Test the integrity of a physical
741 * memory device by performing an
742 * increment/decrement test over the
743 * entire region. In the process every
744 * storage bit in the device is tested
745 * as a zero and a one. The base address
746 * and the size of the region are
747 * selected by the caller.
749 * Returns: 0 if the test succeeds, 1 if the test fails.
754 * Fill memory with a known pattern.
756 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
758 addr[offset] = pattern;
762 * Check each location and invert it for the second pass.
764 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
767 if (temp != pattern) {
768 printf("\nFAILURE (read/write) @ 0x%.8lx:"
769 " expected 0x%.8lx, actual 0x%.8lx)\n",
770 start_addr + offset*sizeof(vu_long),
777 anti_pattern = ~pattern;
778 addr[offset] = anti_pattern;
782 * Check each location for the inverted pattern and zero it.
784 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
786 anti_pattern = ~pattern;
788 if (temp != anti_pattern) {
789 printf("\nFAILURE (read/write): @ 0x%.8lx:"
790 " expected 0x%.8lx, actual 0x%.8lx)\n",
791 start_addr + offset*sizeof(vu_long),
803 static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
804 vu_long pattern, int iteration)
812 /* Alternate the pattern */
817 * Flip the pattern each time to make lots of zeros and
818 * then, the next time, lots of ones. We decrement
819 * the "negative" patterns and increment the "positive"
820 * patterns to preserve this feature.
822 if (pattern & 0x80000000)
823 pattern = -pattern; /* complement & increment */
827 length = (end_addr - start_addr) / sizeof(ulong);
829 printf("\rPattern %08lX Writing..."
831 "\b\b\b\b\b\b\b\b\b\b",
834 for (addr = buf, val = pattern; addr < end; addr++) {
842 for (addr = buf, val = pattern; addr < end; addr++) {
845 if (readback != val) {
846 ulong offset = addr - buf;
848 printf("\nMem error @ 0x%08X: "
849 "found %08lX, expected %08lX\n",
850 (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
863 * Perform a memory test. A more complete alternative test can be
864 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
865 * interrupted by ctrl-c or by a failure of one of the sub-tests.
867 static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
871 vu_long *buf, *dummy;
872 ulong iteration_limit = 0;
874 ulong errs = 0; /* number of errors, or -1 if interrupted */
877 #if defined(CONFIG_SYS_ALT_MEMTEST)
878 const int alt_test = 1;
880 const int alt_test = 0;
883 start = CONFIG_SYS_MEMTEST_START;
884 end = CONFIG_SYS_MEMTEST_END;
887 if (strict_strtoul(argv[1], 16, &start) < 0)
888 return CMD_RET_USAGE;
891 if (strict_strtoul(argv[2], 16, &end) < 0)
892 return CMD_RET_USAGE;
895 if (strict_strtoul(argv[3], 16, &pattern) < 0)
896 return CMD_RET_USAGE;
899 if (strict_strtoul(argv[4], 16, &iteration_limit) < 0)
900 return CMD_RET_USAGE;
903 printf("Refusing to do empty test\n");
907 printf("Testing %08lx ... %08lx:\n", start, end);
908 debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__,
911 buf = map_sysmem(start, end - start);
912 dummy = map_sysmem(CONFIG_SYS_MEMTEST_SCRATCH, sizeof(vu_long));
914 !iteration_limit || iteration < iteration_limit;
921 printf("Iteration: %6d\r", iteration + 1);
924 errs = mem_test_alt(buf, start, end, dummy);
926 errs = mem_test_quick(buf, start, end, pattern,
934 * Work-around for eldk-4.2 which gives this warning if we try to
935 * case in the unmap_sysmem() call:
936 * warning: initialization discards qualifiers from pointer target type
939 void *vbuf = (void *)buf;
940 void *vdummy = (void *)dummy;
943 unmap_sysmem(vdummy);
947 /* Memory test was aborted - write a newline to finish off */
951 printf("Tested %d iteration(s) with %lu errors.\n",
958 #endif /* CONFIG_CMD_MEMTEST */
963 * mm{.b, .w, .l, .q} {addr}
964 * nm{.b, .w, .l, .q} {addr}
967 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
970 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
979 return CMD_RET_USAGE;
981 bootretry_reset_cmd_timeout(); /* got a good command to get here */
982 /* We use the last specified parameters, unless new ones are
988 if ((flag & CMD_FLAG_REPEAT) == 0) {
989 /* New command specified. Check for a size specification.
990 * Defaults to long if no or incorrect specification.
992 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
995 /* Address is specified since argc > 1
997 addr = simple_strtoul(argv[1], NULL, 16);
998 addr += base_address;
1001 /* Print the address, followed by value. Then accept input for
1002 * the next value. A non-converted value exits.
1005 ptr = map_sysmem(addr, size);
1006 printf("%08lx:", addr);
1008 printf(" %08x", *((u32 *)ptr));
1009 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1011 printf(" %016llx", *((u64 *)ptr));
1014 printf(" %04x", *((u16 *)ptr));
1016 printf(" %02x", *((u8 *)ptr));
1018 nbytes = cli_readline(" ? ");
1019 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1020 /* <CR> pressed as only input, don't modify current
1021 * location and move to next. "-" pressed will go back.
1024 addr += nbytes ? -size : size;
1026 /* good enough to not time out */
1027 bootretry_reset_cmd_timeout();
1029 #ifdef CONFIG_BOOT_RETRY_TIME
1030 else if (nbytes == -2) {
1031 break; /* timed out, exit the command */
1036 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1037 i = simple_strtoull(console_buffer, &endp, 16);
1039 i = simple_strtoul(console_buffer, &endp, 16);
1041 nbytes = endp - console_buffer;
1043 /* good enough to not time out
1045 bootretry_reset_cmd_timeout();
1048 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1064 mm_last_addr = addr;
1065 mm_last_size = size;
1069 #ifdef CONFIG_CMD_CRC32
1071 static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1078 return CMD_RET_USAGE;
1082 #ifdef CONFIG_CRC32_VERIFY
1083 if (strcmp(*av, "-v") == 0) {
1084 flags |= HASH_FLAG_VERIFY | HASH_FLAG_ENV;
1090 return hash_command("crc32", flags, cmdtp, flag, ac, av);
1095 #ifdef CONFIG_CMD_RANDOM
1096 static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1098 unsigned long addr, len;
1099 unsigned long seed; // NOT INITIALIZED ON PURPOSE
1100 unsigned int *buf, *start;
1101 unsigned char *buf8;
1104 if (argc < 3 || argc > 4) {
1105 printf("usage: %s <addr> <len> [<seed>]\n", argv[0]);
1109 len = simple_strtoul(argv[2], NULL, 16);
1110 addr = simple_strtoul(argv[1], NULL, 16);
1113 seed = simple_strtoul(argv[3], NULL, 16);
1115 printf("The seed cannot be 0. Using 0xDEADBEEF.\n");
1119 seed = get_timer(0) ^ rand();
1123 start = map_sysmem(addr, len);
1125 for (i = 0; i < (len / 4); i++)
1128 buf8 = (unsigned char *)buf;
1129 for (i = 0; i < (len % 4); i++)
1130 *buf8++ = rand() & 0xFF;
1132 unmap_sysmem(start);
1133 printf("%lu bytes filled with random data\n", len);
1138 /**************************************************/
1140 md, 3, 1, do_mem_md,
1142 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1143 "[.b, .w, .l, .q] address [# of objects]"
1145 "[.b, .w, .l] address [# of objects]"
1151 mm, 2, 1, do_mem_mm,
1152 "memory modify (auto-incrementing address)",
1153 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1154 "[.b, .w, .l, .q] address"
1156 "[.b, .w, .l] address"
1162 nm, 2, 1, do_mem_nm,
1163 "memory modify (constant address)",
1164 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1165 "[.b, .w, .l, .q] address"
1167 "[.b, .w, .l] address"
1172 mw, 4, 1, do_mem_mw,
1173 "memory write (fill)",
1174 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1175 "[.b, .w, .l, .q] address value [count]"
1177 "[.b, .w, .l] address value [count]"
1182 cp, 4, 1, do_mem_cp,
1184 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1185 "[.b, .w, .l, .q] source target count"
1187 "[.b, .w, .l] source target count"
1192 cmp, 4, 1, do_mem_cmp,
1194 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1195 "[.b, .w, .l, .q] addr1 addr2 count"
1197 "[.b, .w, .l] addr1 addr2 count"
1201 #ifdef CONFIG_CMD_CRC32
1203 #ifndef CONFIG_CRC32_VERIFY
1206 crc32, 4, 1, do_mem_crc,
1207 "checksum calculation",
1208 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1211 #else /* CONFIG_CRC32_VERIFY */
1214 crc32, 5, 1, do_mem_crc,
1215 "checksum calculation",
1216 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1217 "-v address count crc\n - verify crc of memory area"
1220 #endif /* CONFIG_CRC32_VERIFY */
1224 #ifdef CONFIG_CMD_MEMINFO
1225 static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
1226 char * const argv[])
1229 print_size(gd->ram_size, "\n");
1236 base, 2, 1, do_mem_base,
1237 "print or set address offset",
1238 "\n - print address offset for memory commands\n"
1239 "base off\n - set address offset for memory commands to 'off'"
1243 loop, 3, 1, do_mem_loop,
1244 "infinite loop on address range",
1245 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1246 "[.b, .w, .l, .q] address number_of_objects"
1248 "[.b, .w, .l] address number_of_objects"
1254 loopw, 4, 1, do_mem_loopw,
1255 "infinite write loop on address range",
1256 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1257 "[.b, .w, .l, .q] address number_of_objects data_to_write"
1259 "[.b, .w, .l] address number_of_objects data_to_write"
1262 #endif /* CONFIG_LOOPW */
1264 #ifdef CONFIG_CMD_MEMTEST
1266 mtest, 5, 1, do_mem_mtest,
1267 "simple RAM read/write test",
1268 "[start [end [pattern [iterations]]]]"
1270 #endif /* CONFIG_CMD_MEMTEST */
1272 #ifdef CONFIG_MX_CYCLIC
1274 mdc, 4, 1, do_mem_mdc,
1275 "memory display cyclic",
1276 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1277 "[.b, .w, .l, .q] address count delay(ms)"
1279 "[.b, .w, .l] address count delay(ms)"
1284 mwc, 4, 1, do_mem_mwc,
1285 "memory write cyclic",
1286 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1287 "[.b, .w, .l, .q] address value delay(ms)"
1289 "[.b, .w, .l] address value delay(ms)"
1292 #endif /* CONFIG_MX_CYCLIC */
1294 #ifdef CONFIG_CMD_MEMINFO
1296 meminfo, 3, 1, do_mem_info,
1297 "display memory information",
1302 #ifdef CONFIG_CMD_RANDOM
1304 random, 4, 0, do_random,
1305 "fill memory with random pattern",
1306 "<addr> <len> [<seed>]\n"
1307 " - Fill 'len' bytes of memory starting at 'addr' with random data\n"