3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * Copied from FADS ROM, Dan Malek (dmalek@jlc.net)
32 #ifdef CONFIG_HAS_DATAFLASH
33 #include <dataflash.h>
38 #include <linux/compiler.h>
40 DECLARE_GLOBAL_DATA_PTR;
42 static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
44 /* Display values from last command.
45 * Memory modify remembered values are different from display memory.
47 static uint dp_last_addr, dp_last_size;
48 static uint dp_last_length = 0x40;
49 static uint mm_last_addr, mm_last_size;
51 static ulong base_address = 0;
56 * md{.b, .w, .l} {addr} {len}
58 #define DISP_LINE_LEN 16
59 static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
62 #if defined(CONFIG_HAS_DATAFLASH)
63 ulong nbytes, linebytes;
68 /* We use the last specified parameters, unless new ones are
73 length = dp_last_length;
78 if ((flag & CMD_FLAG_REPEAT) == 0) {
79 /* New command specified. Check for a size specification.
80 * Defaults to long if no or incorrect specification.
82 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
85 /* Address is specified since argc > 1
87 addr = simple_strtoul(argv[1], NULL, 16);
90 /* If another parameter, it is the length to display.
91 * Length is the number of objects, not number of bytes.
94 length = simple_strtoul(argv[2], NULL, 16);
97 #if defined(CONFIG_HAS_DATAFLASH)
100 * We buffer all read data, so we can make sure data is read only
101 * once, and all accesses are with the specified bus width.
103 nbytes = length * size;
105 char linebuf[DISP_LINE_LEN];
107 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
109 rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
110 p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
111 print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
119 } while (nbytes > 0);
122 # if defined(CONFIG_BLACKFIN)
123 /* See if we're trying to display L1 inst */
124 if (addr_bfin_on_chip_mem(addr)) {
125 char linebuf[DISP_LINE_LEN];
126 ulong linebytes, nbytes = length * size;
128 linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
129 memcpy(linebuf, (void *)addr, linebytes);
130 print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size);
138 } while (nbytes > 0);
143 ulong bytes = size * length;
144 const void *buf = map_sysmem(addr, bytes);
146 /* Print the lines. */
147 print_buffer(addr, buf, size, length, DISP_LINE_LEN / size);
154 dp_last_length = length;
159 static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
161 return mod_mem (cmdtp, 1, flag, argc, argv);
163 static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
165 return mod_mem (cmdtp, 0, flag, argc, argv);
168 static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
170 ulong addr, writeval, count;
175 if ((argc < 3) || (argc > 4))
176 return CMD_RET_USAGE;
178 /* Check for size specification.
180 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
183 /* Address is specified since argc > 1
185 addr = simple_strtoul(argv[1], NULL, 16);
186 addr += base_address;
188 /* Get the value to write.
190 writeval = simple_strtoul(argv[2], NULL, 16);
194 count = simple_strtoul(argv[3], NULL, 16);
199 bytes = size * count;
200 buf = map_sysmem(addr, bytes);
201 while (count-- > 0) {
203 *((ulong *)buf) = (ulong)writeval;
205 *((ushort *)buf) = (ushort)writeval;
207 *((u_char *)buf) = (u_char)writeval;
214 #ifdef CONFIG_MX_CYCLIC
215 int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
221 return CMD_RET_USAGE;
223 count = simple_strtoul(argv[3], NULL, 10);
226 do_mem_md (NULL, 0, 3, argv);
228 /* delay for <count> ms... */
229 for (i=0; i<count; i++)
232 /* check for ctrl-c to abort... */
242 int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
248 return CMD_RET_USAGE;
250 count = simple_strtoul(argv[3], NULL, 10);
253 do_mem_mw (NULL, 0, 3, argv);
255 /* delay for <count> ms... */
256 for (i=0; i<count; i++)
259 /* check for ctrl-c to abort... */
268 #endif /* CONFIG_MX_CYCLIC */
270 static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
272 ulong addr1, addr2, count, ngood, bytes;
276 const void *buf1, *buf2, *base;
279 return CMD_RET_USAGE;
281 /* Check for size specification.
283 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
285 type = size == 4 ? "word" : size == 2 ? "halfword" : "byte";
287 addr1 = simple_strtoul(argv[1], NULL, 16);
288 addr1 += base_address;
290 addr2 = simple_strtoul(argv[2], NULL, 16);
291 addr2 += base_address;
293 count = simple_strtoul(argv[3], NULL, 16);
295 #ifdef CONFIG_HAS_DATAFLASH
296 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
297 puts ("Comparison with DataFlash space not supported.\n\r");
302 #ifdef CONFIG_BLACKFIN
303 if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) {
304 puts ("Comparison with L1 instruction memory not supported.\n\r");
309 bytes = size * count;
310 base = buf1 = map_sysmem(addr1, bytes);
311 buf2 = map_sysmem(addr2, bytes);
312 for (ngood = 0; ngood < count; ++ngood) {
315 word1 = *(ulong *)buf1;
316 word2 = *(ulong *)buf2;
317 } else if (size == 2) {
318 word1 = *(ushort *)buf1;
319 word2 = *(ushort *)buf2;
321 word1 = *(u_char *)buf1;
322 word2 = *(u_char *)buf2;
324 if (word1 != word2) {
325 ulong offset = buf1 - base;
327 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
328 type, (ulong)(addr1 + offset), size, word1,
329 type, (ulong)(addr2 + offset), size, word2);
337 /* reset watchdog from time to time */
338 if ((ngood % (64 << 10)) == 0)
344 printf("Total of %ld %s(s) were the same\n", ngood, type);
348 static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
350 ulong addr, dest, count, bytes;
356 return CMD_RET_USAGE;
358 /* Check for size specification.
360 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
363 addr = simple_strtoul(argv[1], NULL, 16);
364 addr += base_address;
366 dest = simple_strtoul(argv[2], NULL, 16);
367 dest += base_address;
369 count = simple_strtoul(argv[3], NULL, 16);
372 puts ("Zero length ???\n");
376 #ifndef CONFIG_SYS_NO_FLASH
377 /* check if we are copying to Flash */
378 if ( (addr2info(dest) != NULL)
379 #ifdef CONFIG_HAS_DATAFLASH
380 && (!addr_dataflash(dest))
385 puts ("Copy to Flash... ");
387 rc = flash_write ((char *)addr, dest, count*size);
397 #ifdef CONFIG_HAS_DATAFLASH
398 /* Check if we are copying from RAM or Flash to DataFlash */
399 if (addr_dataflash(dest) && !addr_dataflash(addr)){
402 puts ("Copy to DataFlash... ");
404 rc = write_dataflash (dest, addr, count*size);
407 dataflash_perror (rc);
414 /* Check if we are copying from DataFlash to RAM */
415 if (addr_dataflash(addr) && !addr_dataflash(dest)
416 #ifndef CONFIG_SYS_NO_FLASH
417 && (addr2info(dest) == NULL)
421 rc = read_dataflash(addr, count * size, (char *) dest);
423 dataflash_perror (rc);
429 if (addr_dataflash(addr) && addr_dataflash(dest)){
430 puts ("Unsupported combination of source/destination.\n\r");
435 #ifdef CONFIG_BLACKFIN
436 /* See if we're copying to/from L1 inst */
437 if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) {
438 memcpy((void *)dest, (void *)addr, count * size);
443 bytes = size * count;
444 buf = map_sysmem(addr, bytes);
445 src = map_sysmem(addr, bytes);
446 while (count-- > 0) {
448 *((ulong *)buf) = *((ulong *)src);
450 *((ushort *)buf) = *((ushort *)src);
452 *((u_char *)buf) = *((u_char *)src);
456 /* reset watchdog from time to time */
457 if ((count % (64 << 10)) == 0)
463 static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
467 /* Set new base address.
469 base_address = simple_strtoul(argv[1], NULL, 16);
471 /* Print the current base address.
473 printf("Base Address: 0x%08lx\n", base_address);
477 static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
480 ulong addr, length, i, bytes;
482 volatile uint *longp;
483 volatile ushort *shortp;
488 return CMD_RET_USAGE;
491 * Check for a size specification.
492 * Defaults to long if no or incorrect specification.
494 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
497 /* Address is always specified.
499 addr = simple_strtoul(argv[1], NULL, 16);
501 /* Length is the number of objects, not number of bytes.
503 length = simple_strtoul(argv[2], NULL, 16);
505 bytes = size * length;
506 buf = map_sysmem(addr, bytes);
508 /* We want to optimize the loops to run as fast as possible.
509 * If we have only one object, just run infinite loops.
518 shortp = (ushort *)buf;
537 shortp = (ushort *)buf;
553 int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
555 ulong addr, length, i, data, bytes;
557 volatile uint *longp;
558 volatile ushort *shortp;
563 return CMD_RET_USAGE;
566 * Check for a size specification.
567 * Defaults to long if no or incorrect specification.
569 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
572 /* Address is always specified.
574 addr = simple_strtoul(argv[1], NULL, 16);
576 /* Length is the number of objects, not number of bytes.
578 length = simple_strtoul(argv[2], NULL, 16);
581 data = simple_strtoul(argv[3], NULL, 16);
583 bytes = size * length;
584 buf = map_sysmem(addr, bytes);
586 /* We want to optimize the loops to run as fast as possible.
587 * If we have only one object, just run infinite loops.
596 shortp = (ushort *)buf;
615 shortp = (ushort *)buf;
628 #endif /* CONFIG_LOOPW */
630 static ulong mem_test_alt(ulong start_addr, ulong end_addr)
632 vu_long *start, *end;
642 vu_long anti_pattern;
644 #if defined(CONFIG_SYS_MEMTEST_SCRATCH)
645 vu_long *dummy = (vu_long *)CONFIG_SYS_MEMTEST_SCRATCH;
647 vu_long *dummy = NULL; /* yes, this is address 0x0, not NULL */
649 static const ulong bitpattern[] = {
650 0x00000001, /* single bit */
651 0x00000003, /* two adjacent bits */
652 0x00000007, /* three adjacent bits */
653 0x0000000F, /* four adjacent bits */
654 0x00000005, /* two non-adjacent bits */
655 0x00000015, /* three non-adjacent bits */
656 0x00000055, /* four non-adjacent bits */
657 0xaaaaaaaa, /* alternating 1/0 */
660 start = (vu_long *)start_addr;
661 end = (vu_long *)end_addr;
664 * Data line test: write a pattern to the first
665 * location, write the 1's complement to a 'parking'
666 * address (changes the state of the data bus so a
667 * floating bus doesn't give a false OK), and then
668 * read the value back. Note that we read it back
669 * into a variable because the next time we read it,
670 * it might be right (been there, tough to explain to
671 * the quality guys why it prints a failure when the
672 * "is" and "should be" are obviously the same in the
675 * Rather than exhaustively testing, we test some
676 * patterns by shifting '1' bits through a field of
677 * '0's and '0' bits through a field of '1's (i.e.
678 * pattern and ~pattern).
681 for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) {
683 for (; val != 0; val <<= 1) {
685 *dummy = ~val; /* clear the test data off the bus */
687 if (readback != val) {
688 printf("FAILURE (data line): "
689 "expected %08lx, actual %08lx\n",
698 if (readback != ~val) {
699 printf("FAILURE (data line): "
700 "Is %08lx, should be %08lx\n",
710 * Based on code whose Original Author and Copyright
711 * information follows: Copyright (c) 1998 by Michael
712 * Barr. This software is placed into the public
713 * domain and may be used for any purpose. However,
714 * this notice must not be changed or removed and no
715 * warranty is either expressed or implied by its
716 * publication or distribution.
722 * Description: Test the address bus wiring in a
723 * memory region by performing a walking
724 * 1's test on the relevant bits of the
725 * address and checking for aliasing.
726 * This test will find single-bit
727 * address failures such as stuck-high,
728 * stuck-low, and shorted pins. The base
729 * address and size of the region are
730 * selected by the caller.
732 * Notes: For best results, the selected base
733 * address should have enough LSB 0's to
734 * guarantee single address bit changes.
735 * For example, to test a 64-Kbyte
736 * region, select a base address on a
737 * 64-Kbyte boundary. Also, select the
738 * region size as a power-of-two if at
741 * Returns: 0 if the test succeeds, 1 if the test fails.
743 len = (end_addr - start_addr) / sizeof(vu_long);
744 pattern = (vu_long) 0xaaaaaaaa;
745 anti_pattern = (vu_long) 0x55555555;
747 debug("%s:%d: length = 0x%.8lx\n",
748 __func__, __LINE__, len);
750 * Write the default pattern at each of the
751 * power-of-two offsets.
753 for (offset = 1; offset < len; offset <<= 1)
754 start[offset] = pattern;
757 * Check for address bits stuck high.
760 start[test_offset] = anti_pattern;
762 for (offset = 1; offset < len; offset <<= 1) {
763 temp = start[offset];
764 if (temp != pattern) {
765 printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
766 " expected 0x%.8lx, actual 0x%.8lx\n",
767 (ulong)&start[offset], pattern, temp);
773 start[test_offset] = pattern;
777 * Check for addr bits stuck low or shorted.
779 for (test_offset = 1; test_offset < len; test_offset <<= 1) {
780 start[test_offset] = anti_pattern;
782 for (offset = 1; offset < len; offset <<= 1) {
783 temp = start[offset];
784 if ((temp != pattern) && (offset != test_offset)) {
785 printf("\nFAILURE: Address bit stuck low or"
786 " shorted @ 0x%.8lx: expected 0x%.8lx,"
788 (ulong)&start[offset], pattern, temp);
794 start[test_offset] = pattern;
798 * Description: Test the integrity of a physical
799 * memory device by performing an
800 * increment/decrement test over the
801 * entire region. In the process every
802 * storage bit in the device is tested
803 * as a zero and a one. The base address
804 * and the size of the region are
805 * selected by the caller.
807 * Returns: 0 if the test succeeds, 1 if the test fails.
809 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
812 * Fill memory with a known pattern.
814 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
816 start[offset] = pattern;
820 * Check each location and invert it for the second pass.
822 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
824 temp = start[offset];
825 if (temp != pattern) {
826 printf("\nFAILURE (read/write) @ 0x%.8lx:"
827 " expected 0x%.8lx, actual 0x%.8lx)\n",
828 (ulong)&start[offset], pattern, temp);
834 anti_pattern = ~pattern;
835 start[offset] = anti_pattern;
839 * Check each location for the inverted pattern and zero it.
841 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
843 anti_pattern = ~pattern;
844 temp = start[offset];
845 if (temp != anti_pattern) {
846 printf("\nFAILURE (read/write): @ 0x%.8lx:"
847 " expected 0x%.8lx, actual 0x%.8lx)\n",
848 (ulong)&start[offset], anti_pattern, temp);
859 static ulong mem_test_quick(ulong start_addr, ulong end_addr, vu_long pattern,
862 vu_long *start, *end;
868 /* Alternate the pattern */
873 * Flip the pattern each time to make lots of zeros and
874 * then, the next time, lots of ones. We decrement
875 * the "negative" patterns and increment the "positive"
876 * patterns to preserve this feature.
878 if (pattern & 0x80000000)
879 pattern = -pattern; /* complement & increment */
883 start = (vu_long *)start_addr;
884 end = (vu_long *)end_addr;
885 printf("\rPattern %08lX Writing..."
887 "\b\b\b\b\b\b\b\b\b\b",
890 for (addr = start, val = pattern; addr < end; addr++) {
898 for (addr = start, val = pattern; addr < end; addr++) {
901 if (readback != val) {
902 printf("\nMem error @ 0x%08X: "
903 "found %08lX, expected %08lX\n",
904 (uint)(uintptr_t)addr, readback, val);
916 * Perform a memory test. A more complete alternative test can be
917 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
918 * interrupted by ctrl-c or by a failure of one of the sub-tests.
920 static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
926 ulong errs = 0; /* number of errors, or -1 if interrupted */
929 #if defined(CONFIG_SYS_ALT_MEMTEST)
930 const int alt_test = 1;
932 const int alt_test = 0;
936 start = simple_strtoul(argv[1], NULL, 16);
938 start = CONFIG_SYS_MEMTEST_START;
941 end = simple_strtoul(argv[2], NULL, 16);
943 end = CONFIG_SYS_MEMTEST_END;
946 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
951 iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16);
955 printf("Testing %08x ... %08x:\n", (uint)start, (uint)end);
956 debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__,
960 !iteration_limit || iteration < iteration_limit;
967 printf("Iteration: %6d\r", iteration + 1);
970 errs = mem_test_alt(start, end);
972 errs = mem_test_quick(start, end, pattern, iteration);
976 /* Memory test was aborted - write a newline to finish off */
980 printf("Tested %d iteration(s) with %lu errors.\n",
985 return ret; /* not reached */
992 * mm{.b, .w, .l} {addr}
993 * nm{.b, .w, .l} {addr}
996 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
1003 return CMD_RET_USAGE;
1005 #ifdef CONFIG_BOOT_RETRY_TIME
1006 reset_cmd_timeout(); /* got a good command to get here */
1008 /* We use the last specified parameters, unless new ones are
1011 addr = mm_last_addr;
1012 size = mm_last_size;
1014 if ((flag & CMD_FLAG_REPEAT) == 0) {
1015 /* New command specified. Check for a size specification.
1016 * Defaults to long if no or incorrect specification.
1018 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1021 /* Address is specified since argc > 1
1023 addr = simple_strtoul(argv[1], NULL, 16);
1024 addr += base_address;
1027 #ifdef CONFIG_HAS_DATAFLASH
1028 if (addr_dataflash(addr)){
1029 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
1034 #ifdef CONFIG_BLACKFIN
1035 if (addr_bfin_on_chip_mem(addr)) {
1036 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
1041 /* Print the address, followed by value. Then accept input for
1042 * the next value. A non-converted value exits.
1045 ptr = map_sysmem(addr, size);
1046 printf("%08lx:", addr);
1048 printf(" %08x", *((uint *)ptr));
1050 printf(" %04x", *((ushort *)ptr));
1052 printf(" %02x", *((u_char *)ptr));
1054 nbytes = readline (" ? ");
1055 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1056 /* <CR> pressed as only input, don't modify current
1057 * location and move to next. "-" pressed will go back.
1060 addr += nbytes ? -size : size;
1062 #ifdef CONFIG_BOOT_RETRY_TIME
1063 reset_cmd_timeout(); /* good enough to not time out */
1066 #ifdef CONFIG_BOOT_RETRY_TIME
1067 else if (nbytes == -2) {
1068 break; /* timed out, exit the command */
1073 i = simple_strtoul(console_buffer, &endp, 16);
1074 nbytes = endp - console_buffer;
1076 #ifdef CONFIG_BOOT_RETRY_TIME
1077 /* good enough to not time out
1079 reset_cmd_timeout();
1084 *((ushort *)ptr) = i;
1086 *((u_char *)ptr) = i;
1095 mm_last_addr = addr;
1096 mm_last_size = size;
1100 #ifdef CONFIG_CMD_CRC32
1102 static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1109 return CMD_RET_USAGE;
1113 #ifdef CONFIG_HASH_VERIFY
1114 if (strcmp(*av, "-v") == 0) {
1115 flags |= HASH_FLAG_VERIFY;
1121 return hash_command("crc32", flags, cmdtp, flag, ac, av);
1126 /**************************************************/
1128 md, 3, 1, do_mem_md,
1130 "[.b, .w, .l] address [# of objects]"
1135 mm, 2, 1, do_mem_mm,
1136 "memory modify (auto-incrementing address)",
1137 "[.b, .w, .l] address"
1142 nm, 2, 1, do_mem_nm,
1143 "memory modify (constant address)",
1144 "[.b, .w, .l] address"
1148 mw, 4, 1, do_mem_mw,
1149 "memory write (fill)",
1150 "[.b, .w, .l] address value [count]"
1154 cp, 4, 1, do_mem_cp,
1156 "[.b, .w, .l] source target count"
1160 cmp, 4, 1, do_mem_cmp,
1162 "[.b, .w, .l] addr1 addr2 count"
1165 #ifdef CONFIG_CMD_CRC32
1167 #ifndef CONFIG_CRC32_VERIFY
1170 crc32, 4, 1, do_mem_crc,
1171 "checksum calculation",
1172 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1175 #else /* CONFIG_CRC32_VERIFY */
1178 crc32, 5, 1, do_mem_crc,
1179 "checksum calculation",
1180 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1181 "-v address count crc\n - verify crc of memory area"
1184 #endif /* CONFIG_CRC32_VERIFY */
1188 #ifdef CONFIG_CMD_MEMINFO
1189 __weak void board_show_dram(ulong size)
1192 print_size(size, "\n");
1195 static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
1196 char * const argv[])
1198 board_show_dram(gd->ram_size);
1205 base, 2, 1, do_mem_base,
1206 "print or set address offset",
1207 "\n - print address offset for memory commands\n"
1208 "base off\n - set address offset for memory commands to 'off'"
1212 loop, 3, 1, do_mem_loop,
1213 "infinite loop on address range",
1214 "[.b, .w, .l] address number_of_objects"
1219 loopw, 4, 1, do_mem_loopw,
1220 "infinite write loop on address range",
1221 "[.b, .w, .l] address number_of_objects data_to_write"
1223 #endif /* CONFIG_LOOPW */
1226 mtest, 5, 1, do_mem_mtest,
1227 "simple RAM read/write test",
1228 "[start [end [pattern [iterations]]]]"
1231 #ifdef CONFIG_MX_CYCLIC
1233 mdc, 4, 1, do_mem_mdc,
1234 "memory display cyclic",
1235 "[.b, .w, .l] address count delay(ms)"
1239 mwc, 4, 1, do_mem_mwc,
1240 "memory write cyclic",
1241 "[.b, .w, .l] address value delay(ms)"
1243 #endif /* CONFIG_MX_CYCLIC */
1245 #ifdef CONFIG_CMD_MEMINFO
1247 meminfo, 3, 1, do_mem_info,
1248 "display memory information",