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>
36 #include <linux/compiler.h>
38 DECLARE_GLOBAL_DATA_PTR;
40 static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
42 /* Display values from last command.
43 * Memory modify remembered values are different from display memory.
45 static uint dp_last_addr, dp_last_size;
46 static uint dp_last_length = 0x40;
47 static uint mm_last_addr, mm_last_size;
49 static ulong base_address = 0;
54 * md{.b, .w, .l} {addr} {len}
56 #define DISP_LINE_LEN 16
57 static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
60 #if defined(CONFIG_HAS_DATAFLASH)
61 ulong nbytes, linebytes;
66 /* We use the last specified parameters, unless new ones are
71 length = dp_last_length;
76 if ((flag & CMD_FLAG_REPEAT) == 0) {
77 /* New command specified. Check for a size specification.
78 * Defaults to long if no or incorrect specification.
80 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
83 /* Address is specified since argc > 1
85 addr = simple_strtoul(argv[1], NULL, 16);
88 /* If another parameter, it is the length to display.
89 * Length is the number of objects, not number of bytes.
92 length = simple_strtoul(argv[2], NULL, 16);
95 #if defined(CONFIG_HAS_DATAFLASH)
98 * We buffer all read data, so we can make sure data is read only
99 * once, and all accesses are with the specified bus width.
101 nbytes = length * size;
103 char linebuf[DISP_LINE_LEN];
105 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
107 rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
108 p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
109 print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
117 } while (nbytes > 0);
120 # if defined(CONFIG_BLACKFIN)
121 /* See if we're trying to display L1 inst */
122 if (addr_bfin_on_chip_mem(addr)) {
123 char linebuf[DISP_LINE_LEN];
124 ulong linebytes, nbytes = length * size;
126 linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
127 memcpy(linebuf, (void *)addr, linebytes);
128 print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size);
136 } while (nbytes > 0);
141 /* Print the lines. */
142 print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
148 dp_last_length = length;
153 static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
155 return mod_mem (cmdtp, 1, flag, argc, argv);
157 static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
159 return mod_mem (cmdtp, 0, flag, argc, argv);
162 static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
164 ulong addr, writeval, count;
167 if ((argc < 3) || (argc > 4))
168 return CMD_RET_USAGE;
170 /* Check for size specification.
172 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
175 /* Address is specified since argc > 1
177 addr = simple_strtoul(argv[1], NULL, 16);
178 addr += base_address;
180 /* Get the value to write.
182 writeval = simple_strtoul(argv[2], NULL, 16);
186 count = simple_strtoul(argv[3], NULL, 16);
191 while (count-- > 0) {
193 *((ulong *)addr) = (ulong )writeval;
195 *((ushort *)addr) = (ushort)writeval;
197 *((u_char *)addr) = (u_char)writeval;
203 #ifdef CONFIG_MX_CYCLIC
204 int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
210 return CMD_RET_USAGE;
212 count = simple_strtoul(argv[3], NULL, 10);
215 do_mem_md (NULL, 0, 3, argv);
217 /* delay for <count> ms... */
218 for (i=0; i<count; i++)
221 /* check for ctrl-c to abort... */
231 int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
237 return CMD_RET_USAGE;
239 count = simple_strtoul(argv[3], NULL, 10);
242 do_mem_mw (NULL, 0, 3, argv);
244 /* delay for <count> ms... */
245 for (i=0; i<count; i++)
248 /* check for ctrl-c to abort... */
257 #endif /* CONFIG_MX_CYCLIC */
259 static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
261 ulong addr1, addr2, count, ngood;
267 return CMD_RET_USAGE;
269 /* Check for size specification.
271 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
273 type = size == 4 ? "word" : size == 2 ? "halfword" : "byte";
275 addr1 = simple_strtoul(argv[1], NULL, 16);
276 addr1 += base_address;
278 addr2 = simple_strtoul(argv[2], NULL, 16);
279 addr2 += base_address;
281 count = simple_strtoul(argv[3], NULL, 16);
283 #ifdef CONFIG_HAS_DATAFLASH
284 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
285 puts ("Comparison with DataFlash space not supported.\n\r");
290 #ifdef CONFIG_BLACKFIN
291 if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) {
292 puts ("Comparison with L1 instruction memory not supported.\n\r");
297 for (ngood = 0; ngood < count; ++ngood) {
300 word1 = *(ulong *)addr1;
301 word2 = *(ulong *)addr2;
302 } else if (size == 2) {
303 word1 = *(ushort *)addr1;
304 word2 = *(ushort *)addr2;
306 word1 = *(u_char *)addr1;
307 word2 = *(u_char *)addr2;
309 if (word1 != word2) {
310 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
311 type, addr1, size, word1,
312 type, addr2, size, word2);
320 /* reset watchdog from time to time */
321 if ((ngood % (64 << 10)) == 0)
325 printf("Total of %ld %s(s) were the same\n", ngood, type);
329 static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
331 ulong addr, dest, count;
335 return CMD_RET_USAGE;
337 /* Check for size specification.
339 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
342 addr = simple_strtoul(argv[1], NULL, 16);
343 addr += base_address;
345 dest = simple_strtoul(argv[2], NULL, 16);
346 dest += base_address;
348 count = simple_strtoul(argv[3], NULL, 16);
351 puts ("Zero length ???\n");
355 #ifndef CONFIG_SYS_NO_FLASH
356 /* check if we are copying to Flash */
357 if ( (addr2info(dest) != NULL)
358 #ifdef CONFIG_HAS_DATAFLASH
359 && (!addr_dataflash(dest))
364 puts ("Copy to Flash... ");
366 rc = flash_write ((char *)addr, dest, count*size);
376 #ifdef CONFIG_HAS_DATAFLASH
377 /* Check if we are copying from RAM or Flash to DataFlash */
378 if (addr_dataflash(dest) && !addr_dataflash(addr)){
381 puts ("Copy to DataFlash... ");
383 rc = write_dataflash (dest, addr, count*size);
386 dataflash_perror (rc);
393 /* Check if we are copying from DataFlash to RAM */
394 if (addr_dataflash(addr) && !addr_dataflash(dest)
395 #ifndef CONFIG_SYS_NO_FLASH
396 && (addr2info(dest) == NULL)
400 rc = read_dataflash(addr, count * size, (char *) dest);
402 dataflash_perror (rc);
408 if (addr_dataflash(addr) && addr_dataflash(dest)){
409 puts ("Unsupported combination of source/destination.\n\r");
414 #ifdef CONFIG_BLACKFIN
415 /* See if we're copying to/from L1 inst */
416 if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) {
417 memcpy((void *)dest, (void *)addr, count * size);
422 while (count-- > 0) {
424 *((ulong *)dest) = *((ulong *)addr);
426 *((ushort *)dest) = *((ushort *)addr);
428 *((u_char *)dest) = *((u_char *)addr);
432 /* reset watchdog from time to time */
433 if ((count % (64 << 10)) == 0)
439 static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
443 /* Set new base address.
445 base_address = simple_strtoul(argv[1], NULL, 16);
447 /* Print the current base address.
449 printf("Base Address: 0x%08lx\n", base_address);
453 static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
456 ulong addr, length, i;
458 volatile uint *longp;
459 volatile ushort *shortp;
463 return CMD_RET_USAGE;
465 /* Check for a size spefication.
466 * Defaults to long if no or incorrect specification.
468 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
471 /* Address is always specified.
473 addr = simple_strtoul(argv[1], NULL, 16);
475 /* Length is the number of objects, not number of bytes.
477 length = simple_strtoul(argv[2], NULL, 16);
479 /* We want to optimize the loops to run as fast as possible.
480 * If we have only one object, just run infinite loops.
484 longp = (uint *)addr;
489 shortp = (ushort *)addr;
500 longp = (uint *)addr;
508 shortp = (ushort *)addr;
523 int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
525 ulong addr, length, i, data;
527 volatile uint *longp;
528 volatile ushort *shortp;
532 return CMD_RET_USAGE;
534 /* Check for a size spefication.
535 * Defaults to long if no or incorrect specification.
537 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
540 /* Address is always specified.
542 addr = simple_strtoul(argv[1], NULL, 16);
544 /* Length is the number of objects, not number of bytes.
546 length = simple_strtoul(argv[2], NULL, 16);
549 data = simple_strtoul(argv[3], NULL, 16);
551 /* We want to optimize the loops to run as fast as possible.
552 * If we have only one object, just run infinite loops.
556 longp = (uint *)addr;
561 shortp = (ushort *)addr;
572 longp = (uint *)addr;
580 shortp = (ushort *)addr;
593 #endif /* CONFIG_LOOPW */
596 * Perform a memory test. A more complete alternative test can be
597 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
598 * interrupted by ctrl-c or by a failure of one of the sub-tests.
600 static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
603 vu_long *addr, *start, *end;
610 #if defined(CONFIG_SYS_ALT_MEMTEST)
616 vu_long anti_pattern;
618 #if defined(CONFIG_SYS_MEMTEST_SCRATCH)
619 vu_long *dummy = (vu_long*)CONFIG_SYS_MEMTEST_SCRATCH;
621 vu_long *dummy = NULL; /* yes, this is address 0x0, not NULL */
625 static const ulong bitpattern[] = {
626 0x00000001, /* single bit */
627 0x00000003, /* two adjacent bits */
628 0x00000007, /* three adjacent bits */
629 0x0000000F, /* four adjacent bits */
630 0x00000005, /* two non-adjacent bits */
631 0x00000015, /* three non-adjacent bits */
632 0x00000055, /* four non-adjacent bits */
633 0xaaaaaaaa, /* alternating 1/0 */
641 start = (ulong *)simple_strtoul(argv[1], NULL, 16);
643 start = (ulong *)CONFIG_SYS_MEMTEST_START;
646 end = (ulong *)simple_strtoul(argv[2], NULL, 16);
648 end = (ulong *)(CONFIG_SYS_MEMTEST_END);
651 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
656 iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16);
660 #if defined(CONFIG_SYS_ALT_MEMTEST)
661 printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
662 debug("%s:%d: start 0x%p end 0x%p\n",
663 __FUNCTION__, __LINE__, start, end);
672 if (iteration_limit && iterations > iteration_limit) {
673 printf("Tested %d iteration(s) with %lu errors.\n",
678 printf("Iteration: %6d\r", iterations);
683 * Data line test: write a pattern to the first
684 * location, write the 1's complement to a 'parking'
685 * address (changes the state of the data bus so a
686 * floating bus doen't give a false OK), and then
687 * read the value back. Note that we read it back
688 * into a variable because the next time we read it,
689 * it might be right (been there, tough to explain to
690 * the quality guys why it prints a failure when the
691 * "is" and "should be" are obviously the same in the
694 * Rather than exhaustively testing, we test some
695 * patterns by shifting '1' bits through a field of
696 * '0's and '0' bits through a field of '1's (i.e.
697 * pattern and ~pattern).
700 for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
702 for(; val != 0; val <<= 1) {
704 *dummy = ~val; /* clear the test data off of the bus */
706 if(readback != val) {
707 printf ("FAILURE (data line): "
708 "expected %08lx, actual %08lx\n",
719 if(readback != ~val) {
720 printf ("FAILURE (data line): "
721 "Is %08lx, should be %08lx\n",
733 * Based on code whose Original Author and Copyright
734 * information follows: Copyright (c) 1998 by Michael
735 * Barr. This software is placed into the public
736 * domain and may be used for any purpose. However,
737 * this notice must not be changed or removed and no
738 * warranty is either expressed or implied by its
739 * publication or distribution.
745 * Description: Test the address bus wiring in a
746 * memory region by performing a walking
747 * 1's test on the relevant bits of the
748 * address and checking for aliasing.
749 * This test will find single-bit
750 * address failures such as stuck -high,
751 * stuck-low, and shorted pins. The base
752 * address and size of the region are
753 * selected by the caller.
755 * Notes: For best results, the selected base
756 * address should have enough LSB 0's to
757 * guarantee single address bit changes.
758 * For example, to test a 64-Kbyte
759 * region, select a base address on a
760 * 64-Kbyte boundary. Also, select the
761 * region size as a power-of-two if at
764 * Returns: 0 if the test succeeds, 1 if the test fails.
766 len = ((ulong)end - (ulong)start)/sizeof(vu_long);
767 pattern = (vu_long) 0xaaaaaaaa;
768 anti_pattern = (vu_long) 0x55555555;
770 debug("%s:%d: length = 0x%.8lx\n",
771 __FUNCTION__, __LINE__,
774 * Write the default pattern at each of the
775 * power-of-two offsets.
777 for (offset = 1; offset < len; offset <<= 1) {
778 start[offset] = pattern;
782 * Check for address bits stuck high.
785 start[test_offset] = anti_pattern;
787 for (offset = 1; offset < len; offset <<= 1) {
788 temp = start[offset];
789 if (temp != pattern) {
790 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
791 " expected 0x%.8lx, actual 0x%.8lx\n",
792 (ulong)&start[offset], pattern, temp);
800 start[test_offset] = pattern;
804 * Check for addr bits stuck low or shorted.
806 for (test_offset = 1; test_offset < len; test_offset <<= 1) {
807 start[test_offset] = anti_pattern;
809 for (offset = 1; offset < len; offset <<= 1) {
810 temp = start[offset];
811 if ((temp != pattern) && (offset != test_offset)) {
812 printf ("\nFAILURE: Address bit stuck low or shorted @"
813 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
814 (ulong)&start[offset], pattern, temp);
822 start[test_offset] = pattern;
826 * Description: Test the integrity of a physical
827 * memory device by performing an
828 * increment/decrement test over the
829 * entire region. In the process every
830 * storage bit in the device is tested
831 * as a zero and a one. The base address
832 * and the size of the region are
833 * selected by the caller.
835 * Returns: 0 if the test succeeds, 1 if the test fails.
837 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
840 * Fill memory with a known pattern.
842 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
844 start[offset] = pattern;
848 * Check each location and invert it for the second pass.
850 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
852 temp = start[offset];
853 if (temp != pattern) {
854 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
855 " expected 0x%.8lx, actual 0x%.8lx)\n",
856 (ulong)&start[offset], pattern, temp);
864 anti_pattern = ~pattern;
865 start[offset] = anti_pattern;
869 * Check each location for the inverted pattern and zero it.
871 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
873 anti_pattern = ~pattern;
874 temp = start[offset];
875 if (temp != anti_pattern) {
876 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
877 " expected 0x%.8lx, actual 0x%.8lx)\n",
878 (ulong)&start[offset], anti_pattern, temp);
889 #else /* The original, quickie test */
897 if (iteration_limit && iterations > iteration_limit) {
898 printf("Tested %d iteration(s) with %lu errors.\n",
904 printf ("\rPattern %08lX Writing..."
906 "\b\b\b\b\b\b\b\b\b\b",
909 for (addr=start,val=pattern; addr<end; addr++) {
917 for (addr=start,val=pattern; addr<end; addr++) {
920 if (readback != val) {
921 printf ("\nMem error @ 0x%08X: "
922 "found %08lX, expected %08lX\n",
923 (uint)(uintptr_t)addr, readback, val);
934 * Flip the pattern each time to make lots of zeros and
935 * then, the next time, lots of ones. We decrement
936 * the "negative" patterns and increment the "positive"
937 * patterns to preserve this feature.
939 if(pattern & 0x80000000) {
940 pattern = -pattern; /* complement & increment */
948 return 0; /* not reached */
955 * mm{.b, .w, .l} {addr}
956 * nm{.b, .w, .l} {addr}
959 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
965 return CMD_RET_USAGE;
967 #ifdef CONFIG_BOOT_RETRY_TIME
968 reset_cmd_timeout(); /* got a good command to get here */
970 /* We use the last specified parameters, unless new ones are
976 if ((flag & CMD_FLAG_REPEAT) == 0) {
977 /* New command specified. Check for a size specification.
978 * Defaults to long if no or incorrect specification.
980 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
983 /* Address is specified since argc > 1
985 addr = simple_strtoul(argv[1], NULL, 16);
986 addr += base_address;
989 #ifdef CONFIG_HAS_DATAFLASH
990 if (addr_dataflash(addr)){
991 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
996 #ifdef CONFIG_BLACKFIN
997 if (addr_bfin_on_chip_mem(addr)) {
998 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
1003 /* Print the address, followed by value. Then accept input for
1004 * the next value. A non-converted value exits.
1007 printf("%08lx:", addr);
1009 printf(" %08x", *((uint *)addr));
1011 printf(" %04x", *((ushort *)addr));
1013 printf(" %02x", *((u_char *)addr));
1015 nbytes = readline (" ? ");
1016 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1017 /* <CR> pressed as only input, don't modify current
1018 * location and move to next. "-" pressed will go back.
1021 addr += nbytes ? -size : size;
1023 #ifdef CONFIG_BOOT_RETRY_TIME
1024 reset_cmd_timeout(); /* good enough to not time out */
1027 #ifdef CONFIG_BOOT_RETRY_TIME
1028 else if (nbytes == -2) {
1029 break; /* timed out, exit the command */
1034 i = simple_strtoul(console_buffer, &endp, 16);
1035 nbytes = endp - console_buffer;
1037 #ifdef CONFIG_BOOT_RETRY_TIME
1038 /* good enough to not time out
1040 reset_cmd_timeout();
1043 *((uint *)addr) = i;
1045 *((ushort *)addr) = i;
1047 *((u_char *)addr) = i;
1054 mm_last_addr = addr;
1055 mm_last_size = size;
1059 #ifdef CONFIG_CMD_CRC32
1061 #ifndef CONFIG_CRC32_VERIFY
1063 static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1070 return CMD_RET_USAGE;
1072 addr = simple_strtoul (argv[1], NULL, 16);
1073 addr += base_address;
1075 length = simple_strtoul (argv[2], NULL, 16);
1077 crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32);
1079 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1080 addr, addr + length - 1, crc);
1083 ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
1090 #else /* CONFIG_CRC32_VERIFY */
1092 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1104 return CMD_RET_USAGE;
1109 if (strcmp(*av, "-v") == 0) {
1118 addr = simple_strtoul(*av++, NULL, 16);
1119 addr += base_address;
1120 length = simple_strtoul(*av++, NULL, 16);
1122 crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32);
1125 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1126 addr, addr + length - 1, crc);
1128 ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
1132 vcrc = simple_strtoul(*av++, NULL, 16);
1134 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1135 addr, addr + length - 1, crc, vcrc);
1143 #endif /* CONFIG_CRC32_VERIFY */
1147 /**************************************************/
1149 md, 3, 1, do_mem_md,
1151 "[.b, .w, .l] address [# of objects]"
1156 mm, 2, 1, do_mem_mm,
1157 "memory modify (auto-incrementing address)",
1158 "[.b, .w, .l] address"
1163 nm, 2, 1, do_mem_nm,
1164 "memory modify (constant address)",
1165 "[.b, .w, .l] address"
1169 mw, 4, 1, do_mem_mw,
1170 "memory write (fill)",
1171 "[.b, .w, .l] address value [count]"
1175 cp, 4, 1, do_mem_cp,
1177 "[.b, .w, .l] source target count"
1181 cmp, 4, 1, do_mem_cmp,
1183 "[.b, .w, .l] addr1 addr2 count"
1186 #ifdef CONFIG_CMD_CRC32
1188 #ifndef CONFIG_CRC32_VERIFY
1191 crc32, 4, 1, do_mem_crc,
1192 "checksum calculation",
1193 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1196 #else /* CONFIG_CRC32_VERIFY */
1199 crc32, 5, 1, do_mem_crc,
1200 "checksum calculation",
1201 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1202 "-v address count crc\n - verify crc of memory area"
1205 #endif /* CONFIG_CRC32_VERIFY */
1209 #ifdef CONFIG_CMD_MEMINFO
1210 __weak void board_show_dram(ulong size)
1213 print_size(size, "\n");
1216 static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
1217 char * const argv[])
1219 board_show_dram(gd->ram_size);
1226 base, 2, 1, do_mem_base,
1227 "print or set address offset",
1228 "\n - print address offset for memory commands\n"
1229 "base off\n - set address offset for memory commands to 'off'"
1233 loop, 3, 1, do_mem_loop,
1234 "infinite loop on address range",
1235 "[.b, .w, .l] address number_of_objects"
1240 loopw, 4, 1, do_mem_loopw,
1241 "infinite write loop on address range",
1242 "[.b, .w, .l] address number_of_objects data_to_write"
1244 #endif /* CONFIG_LOOPW */
1247 mtest, 5, 1, do_mem_mtest,
1248 "simple RAM read/write test",
1249 "[start [end [pattern [iterations]]]]"
1252 #ifdef CONFIG_MX_CYCLIC
1254 mdc, 4, 1, do_mem_mdc,
1255 "memory display cyclic",
1256 "[.b, .w, .l] address count delay(ms)"
1260 mwc, 4, 1, do_mem_mwc,
1261 "memory write cyclic",
1262 "[.b, .w, .l] address value delay(ms)"
1264 #endif /* CONFIG_MX_CYCLIC */
1266 #ifdef CONFIG_CMD_MEMINFO
1268 meminfo, 3, 1, do_mem_info,
1269 "display memory information",