blob: 4740664173dec4ecb44b1fc5ed67814507a7d8f5 [file] [log] [blame]
wdenk38635852002-08-27 05:55:31 +00001/*
2 * (C) Copyright 2000
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
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.
12 *
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.
17 *
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,
21 * MA 02111-1307 USA
22 */
23
24/*
25 * Memory Functions
26 *
27 * Copied from FADS ROM, Dan Malek (dmalek@jlc.net)
28 */
29
30#include <common.h>
31#include <command.h>
Jon Loeligerd76b5c12007-07-08 18:02:23 -050032#if defined(CONFIG_CMD_MMC)
wdenk7a428cc2003-06-15 22:40:42 +000033#include <mmc.h>
34#endif
wdenk381669a2003-06-16 23:50:08 +000035#ifdef CONFIG_HAS_DATAFLASH
36#include <dataflash.h>
37#endif
Sergei Poselenov474dbb82008-04-09 16:09:41 +020038#include <watchdog.h>
wdenk38635852002-08-27 05:55:31 +000039
Jon Loeligerd76b5c12007-07-08 18:02:23 -050040#if defined(CONFIG_CMD_MEMORY) \
Jon Loeliger3de8b242007-06-11 19:01:54 -050041 || defined(CONFIG_CMD_I2C) \
42 || defined(CONFIG_CMD_ITEST) \
43 || defined(CONFIG_CMD_PCI) \
44 || defined(CONFIG_CMD_PORTIO)
45
wdenk38635852002-08-27 05:55:31 +000046int cmd_get_data_size(char* arg, int default_size)
47{
48 /* Check for a size specification .b, .w or .l.
49 */
50 int len = strlen(arg);
51 if (len > 2 && arg[len-2] == '.') {
52 switch(arg[len-1]) {
53 case 'b':
54 return 1;
55 case 'w':
56 return 2;
57 case 'l':
58 return 4;
wdenk2ebee312004-02-23 19:30:57 +000059 case 's':
60 return -2;
wdenk874ac262003-07-24 23:38:38 +000061 default:
62 return -1;
wdenk38635852002-08-27 05:55:31 +000063 }
64 }
65 return default_size;
66}
67#endif
68
Jon Loeligerd76b5c12007-07-08 18:02:23 -050069#if defined(CONFIG_CMD_MEMORY)
wdenk38635852002-08-27 05:55:31 +000070
71#ifdef CMD_MEM_DEBUG
72#define PRINTF(fmt,args...) printf (fmt ,##args)
73#else
74#define PRINTF(fmt,args...)
75#endif
76
77static int mod_mem(cmd_tbl_t *, int, int, int, char *[]);
78
79/* Display values from last command.
80 * Memory modify remembered values are different from display memory.
81 */
82uint dp_last_addr, dp_last_size;
83uint dp_last_length = 0x40;
84uint mm_last_addr, mm_last_size;
85
86static ulong base_address = 0;
87
88/* Memory Display
89 *
90 * Syntax:
91 * md{.b, .w, .l} {addr} {len}
92 */
93#define DISP_LINE_LEN 16
94int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
95{
wdenk874ac262003-07-24 23:38:38 +000096 ulong addr, length;
Grant Likely02a00782007-02-20 09:05:00 +010097#if defined(CONFIG_HAS_DATAFLASH)
98 ulong nbytes, linebytes;
99#endif
wdenk874ac262003-07-24 23:38:38 +0000100 int size;
wdenk38635852002-08-27 05:55:31 +0000101 int rc = 0;
102
103 /* We use the last specified parameters, unless new ones are
104 * entered.
105 */
106 addr = dp_last_addr;
107 size = dp_last_size;
108 length = dp_last_length;
109
110 if (argc < 2) {
111 printf ("Usage:\n%s\n", cmdtp->usage);
112 return 1;
113 }
114
115 if ((flag & CMD_FLAG_REPEAT) == 0) {
116 /* New command specified. Check for a size specification.
117 * Defaults to long if no or incorrect specification.
118 */
wdenk874ac262003-07-24 23:38:38 +0000119 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
120 return 1;
wdenk38635852002-08-27 05:55:31 +0000121
122 /* Address is specified since argc > 1
123 */
124 addr = simple_strtoul(argv[1], NULL, 16);
125 addr += base_address;
126
127 /* If another parameter, it is the length to display.
128 * Length is the number of objects, not number of bytes.
129 */
130 if (argc > 2)
131 length = simple_strtoul(argv[2], NULL, 16);
132 }
133
Grant Likely02a00782007-02-20 09:05:00 +0100134#if defined(CONFIG_HAS_DATAFLASH)
wdenk38635852002-08-27 05:55:31 +0000135 /* Print the lines.
136 *
137 * We buffer all read data, so we can make sure data is read only
138 * once, and all accesses are with the specified bus width.
139 */
140 nbytes = length * size;
141 do {
142 char linebuf[DISP_LINE_LEN];
Grant Likely02a00782007-02-20 09:05:00 +0100143 void* p;
wdenk38635852002-08-27 05:55:31 +0000144 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
wdenk381669a2003-06-16 23:50:08 +0000145
Grant Likely02a00782007-02-20 09:05:00 +0100146 rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
147 p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
148 print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
wdenk57b2d802003-06-27 21:31:46 +0000149
wdenk38635852002-08-27 05:55:31 +0000150 nbytes -= linebytes;
Grant Likely02a00782007-02-20 09:05:00 +0100151 addr += linebytes;
wdenk38635852002-08-27 05:55:31 +0000152 if (ctrlc()) {
153 rc = 1;
154 break;
155 }
156 } while (nbytes > 0);
Grant Likely02a00782007-02-20 09:05:00 +0100157#else
Mike Frysingere578d682008-02-04 19:26:56 -0500158
159# if defined(CONFIG_BLACKFIN)
160 /* See if we're trying to display L1 inst */
161 if (addr_bfin_on_chip_mem(addr)) {
162 char linebuf[DISP_LINE_LEN];
163 ulong linebytes, nbytes = length * size;
164 do {
165 linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
166 memcpy(linebuf, (void *)addr, linebytes);
167 print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size);
168
169 nbytes -= linebytes;
170 addr += linebytes;
171 if (ctrlc()) {
172 rc = 1;
173 break;
174 }
175 } while (nbytes > 0);
176 } else
177# endif
178
179 {
180 /* Print the lines. */
181 print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
182 addr += size*length;
183 }
Grant Likely02a00782007-02-20 09:05:00 +0100184#endif
wdenk38635852002-08-27 05:55:31 +0000185
186 dp_last_addr = addr;
187 dp_last_length = length;
188 dp_last_size = size;
189 return (rc);
190}
191
192int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
193{
194 return mod_mem (cmdtp, 1, flag, argc, argv);
195}
196int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
197{
198 return mod_mem (cmdtp, 0, flag, argc, argv);
199}
200
201int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
202{
wdenk874ac262003-07-24 23:38:38 +0000203 ulong addr, writeval, count;
204 int size;
wdenk38635852002-08-27 05:55:31 +0000205
206 if ((argc < 3) || (argc > 4)) {
207 printf ("Usage:\n%s\n", cmdtp->usage);
208 return 1;
209 }
210
211 /* Check for size specification.
212 */
wdenk874ac262003-07-24 23:38:38 +0000213 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
214 return 1;
wdenk38635852002-08-27 05:55:31 +0000215
216 /* Address is specified since argc > 1
217 */
218 addr = simple_strtoul(argv[1], NULL, 16);
219 addr += base_address;
220
221 /* Get the value to write.
222 */
223 writeval = simple_strtoul(argv[2], NULL, 16);
224
225 /* Count ? */
226 if (argc == 4) {
227 count = simple_strtoul(argv[3], NULL, 16);
228 } else {
229 count = 1;
230 }
231
232 while (count-- > 0) {
233 if (size == 4)
234 *((ulong *)addr) = (ulong )writeval;
235 else if (size == 2)
236 *((ushort *)addr) = (ushort)writeval;
237 else
238 *((u_char *)addr) = (u_char)writeval;
239 addr += size;
240 }
241 return 0;
242}
243
stroesefb5e0ac2004-12-16 17:42:39 +0000244#ifdef CONFIG_MX_CYCLIC
245int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
246{
247 int i;
248 ulong count;
249
250 if (argc < 4) {
251 printf ("Usage:\n%s\n", cmdtp->usage);
252 return 1;
253 }
254
255 count = simple_strtoul(argv[3], NULL, 10);
256
257 for (;;) {
258 do_mem_md (NULL, 0, 3, argv);
259
260 /* delay for <count> ms... */
261 for (i=0; i<count; i++)
262 udelay (1000);
263
264 /* check for ctrl-c to abort... */
265 if (ctrlc()) {
266 puts("Abort\n");
267 return 0;
268 }
269 }
270
271 return 0;
272}
273
274int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
275{
276 int i;
277 ulong count;
278
279 if (argc < 4) {
280 printf ("Usage:\n%s\n", cmdtp->usage);
281 return 1;
282 }
283
284 count = simple_strtoul(argv[3], NULL, 10);
285
286 for (;;) {
287 do_mem_mw (NULL, 0, 3, argv);
288
289 /* delay for <count> ms... */
290 for (i=0; i<count; i++)
291 udelay (1000);
292
293 /* check for ctrl-c to abort... */
294 if (ctrlc()) {
295 puts("Abort\n");
296 return 0;
297 }
298 }
299
300 return 0;
301}
302#endif /* CONFIG_MX_CYCLIC */
303
wdenk38635852002-08-27 05:55:31 +0000304int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
305{
wdenk874ac262003-07-24 23:38:38 +0000306 ulong addr1, addr2, count, ngood;
307 int size;
wdenk38635852002-08-27 05:55:31 +0000308 int rcode = 0;
309
310 if (argc != 4) {
311 printf ("Usage:\n%s\n", cmdtp->usage);
312 return 1;
313 }
314
315 /* Check for size specification.
316 */
wdenk874ac262003-07-24 23:38:38 +0000317 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
318 return 1;
wdenk38635852002-08-27 05:55:31 +0000319
320 addr1 = simple_strtoul(argv[1], NULL, 16);
321 addr1 += base_address;
322
323 addr2 = simple_strtoul(argv[2], NULL, 16);
324 addr2 += base_address;
325
326 count = simple_strtoul(argv[3], NULL, 16);
327
wdenk381669a2003-06-16 23:50:08 +0000328#ifdef CONFIG_HAS_DATAFLASH
329 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
wdenk42c05472004-03-23 22:14:11 +0000330 puts ("Comparison with DataFlash space not supported.\n\r");
wdenk381669a2003-06-16 23:50:08 +0000331 return 0;
332 }
333#endif
334
Mike Frysingere578d682008-02-04 19:26:56 -0500335#ifdef CONFIG_BLACKFIN
336 if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) {
337 puts ("Comparison with L1 instruction memory not supported.\n\r");
338 return 0;
339 }
340#endif
341
wdenk38635852002-08-27 05:55:31 +0000342 ngood = 0;
343
344 while (count-- > 0) {
345 if (size == 4) {
346 ulong word1 = *(ulong *)addr1;
347 ulong word2 = *(ulong *)addr2;
348 if (word1 != word2) {
349 printf("word at 0x%08lx (0x%08lx) "
350 "!= word at 0x%08lx (0x%08lx)\n",
351 addr1, word1, addr2, word2);
352 rcode = 1;
353 break;
354 }
355 }
356 else if (size == 2) {
357 ushort hword1 = *(ushort *)addr1;
358 ushort hword2 = *(ushort *)addr2;
359 if (hword1 != hword2) {
360 printf("halfword at 0x%08lx (0x%04x) "
361 "!= halfword at 0x%08lx (0x%04x)\n",
362 addr1, hword1, addr2, hword2);
363 rcode = 1;
364 break;
365 }
366 }
367 else {
368 u_char byte1 = *(u_char *)addr1;
369 u_char byte2 = *(u_char *)addr2;
370 if (byte1 != byte2) {
371 printf("byte at 0x%08lx (0x%02x) "
372 "!= byte at 0x%08lx (0x%02x)\n",
373 addr1, byte1, addr2, byte2);
374 rcode = 1;
375 break;
376 }
377 }
378 ngood++;
379 addr1 += size;
380 addr2 += size;
381 }
382
383 printf("Total of %ld %s%s were the same\n",
384 ngood, size == 4 ? "word" : size == 2 ? "halfword" : "byte",
385 ngood == 1 ? "" : "s");
386 return rcode;
387}
388
389int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
390{
wdenk874ac262003-07-24 23:38:38 +0000391 ulong addr, dest, count;
392 int size;
wdenk38635852002-08-27 05:55:31 +0000393
394 if (argc != 4) {
395 printf ("Usage:\n%s\n", cmdtp->usage);
396 return 1;
397 }
398
399 /* Check for size specification.
400 */
wdenk874ac262003-07-24 23:38:38 +0000401 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
402 return 1;
wdenk38635852002-08-27 05:55:31 +0000403
404 addr = simple_strtoul(argv[1], NULL, 16);
405 addr += base_address;
406
407 dest = simple_strtoul(argv[2], NULL, 16);
408 dest += base_address;
409
410 count = simple_strtoul(argv[3], NULL, 16);
411
412 if (count == 0) {
413 puts ("Zero length ???\n");
414 return 1;
415 }
416
417#ifndef CFG_NO_FLASH
418 /* check if we are copying to Flash */
wdenk381669a2003-06-16 23:50:08 +0000419 if ( (addr2info(dest) != NULL)
420#ifdef CONFIG_HAS_DATAFLASH
Kim B. Heino1eb0fd52008-03-03 10:39:13 +0200421 && (!addr_dataflash(dest))
wdenk381669a2003-06-16 23:50:08 +0000422#endif
423 ) {
wdenk38635852002-08-27 05:55:31 +0000424 int rc;
425
wdenk42c05472004-03-23 22:14:11 +0000426 puts ("Copy to Flash... ");
wdenk38635852002-08-27 05:55:31 +0000427
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200428 rc = flash_write ((char *)addr, dest, count*size);
wdenk38635852002-08-27 05:55:31 +0000429 if (rc != 0) {
430 flash_perror (rc);
431 return (1);
432 }
433 puts ("done\n");
434 return 0;
435 }
436#endif
437
Jon Loeligerd76b5c12007-07-08 18:02:23 -0500438#if defined(CONFIG_CMD_MMC)
wdenk7a428cc2003-06-15 22:40:42 +0000439 if (mmc2info(dest)) {
440 int rc;
441
wdenk42c05472004-03-23 22:14:11 +0000442 puts ("Copy to MMC... ");
wdenk7a428cc2003-06-15 22:40:42 +0000443 switch (rc = mmc_write ((uchar *)addr, dest, count*size)) {
444 case 0:
wdenk42c05472004-03-23 22:14:11 +0000445 putc ('\n');
wdenk7a428cc2003-06-15 22:40:42 +0000446 return 1;
447 case -1:
wdenk42c05472004-03-23 22:14:11 +0000448 puts ("failed\n");
wdenk7a428cc2003-06-15 22:40:42 +0000449 return 1;
450 default:
451 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
452 return 1;
453 }
454 puts ("done\n");
455 return 0;
456 }
457
458 if (mmc2info(addr)) {
459 int rc;
460
wdenk42c05472004-03-23 22:14:11 +0000461 puts ("Copy from MMC... ");
wdenk7a428cc2003-06-15 22:40:42 +0000462 switch (rc = mmc_read (addr, (uchar *)dest, count*size)) {
463 case 0:
wdenk42c05472004-03-23 22:14:11 +0000464 putc ('\n');
wdenk7a428cc2003-06-15 22:40:42 +0000465 return 1;
466 case -1:
wdenk42c05472004-03-23 22:14:11 +0000467 puts ("failed\n");
wdenk7a428cc2003-06-15 22:40:42 +0000468 return 1;
469 default:
470 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
471 return 1;
472 }
473 puts ("done\n");
474 return 0;
475 }
wdenk381669a2003-06-16 23:50:08 +0000476#endif
477
478#ifdef CONFIG_HAS_DATAFLASH
479 /* Check if we are copying from RAM or Flash to DataFlash */
480 if (addr_dataflash(dest) && !addr_dataflash(addr)){
481 int rc;
482
wdenk42c05472004-03-23 22:14:11 +0000483 puts ("Copy to DataFlash... ");
wdenk381669a2003-06-16 23:50:08 +0000484
485 rc = write_dataflash (dest, addr, count*size);
486
487 if (rc != 1) {
488 dataflash_perror (rc);
489 return (1);
490 }
491 puts ("done\n");
492 return 0;
493 }
wdenk57b2d802003-06-27 21:31:46 +0000494
wdenk381669a2003-06-16 23:50:08 +0000495 /* Check if we are copying from DataFlash to RAM */
496 if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){
wdenk86765902003-12-06 23:55:10 +0000497 int rc;
498 rc = read_dataflash(addr, count * size, (char *) dest);
499 if (rc != 1) {
wdenk1ebf41e2004-01-02 14:00:00 +0000500 dataflash_perror (rc);
501 return (1);
502 }
wdenk381669a2003-06-16 23:50:08 +0000503 return 0;
504 }
505
506 if (addr_dataflash(addr) && addr_dataflash(dest)){
wdenk42c05472004-03-23 22:14:11 +0000507 puts ("Unsupported combination of source/destination.\n\r");
wdenk381669a2003-06-16 23:50:08 +0000508 return 1;
509 }
wdenk7a428cc2003-06-15 22:40:42 +0000510#endif
511
Mike Frysingere578d682008-02-04 19:26:56 -0500512#ifdef CONFIG_BLACKFIN
513 /* See if we're copying to/from L1 inst */
514 if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) {
515 memcpy((void *)dest, (void *)addr, count * size);
516 return 0;
517 }
518#endif
519
wdenk38635852002-08-27 05:55:31 +0000520 while (count-- > 0) {
521 if (size == 4)
522 *((ulong *)dest) = *((ulong *)addr);
523 else if (size == 2)
524 *((ushort *)dest) = *((ushort *)addr);
525 else
526 *((u_char *)dest) = *((u_char *)addr);
527 addr += size;
528 dest += size;
529 }
530 return 0;
531}
532
533int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
534{
535 if (argc > 1) {
536 /* Set new base address.
537 */
538 base_address = simple_strtoul(argv[1], NULL, 16);
539 }
540 /* Print the current base address.
541 */
542 printf("Base Address: 0x%08lx\n", base_address);
543 return 0;
544}
545
546int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
547{
wdenk874ac262003-07-24 23:38:38 +0000548 ulong addr, length, i, junk;
549 int size;
wdenk38635852002-08-27 05:55:31 +0000550 volatile uint *longp;
551 volatile ushort *shortp;
552 volatile u_char *cp;
553
554 if (argc < 3) {
555 printf ("Usage:\n%s\n", cmdtp->usage);
556 return 1;
557 }
558
559 /* Check for a size spefication.
560 * Defaults to long if no or incorrect specification.
561 */
wdenk874ac262003-07-24 23:38:38 +0000562 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
563 return 1;
wdenk38635852002-08-27 05:55:31 +0000564
565 /* Address is always specified.
566 */
567 addr = simple_strtoul(argv[1], NULL, 16);
568
569 /* Length is the number of objects, not number of bytes.
570 */
571 length = simple_strtoul(argv[2], NULL, 16);
572
573 /* We want to optimize the loops to run as fast as possible.
574 * If we have only one object, just run infinite loops.
575 */
576 if (length == 1) {
577 if (size == 4) {
578 longp = (uint *)addr;
579 for (;;)
580 i = *longp;
581 }
582 if (size == 2) {
583 shortp = (ushort *)addr;
584 for (;;)
585 i = *shortp;
586 }
587 cp = (u_char *)addr;
588 for (;;)
589 i = *cp;
590 }
591
592 if (size == 4) {
593 for (;;) {
594 longp = (uint *)addr;
595 i = length;
596 while (i-- > 0)
597 junk = *longp++;
598 }
599 }
600 if (size == 2) {
601 for (;;) {
602 shortp = (ushort *)addr;
603 i = length;
604 while (i-- > 0)
605 junk = *shortp++;
606 }
607 }
608 for (;;) {
609 cp = (u_char *)addr;
610 i = length;
611 while (i-- > 0)
612 junk = *cp++;
613 }
614}
615
wdenk64519362004-07-11 17:40:54 +0000616#ifdef CONFIG_LOOPW
617int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
618{
619 ulong addr, length, i, data;
620 int size;
621 volatile uint *longp;
622 volatile ushort *shortp;
623 volatile u_char *cp;
wdenk7dd13292004-07-11 20:04:51 +0000624
wdenk64519362004-07-11 17:40:54 +0000625 if (argc < 4) {
626 printf ("Usage:\n%s\n", cmdtp->usage);
627 return 1;
628 }
629
630 /* Check for a size spefication.
631 * Defaults to long if no or incorrect specification.
632 */
633 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
634 return 1;
635
636 /* Address is always specified.
637 */
638 addr = simple_strtoul(argv[1], NULL, 16);
639
640 /* Length is the number of objects, not number of bytes.
641 */
642 length = simple_strtoul(argv[2], NULL, 16);
643
644 /* data to write */
645 data = simple_strtoul(argv[3], NULL, 16);
wdenk7dd13292004-07-11 20:04:51 +0000646
wdenk64519362004-07-11 17:40:54 +0000647 /* We want to optimize the loops to run as fast as possible.
648 * If we have only one object, just run infinite loops.
649 */
650 if (length == 1) {
651 if (size == 4) {
652 longp = (uint *)addr;
653 for (;;)
654 *longp = data;
655 }
656 if (size == 2) {
657 shortp = (ushort *)addr;
658 for (;;)
659 *shortp = data;
660 }
661 cp = (u_char *)addr;
662 for (;;)
663 *cp = data;
664 }
665
666 if (size == 4) {
667 for (;;) {
668 longp = (uint *)addr;
669 i = length;
670 while (i-- > 0)
671 *longp++ = data;
672 }
673 }
674 if (size == 2) {
675 for (;;) {
676 shortp = (ushort *)addr;
677 i = length;
678 while (i-- > 0)
679 *shortp++ = data;
680 }
681 }
682 for (;;) {
683 cp = (u_char *)addr;
684 i = length;
685 while (i-- > 0)
686 *cp++ = data;
687 }
688}
689#endif /* CONFIG_LOOPW */
690
wdenk38635852002-08-27 05:55:31 +0000691/*
692 * Perform a memory test. A more complete alternative test can be
693 * configured using CFG_ALT_MEMTEST. The complete test loops until
694 * interrupted by ctrl-c or by a failure of one of the sub-tests.
695 */
696int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
697{
698 vu_long *addr, *start, *end;
699 ulong val;
700 ulong readback;
Guennadi Liakhovetski4de85712008-02-13 11:19:19 +0100701 int rcode = 0;
wdenk38635852002-08-27 05:55:31 +0000702
703#if defined(CFG_ALT_MEMTEST)
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100704 vu_long len;
wdenk38635852002-08-27 05:55:31 +0000705 vu_long offset;
706 vu_long test_offset;
707 vu_long pattern;
708 vu_long temp;
709 vu_long anti_pattern;
710 vu_long num_words;
wdenk5958f4a2003-09-18 09:21:33 +0000711#if defined(CFG_MEMTEST_SCRATCH)
712 vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
713#else
Wolfgang Denkf0e38c12006-07-21 11:37:40 +0200714 vu_long *dummy = 0; /* yes, this is address 0x0, not NULL */
wdenk5958f4a2003-09-18 09:21:33 +0000715#endif
wdenk38635852002-08-27 05:55:31 +0000716 int j;
717 int iterations = 1;
718
719 static const ulong bitpattern[] = {
720 0x00000001, /* single bit */
721 0x00000003, /* two adjacent bits */
722 0x00000007, /* three adjacent bits */
723 0x0000000F, /* four adjacent bits */
724 0x00000005, /* two non-adjacent bits */
725 0x00000015, /* three non-adjacent bits */
726 0x00000055, /* four non-adjacent bits */
727 0xaaaaaaaa, /* alternating 1/0 */
728 };
729#else
730 ulong incr;
731 ulong pattern;
wdenk38635852002-08-27 05:55:31 +0000732#endif
733
734 if (argc > 1) {
735 start = (ulong *)simple_strtoul(argv[1], NULL, 16);
736 } else {
737 start = (ulong *)CFG_MEMTEST_START;
738 }
739
740 if (argc > 2) {
741 end = (ulong *)simple_strtoul(argv[2], NULL, 16);
742 } else {
743 end = (ulong *)(CFG_MEMTEST_END);
744 }
745
746 if (argc > 3) {
747 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
748 } else {
749 pattern = 0;
750 }
751
752#if defined(CFG_ALT_MEMTEST)
753 printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
754 PRINTF("%s:%d: start 0x%p end 0x%p\n",
755 __FUNCTION__, __LINE__, start, end);
756
757 for (;;) {
758 if (ctrlc()) {
759 putc ('\n');
760 return 1;
761 }
762
763 printf("Iteration: %6d\r", iterations);
764 PRINTF("Iteration: %6d\n", iterations);
765 iterations++;
766
767 /*
768 * Data line test: write a pattern to the first
769 * location, write the 1's complement to a 'parking'
770 * address (changes the state of the data bus so a
771 * floating bus doen't give a false OK), and then
772 * read the value back. Note that we read it back
773 * into a variable because the next time we read it,
774 * it might be right (been there, tough to explain to
775 * the quality guys why it prints a failure when the
776 * "is" and "should be" are obviously the same in the
777 * error message).
778 *
779 * Rather than exhaustively testing, we test some
780 * patterns by shifting '1' bits through a field of
781 * '0's and '0' bits through a field of '1's (i.e.
782 * pattern and ~pattern).
783 */
784 addr = start;
785 for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
786 val = bitpattern[j];
787 for(; val != 0; val <<= 1) {
788 *addr = val;
789 *dummy = ~val; /* clear the test data off of the bus */
790 readback = *addr;
791 if(readback != val) {
792 printf ("FAILURE (data line): "
793 "expected %08lx, actual %08lx\n",
794 val, readback);
795 }
796 *addr = ~val;
797 *dummy = val;
798 readback = *addr;
799 if(readback != ~val) {
800 printf ("FAILURE (data line): "
801 "Is %08lx, should be %08lx\n",
wdenk391b5742004-10-10 23:27:33 +0000802 readback, ~val);
wdenk38635852002-08-27 05:55:31 +0000803 }
804 }
805 }
806
807 /*
808 * Based on code whose Original Author and Copyright
809 * information follows: Copyright (c) 1998 by Michael
810 * Barr. This software is placed into the public
811 * domain and may be used for any purpose. However,
812 * this notice must not be changed or removed and no
813 * warranty is either expressed or implied by its
814 * publication or distribution.
815 */
816
817 /*
818 * Address line test
819 *
820 * Description: Test the address bus wiring in a
821 * memory region by performing a walking
822 * 1's test on the relevant bits of the
823 * address and checking for aliasing.
824 * This test will find single-bit
825 * address failures such as stuck -high,
826 * stuck-low, and shorted pins. The base
827 * address and size of the region are
828 * selected by the caller.
829 *
830 * Notes: For best results, the selected base
831 * address should have enough LSB 0's to
832 * guarantee single address bit changes.
833 * For example, to test a 64-Kbyte
834 * region, select a base address on a
835 * 64-Kbyte boundary. Also, select the
836 * region size as a power-of-two if at
837 * all possible.
838 *
839 * Returns: 0 if the test succeeds, 1 if the test fails.
wdenk38635852002-08-27 05:55:31 +0000840 */
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100841 len = ((ulong)end - (ulong)start)/sizeof(vu_long);
wdenk38635852002-08-27 05:55:31 +0000842 pattern = (vu_long) 0xaaaaaaaa;
843 anti_pattern = (vu_long) 0x55555555;
844
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100845 PRINTF("%s:%d: length = 0x%.8lx\n",
wdenk38635852002-08-27 05:55:31 +0000846 __FUNCTION__, __LINE__,
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100847 len);
wdenk38635852002-08-27 05:55:31 +0000848 /*
849 * Write the default pattern at each of the
850 * power-of-two offsets.
851 */
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100852 for (offset = 1; offset < len; offset <<= 1) {
wdenk38635852002-08-27 05:55:31 +0000853 start[offset] = pattern;
854 }
855
856 /*
857 * Check for address bits stuck high.
858 */
859 test_offset = 0;
860 start[test_offset] = anti_pattern;
861
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100862 for (offset = 1; offset < len; offset <<= 1) {
wdenk38635852002-08-27 05:55:31 +0000863 temp = start[offset];
864 if (temp != pattern) {
865 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
866 " expected 0x%.8lx, actual 0x%.8lx\n",
867 (ulong)&start[offset], pattern, temp);
868 return 1;
869 }
870 }
871 start[test_offset] = pattern;
Sergei Poselenov474dbb82008-04-09 16:09:41 +0200872 WATCHDOG_RESET();
wdenk38635852002-08-27 05:55:31 +0000873
874 /*
875 * Check for addr bits stuck low or shorted.
876 */
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100877 for (test_offset = 1; test_offset < len; test_offset <<= 1) {
wdenk38635852002-08-27 05:55:31 +0000878 start[test_offset] = anti_pattern;
879
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100880 for (offset = 1; offset < len; offset <<= 1) {
wdenk38635852002-08-27 05:55:31 +0000881 temp = start[offset];
882 if ((temp != pattern) && (offset != test_offset)) {
883 printf ("\nFAILURE: Address bit stuck low or shorted @"
884 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
885 (ulong)&start[offset], pattern, temp);
886 return 1;
887 }
888 }
889 start[test_offset] = pattern;
890 }
891
892 /*
893 * Description: Test the integrity of a physical
894 * memory device by performing an
895 * increment/decrement test over the
896 * entire region. In the process every
897 * storage bit in the device is tested
898 * as a zero and a one. The base address
899 * and the size of the region are
900 * selected by the caller.
901 *
902 * Returns: 0 if the test succeeds, 1 if the test fails.
903 */
904 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
905
906 /*
907 * Fill memory with a known pattern.
908 */
909 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
Sergei Poselenov474dbb82008-04-09 16:09:41 +0200910 WATCHDOG_RESET();
wdenk38635852002-08-27 05:55:31 +0000911 start[offset] = pattern;
912 }
913
914 /*
915 * Check each location and invert it for the second pass.
916 */
917 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
Sergei Poselenov474dbb82008-04-09 16:09:41 +0200918 WATCHDOG_RESET();
wdenk38635852002-08-27 05:55:31 +0000919 temp = start[offset];
920 if (temp != pattern) {
921 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
922 " expected 0x%.8lx, actual 0x%.8lx)\n",
923 (ulong)&start[offset], pattern, temp);
924 return 1;
925 }
926
927 anti_pattern = ~pattern;
928 start[offset] = anti_pattern;
929 }
930
931 /*
932 * Check each location for the inverted pattern and zero it.
933 */
934 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
Sergei Poselenov474dbb82008-04-09 16:09:41 +0200935 WATCHDOG_RESET();
wdenk38635852002-08-27 05:55:31 +0000936 anti_pattern = ~pattern;
937 temp = start[offset];
938 if (temp != anti_pattern) {
939 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
940 " expected 0x%.8lx, actual 0x%.8lx)\n",
941 (ulong)&start[offset], anti_pattern, temp);
942 return 1;
943 }
944 start[offset] = 0;
945 }
946 }
947
948#else /* The original, quickie test */
949 incr = 1;
950 for (;;) {
951 if (ctrlc()) {
952 putc ('\n');
953 return 1;
954 }
955
956 printf ("\rPattern %08lX Writing..."
957 "%12s"
958 "\b\b\b\b\b\b\b\b\b\b",
959 pattern, "");
960
961 for (addr=start,val=pattern; addr<end; addr++) {
Sergei Poselenov474dbb82008-04-09 16:09:41 +0200962 WATCHDOG_RESET();
wdenk38635852002-08-27 05:55:31 +0000963 *addr = val;
964 val += incr;
965 }
966
wdenk42c05472004-03-23 22:14:11 +0000967 puts ("Reading...");
wdenk38635852002-08-27 05:55:31 +0000968
969 for (addr=start,val=pattern; addr<end; addr++) {
Sergei Poselenov474dbb82008-04-09 16:09:41 +0200970 WATCHDOG_RESET();
wdenk38635852002-08-27 05:55:31 +0000971 readback = *addr;
972 if (readback != val) {
973 printf ("\nMem error @ 0x%08X: "
974 "found %08lX, expected %08lX\n",
975 (uint)addr, readback, val);
976 rcode = 1;
977 }
978 val += incr;
979 }
980
981 /*
982 * Flip the pattern each time to make lots of zeros and
983 * then, the next time, lots of ones. We decrement
984 * the "negative" patterns and increment the "positive"
985 * patterns to preserve this feature.
986 */
987 if(pattern & 0x80000000) {
988 pattern = -pattern; /* complement & increment */
989 }
990 else {
991 pattern = ~pattern;
992 }
993 incr = -incr;
994 }
wdenk38635852002-08-27 05:55:31 +0000995#endif
Guennadi Liakhovetski4de85712008-02-13 11:19:19 +0100996 return rcode;
wdenk38635852002-08-27 05:55:31 +0000997}
998
999
1000/* Modify memory.
1001 *
1002 * Syntax:
1003 * mm{.b, .w, .l} {addr}
1004 * nm{.b, .w, .l} {addr}
1005 */
1006static int
1007mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
1008{
wdenk874ac262003-07-24 23:38:38 +00001009 ulong addr, i;
1010 int nbytes, size;
wdenk38635852002-08-27 05:55:31 +00001011 extern char console_buffer[];
1012
1013 if (argc != 2) {
1014 printf ("Usage:\n%s\n", cmdtp->usage);
1015 return 1;
1016 }
1017
1018#ifdef CONFIG_BOOT_RETRY_TIME
1019 reset_cmd_timeout(); /* got a good command to get here */
1020#endif
1021 /* We use the last specified parameters, unless new ones are
1022 * entered.
1023 */
1024 addr = mm_last_addr;
1025 size = mm_last_size;
1026
1027 if ((flag & CMD_FLAG_REPEAT) == 0) {
1028 /* New command specified. Check for a size specification.
1029 * Defaults to long if no or incorrect specification.
1030 */
wdenk874ac262003-07-24 23:38:38 +00001031 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1032 return 1;
wdenk38635852002-08-27 05:55:31 +00001033
1034 /* Address is specified since argc > 1
1035 */
1036 addr = simple_strtoul(argv[1], NULL, 16);
1037 addr += base_address;
1038 }
1039
wdenk381669a2003-06-16 23:50:08 +00001040#ifdef CONFIG_HAS_DATAFLASH
1041 if (addr_dataflash(addr)){
wdenk42c05472004-03-23 22:14:11 +00001042 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
wdenk381669a2003-06-16 23:50:08 +00001043 return 0;
1044 }
1045#endif
1046
Mike Frysingere578d682008-02-04 19:26:56 -05001047#ifdef CONFIG_BLACKFIN
1048 if (addr_bfin_on_chip_mem(addr)) {
1049 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
1050 return 0;
1051 }
1052#endif
1053
wdenk38635852002-08-27 05:55:31 +00001054 /* Print the address, followed by value. Then accept input for
1055 * the next value. A non-converted value exits.
1056 */
1057 do {
1058 printf("%08lx:", addr);
1059 if (size == 4)
1060 printf(" %08x", *((uint *)addr));
1061 else if (size == 2)
1062 printf(" %04x", *((ushort *)addr));
1063 else
1064 printf(" %02x", *((u_char *)addr));
1065
1066 nbytes = readline (" ? ");
1067 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1068 /* <CR> pressed as only input, don't modify current
1069 * location and move to next. "-" pressed will go back.
1070 */
1071 if (incrflag)
1072 addr += nbytes ? -size : size;
1073 nbytes = 1;
1074#ifdef CONFIG_BOOT_RETRY_TIME
1075 reset_cmd_timeout(); /* good enough to not time out */
1076#endif
1077 }
1078#ifdef CONFIG_BOOT_RETRY_TIME
1079 else if (nbytes == -2) {
1080 break; /* timed out, exit the command */
1081 }
1082#endif
1083 else {
1084 char *endp;
1085 i = simple_strtoul(console_buffer, &endp, 16);
1086 nbytes = endp - console_buffer;
1087 if (nbytes) {
1088#ifdef CONFIG_BOOT_RETRY_TIME
1089 /* good enough to not time out
1090 */
1091 reset_cmd_timeout();
1092#endif
1093 if (size == 4)
1094 *((uint *)addr) = i;
1095 else if (size == 2)
1096 *((ushort *)addr) = i;
1097 else
1098 *((u_char *)addr) = i;
1099 if (incrflag)
1100 addr += size;
1101 }
1102 }
1103 } while (nbytes);
1104
1105 mm_last_addr = addr;
1106 mm_last_size = size;
1107 return 0;
1108}
1109
wdenk6203e402004-04-18 10:13:26 +00001110#ifndef CONFIG_CRC32_VERIFY
1111
wdenk38635852002-08-27 05:55:31 +00001112int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1113{
wdenk7a428cc2003-06-15 22:40:42 +00001114 ulong addr, length;
1115 ulong crc;
1116 ulong *ptr;
wdenk38635852002-08-27 05:55:31 +00001117
1118 if (argc < 3) {
1119 printf ("Usage:\n%s\n", cmdtp->usage);
1120 return 1;
1121 }
1122
wdenk7a428cc2003-06-15 22:40:42 +00001123 addr = simple_strtoul (argv[1], NULL, 16);
wdenk38635852002-08-27 05:55:31 +00001124 addr += base_address;
1125
wdenk7a428cc2003-06-15 22:40:42 +00001126 length = simple_strtoul (argv[2], NULL, 16);
wdenk38635852002-08-27 05:55:31 +00001127
wdenk7a428cc2003-06-15 22:40:42 +00001128 crc = crc32 (0, (const uchar *) addr, length);
wdenk38635852002-08-27 05:55:31 +00001129
1130 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
wdenk7a428cc2003-06-15 22:40:42 +00001131 addr, addr + length - 1, crc);
wdenk38635852002-08-27 05:55:31 +00001132
wdenk7a428cc2003-06-15 22:40:42 +00001133 if (argc > 3) {
1134 ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
1135 *ptr = crc;
1136 }
wdenk38635852002-08-27 05:55:31 +00001137
1138 return 0;
1139}
1140
wdenk6203e402004-04-18 10:13:26 +00001141#else /* CONFIG_CRC32_VERIFY */
1142
1143int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1144{
1145 ulong addr, length;
1146 ulong crc;
1147 ulong *ptr;
wdenk05939202004-04-18 17:39:38 +00001148 ulong vcrc;
wdenk6203e402004-04-18 10:13:26 +00001149 int verify;
1150 int ac;
1151 char **av;
1152
1153 if (argc < 3) {
1154 usage:
1155 printf ("Usage:\n%s\n", cmdtp->usage);
1156 return 1;
1157 }
1158
1159 av = argv + 1;
1160 ac = argc - 1;
1161 if (strcmp(*av, "-v") == 0) {
1162 verify = 1;
1163 av++;
1164 ac--;
1165 if (ac < 3)
1166 goto usage;
1167 } else
1168 verify = 0;
1169
1170 addr = simple_strtoul(*av++, NULL, 16);
1171 addr += base_address;
1172 length = simple_strtoul(*av++, NULL, 16);
1173
1174 crc = crc32(0, (const uchar *) addr, length);
1175
1176 if (!verify) {
1177 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1178 addr, addr + length - 1, crc);
1179 if (ac > 2) {
1180 ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
1181 *ptr = crc;
1182 }
1183 } else {
1184 vcrc = simple_strtoul(*av++, NULL, 16);
1185 if (vcrc != crc) {
1186 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1187 addr, addr + length - 1, crc, vcrc);
1188 return 1;
1189 }
1190 }
1191
1192 return 0;
1193
1194}
1195#endif /* CONFIG_CRC32_VERIFY */
1196
wdenk57b2d802003-06-27 21:31:46 +00001197/**************************************************/
Jon Loeligerd76b5c12007-07-08 18:02:23 -05001198#if defined(CONFIG_CMD_MEMORY)
wdenkf287a242003-07-01 21:06:45 +00001199U_BOOT_CMD(
1200 md, 3, 1, do_mem_md,
wdenk57b2d802003-06-27 21:31:46 +00001201 "md - memory display\n",
1202 "[.b, .w, .l] address [# of objects]\n - memory display\n"
1203);
1204
1205
wdenkf287a242003-07-01 21:06:45 +00001206U_BOOT_CMD(
1207 mm, 2, 1, do_mem_mm,
wdenk57b2d802003-06-27 21:31:46 +00001208 "mm - memory modify (auto-incrementing)\n",
1209 "[.b, .w, .l] address\n" " - memory modify, auto increment address\n"
1210);
1211
1212
wdenkf287a242003-07-01 21:06:45 +00001213U_BOOT_CMD(
1214 nm, 2, 1, do_mem_nm,
wdenk57b2d802003-06-27 21:31:46 +00001215 "nm - memory modify (constant address)\n",
1216 "[.b, .w, .l] address\n - memory modify, read and keep address\n"
1217);
1218
wdenkf287a242003-07-01 21:06:45 +00001219U_BOOT_CMD(
1220 mw, 4, 1, do_mem_mw,
wdenk57b2d802003-06-27 21:31:46 +00001221 "mw - memory write (fill)\n",
1222 "[.b, .w, .l] address value [count]\n - write memory\n"
1223);
1224
wdenkf287a242003-07-01 21:06:45 +00001225U_BOOT_CMD(
1226 cp, 4, 1, do_mem_cp,
wdenk57b2d802003-06-27 21:31:46 +00001227 "cp - memory copy\n",
1228 "[.b, .w, .l] source target count\n - copy memory\n"
1229);
1230
wdenkf287a242003-07-01 21:06:45 +00001231U_BOOT_CMD(
1232 cmp, 4, 1, do_mem_cmp,
wdenk57b2d802003-06-27 21:31:46 +00001233 "cmp - memory compare\n",
1234 "[.b, .w, .l] addr1 addr2 count\n - compare memory\n"
1235);
1236
wdenk6203e402004-04-18 10:13:26 +00001237#ifndef CONFIG_CRC32_VERIFY
1238
wdenkf287a242003-07-01 21:06:45 +00001239U_BOOT_CMD(
1240 crc32, 4, 1, do_mem_crc,
wdenk57b2d802003-06-27 21:31:46 +00001241 "crc32 - checksum calculation\n",
1242 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1243);
1244
wdenk6203e402004-04-18 10:13:26 +00001245#else /* CONFIG_CRC32_VERIFY */
1246
1247U_BOOT_CMD(
1248 crc32, 5, 1, do_mem_crc,
1249 "crc32 - checksum calculation\n",
1250 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1251 "-v address count crc\n - verify crc of memory area\n"
1252);
1253
1254#endif /* CONFIG_CRC32_VERIFY */
1255
wdenkf287a242003-07-01 21:06:45 +00001256U_BOOT_CMD(
1257 base, 2, 1, do_mem_base,
wdenk57b2d802003-06-27 21:31:46 +00001258 "base - print or set address offset\n",
1259 "\n - print address offset for memory commands\n"
1260 "base off\n - set address offset for memory commands to 'off'\n"
1261);
1262
wdenkf287a242003-07-01 21:06:45 +00001263U_BOOT_CMD(
1264 loop, 3, 1, do_mem_loop,
wdenk57b2d802003-06-27 21:31:46 +00001265 "loop - infinite loop on address range\n",
1266 "[.b, .w, .l] address number_of_objects\n"
1267 " - loop on a set of addresses\n"
1268);
wdenk64519362004-07-11 17:40:54 +00001269
1270#ifdef CONFIG_LOOPW
1271U_BOOT_CMD(
1272 loopw, 4, 1, do_mem_loopw,
1273 "loopw - infinite write loop on address range\n",
1274 "[.b, .w, .l] address number_of_objects data_to_write\n"
1275 " - loop on a set of addresses\n"
1276);
1277#endif /* CONFIG_LOOPW */
wdenk57b2d802003-06-27 21:31:46 +00001278
wdenkf287a242003-07-01 21:06:45 +00001279U_BOOT_CMD(
1280 mtest, 4, 1, do_mem_mtest,
wdenk57b2d802003-06-27 21:31:46 +00001281 "mtest - simple RAM test\n",
1282 "[start [end [pattern]]]\n"
1283 " - simple RAM read/write test\n"
1284);
stroesefb5e0ac2004-12-16 17:42:39 +00001285
1286#ifdef CONFIG_MX_CYCLIC
1287U_BOOT_CMD(
1288 mdc, 4, 1, do_mem_mdc,
1289 "mdc - memory display cyclic\n",
1290 "[.b, .w, .l] address count delay(ms)\n - memory display cyclic\n"
1291);
1292
1293U_BOOT_CMD(
1294 mwc, 4, 1, do_mem_mwc,
1295 "mwc - memory write cyclic\n",
1296 "[.b, .w, .l] address value delay(ms)\n - memory write cyclic\n"
1297);
1298#endif /* CONFIG_MX_CYCLIC */
wdenk57b2d802003-06-27 21:31:46 +00001299
1300#endif
Jon Loeligerd704d912007-07-10 11:02:44 -05001301#endif