blob: 4262e26a61576c46f5f336044e5ce2fdaad307a9 [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
wdenk38635852002-08-27 05:55:31 +000038
Jon Loeligerd76b5c12007-07-08 18:02:23 -050039#if defined(CONFIG_CMD_MEMORY) \
Jon Loeliger3de8b242007-06-11 19:01:54 -050040 || defined(CONFIG_CMD_I2C) \
41 || defined(CONFIG_CMD_ITEST) \
42 || defined(CONFIG_CMD_PCI) \
43 || defined(CONFIG_CMD_PORTIO)
44
wdenk38635852002-08-27 05:55:31 +000045int cmd_get_data_size(char* arg, int default_size)
46{
47 /* Check for a size specification .b, .w or .l.
48 */
49 int len = strlen(arg);
50 if (len > 2 && arg[len-2] == '.') {
51 switch(arg[len-1]) {
52 case 'b':
53 return 1;
54 case 'w':
55 return 2;
56 case 'l':
57 return 4;
wdenk2ebee312004-02-23 19:30:57 +000058 case 's':
59 return -2;
wdenk874ac262003-07-24 23:38:38 +000060 default:
61 return -1;
wdenk38635852002-08-27 05:55:31 +000062 }
63 }
64 return default_size;
65}
66#endif
67
Jon Loeligerd76b5c12007-07-08 18:02:23 -050068#if defined(CONFIG_CMD_MEMORY)
wdenk38635852002-08-27 05:55:31 +000069
70#ifdef CMD_MEM_DEBUG
71#define PRINTF(fmt,args...) printf (fmt ,##args)
72#else
73#define PRINTF(fmt,args...)
74#endif
75
76static int mod_mem(cmd_tbl_t *, int, int, int, char *[]);
77
78/* Display values from last command.
79 * Memory modify remembered values are different from display memory.
80 */
81uint dp_last_addr, dp_last_size;
82uint dp_last_length = 0x40;
83uint mm_last_addr, mm_last_size;
84
85static ulong base_address = 0;
86
87/* Memory Display
88 *
89 * Syntax:
90 * md{.b, .w, .l} {addr} {len}
91 */
92#define DISP_LINE_LEN 16
93int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
94{
wdenk874ac262003-07-24 23:38:38 +000095 ulong addr, length;
Grant Likely02a00782007-02-20 09:05:00 +010096#if defined(CONFIG_HAS_DATAFLASH)
97 ulong nbytes, linebytes;
98#endif
wdenk874ac262003-07-24 23:38:38 +000099 int size;
wdenk38635852002-08-27 05:55:31 +0000100 int rc = 0;
101
102 /* We use the last specified parameters, unless new ones are
103 * entered.
104 */
105 addr = dp_last_addr;
106 size = dp_last_size;
107 length = dp_last_length;
108
109 if (argc < 2) {
110 printf ("Usage:\n%s\n", cmdtp->usage);
111 return 1;
112 }
113
114 if ((flag & CMD_FLAG_REPEAT) == 0) {
115 /* New command specified. Check for a size specification.
116 * Defaults to long if no or incorrect specification.
117 */
wdenk874ac262003-07-24 23:38:38 +0000118 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
119 return 1;
wdenk38635852002-08-27 05:55:31 +0000120
121 /* Address is specified since argc > 1
122 */
123 addr = simple_strtoul(argv[1], NULL, 16);
124 addr += base_address;
125
126 /* If another parameter, it is the length to display.
127 * Length is the number of objects, not number of bytes.
128 */
129 if (argc > 2)
130 length = simple_strtoul(argv[2], NULL, 16);
131 }
132
Grant Likely02a00782007-02-20 09:05:00 +0100133#if defined(CONFIG_HAS_DATAFLASH)
wdenk38635852002-08-27 05:55:31 +0000134 /* Print the lines.
135 *
136 * We buffer all read data, so we can make sure data is read only
137 * once, and all accesses are with the specified bus width.
138 */
139 nbytes = length * size;
140 do {
141 char linebuf[DISP_LINE_LEN];
Grant Likely02a00782007-02-20 09:05:00 +0100142 void* p;
wdenk38635852002-08-27 05:55:31 +0000143 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
wdenk381669a2003-06-16 23:50:08 +0000144
Grant Likely02a00782007-02-20 09:05:00 +0100145 rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
146 p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
147 print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
wdenk57b2d802003-06-27 21:31:46 +0000148
wdenk38635852002-08-27 05:55:31 +0000149 nbytes -= linebytes;
Grant Likely02a00782007-02-20 09:05:00 +0100150 addr += linebytes;
wdenk38635852002-08-27 05:55:31 +0000151 if (ctrlc()) {
152 rc = 1;
153 break;
154 }
155 } while (nbytes > 0);
Grant Likely02a00782007-02-20 09:05:00 +0100156#else
Mike Frysingere578d682008-02-04 19:26:56 -0500157
158# if defined(CONFIG_BLACKFIN)
159 /* See if we're trying to display L1 inst */
160 if (addr_bfin_on_chip_mem(addr)) {
161 char linebuf[DISP_LINE_LEN];
162 ulong linebytes, nbytes = length * size;
163 do {
164 linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
165 memcpy(linebuf, (void *)addr, linebytes);
166 print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size);
167
168 nbytes -= linebytes;
169 addr += linebytes;
170 if (ctrlc()) {
171 rc = 1;
172 break;
173 }
174 } while (nbytes > 0);
175 } else
176# endif
177
178 {
179 /* Print the lines. */
180 print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
181 addr += size*length;
182 }
Grant Likely02a00782007-02-20 09:05:00 +0100183#endif
wdenk38635852002-08-27 05:55:31 +0000184
185 dp_last_addr = addr;
186 dp_last_length = length;
187 dp_last_size = size;
188 return (rc);
189}
190
191int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
192{
193 return mod_mem (cmdtp, 1, flag, argc, argv);
194}
195int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
196{
197 return mod_mem (cmdtp, 0, flag, argc, argv);
198}
199
200int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
201{
wdenk874ac262003-07-24 23:38:38 +0000202 ulong addr, writeval, count;
203 int size;
wdenk38635852002-08-27 05:55:31 +0000204
205 if ((argc < 3) || (argc > 4)) {
206 printf ("Usage:\n%s\n", cmdtp->usage);
207 return 1;
208 }
209
210 /* Check for size specification.
211 */
wdenk874ac262003-07-24 23:38:38 +0000212 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
213 return 1;
wdenk38635852002-08-27 05:55:31 +0000214
215 /* Address is specified since argc > 1
216 */
217 addr = simple_strtoul(argv[1], NULL, 16);
218 addr += base_address;
219
220 /* Get the value to write.
221 */
222 writeval = simple_strtoul(argv[2], NULL, 16);
223
224 /* Count ? */
225 if (argc == 4) {
226 count = simple_strtoul(argv[3], NULL, 16);
227 } else {
228 count = 1;
229 }
230
231 while (count-- > 0) {
232 if (size == 4)
233 *((ulong *)addr) = (ulong )writeval;
234 else if (size == 2)
235 *((ushort *)addr) = (ushort)writeval;
236 else
237 *((u_char *)addr) = (u_char)writeval;
238 addr += size;
239 }
240 return 0;
241}
242
stroesefb5e0ac2004-12-16 17:42:39 +0000243#ifdef CONFIG_MX_CYCLIC
244int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
245{
246 int i;
247 ulong count;
248
249 if (argc < 4) {
250 printf ("Usage:\n%s\n", cmdtp->usage);
251 return 1;
252 }
253
254 count = simple_strtoul(argv[3], NULL, 10);
255
256 for (;;) {
257 do_mem_md (NULL, 0, 3, argv);
258
259 /* delay for <count> ms... */
260 for (i=0; i<count; i++)
261 udelay (1000);
262
263 /* check for ctrl-c to abort... */
264 if (ctrlc()) {
265 puts("Abort\n");
266 return 0;
267 }
268 }
269
270 return 0;
271}
272
273int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
274{
275 int i;
276 ulong count;
277
278 if (argc < 4) {
279 printf ("Usage:\n%s\n", cmdtp->usage);
280 return 1;
281 }
282
283 count = simple_strtoul(argv[3], NULL, 10);
284
285 for (;;) {
286 do_mem_mw (NULL, 0, 3, argv);
287
288 /* delay for <count> ms... */
289 for (i=0; i<count; i++)
290 udelay (1000);
291
292 /* check for ctrl-c to abort... */
293 if (ctrlc()) {
294 puts("Abort\n");
295 return 0;
296 }
297 }
298
299 return 0;
300}
301#endif /* CONFIG_MX_CYCLIC */
302
wdenk38635852002-08-27 05:55:31 +0000303int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
304{
wdenk874ac262003-07-24 23:38:38 +0000305 ulong addr1, addr2, count, ngood;
306 int size;
wdenk38635852002-08-27 05:55:31 +0000307 int rcode = 0;
308
309 if (argc != 4) {
310 printf ("Usage:\n%s\n", cmdtp->usage);
311 return 1;
312 }
313
314 /* Check for size specification.
315 */
wdenk874ac262003-07-24 23:38:38 +0000316 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
317 return 1;
wdenk38635852002-08-27 05:55:31 +0000318
319 addr1 = simple_strtoul(argv[1], NULL, 16);
320 addr1 += base_address;
321
322 addr2 = simple_strtoul(argv[2], NULL, 16);
323 addr2 += base_address;
324
325 count = simple_strtoul(argv[3], NULL, 16);
326
wdenk381669a2003-06-16 23:50:08 +0000327#ifdef CONFIG_HAS_DATAFLASH
328 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
wdenk42c05472004-03-23 22:14:11 +0000329 puts ("Comparison with DataFlash space not supported.\n\r");
wdenk381669a2003-06-16 23:50:08 +0000330 return 0;
331 }
332#endif
333
Mike Frysingere578d682008-02-04 19:26:56 -0500334#ifdef CONFIG_BLACKFIN
335 if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) {
336 puts ("Comparison with L1 instruction memory not supported.\n\r");
337 return 0;
338 }
339#endif
340
wdenk38635852002-08-27 05:55:31 +0000341 ngood = 0;
342
343 while (count-- > 0) {
344 if (size == 4) {
345 ulong word1 = *(ulong *)addr1;
346 ulong word2 = *(ulong *)addr2;
347 if (word1 != word2) {
348 printf("word at 0x%08lx (0x%08lx) "
349 "!= word at 0x%08lx (0x%08lx)\n",
350 addr1, word1, addr2, word2);
351 rcode = 1;
352 break;
353 }
354 }
355 else if (size == 2) {
356 ushort hword1 = *(ushort *)addr1;
357 ushort hword2 = *(ushort *)addr2;
358 if (hword1 != hword2) {
359 printf("halfword at 0x%08lx (0x%04x) "
360 "!= halfword at 0x%08lx (0x%04x)\n",
361 addr1, hword1, addr2, hword2);
362 rcode = 1;
363 break;
364 }
365 }
366 else {
367 u_char byte1 = *(u_char *)addr1;
368 u_char byte2 = *(u_char *)addr2;
369 if (byte1 != byte2) {
370 printf("byte at 0x%08lx (0x%02x) "
371 "!= byte at 0x%08lx (0x%02x)\n",
372 addr1, byte1, addr2, byte2);
373 rcode = 1;
374 break;
375 }
376 }
377 ngood++;
378 addr1 += size;
379 addr2 += size;
380 }
381
382 printf("Total of %ld %s%s were the same\n",
383 ngood, size == 4 ? "word" : size == 2 ? "halfword" : "byte",
384 ngood == 1 ? "" : "s");
385 return rcode;
386}
387
388int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
389{
wdenk874ac262003-07-24 23:38:38 +0000390 ulong addr, dest, count;
391 int size;
wdenk38635852002-08-27 05:55:31 +0000392
393 if (argc != 4) {
394 printf ("Usage:\n%s\n", cmdtp->usage);
395 return 1;
396 }
397
398 /* Check for size specification.
399 */
wdenk874ac262003-07-24 23:38:38 +0000400 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
401 return 1;
wdenk38635852002-08-27 05:55:31 +0000402
403 addr = simple_strtoul(argv[1], NULL, 16);
404 addr += base_address;
405
406 dest = simple_strtoul(argv[2], NULL, 16);
407 dest += base_address;
408
409 count = simple_strtoul(argv[3], NULL, 16);
410
411 if (count == 0) {
412 puts ("Zero length ???\n");
413 return 1;
414 }
415
416#ifndef CFG_NO_FLASH
417 /* check if we are copying to Flash */
wdenk381669a2003-06-16 23:50:08 +0000418 if ( (addr2info(dest) != NULL)
419#ifdef CONFIG_HAS_DATAFLASH
Kim B. Heino1eb0fd52008-03-03 10:39:13 +0200420 && (!addr_dataflash(dest))
wdenk381669a2003-06-16 23:50:08 +0000421#endif
422 ) {
wdenk38635852002-08-27 05:55:31 +0000423 int rc;
424
wdenk42c05472004-03-23 22:14:11 +0000425 puts ("Copy to Flash... ");
wdenk38635852002-08-27 05:55:31 +0000426
Wolfgang Denk7fb52662005-10-13 16:45:02 +0200427 rc = flash_write ((char *)addr, dest, count*size);
wdenk38635852002-08-27 05:55:31 +0000428 if (rc != 0) {
429 flash_perror (rc);
430 return (1);
431 }
432 puts ("done\n");
433 return 0;
434 }
435#endif
436
Jon Loeligerd76b5c12007-07-08 18:02:23 -0500437#if defined(CONFIG_CMD_MMC)
wdenk7a428cc2003-06-15 22:40:42 +0000438 if (mmc2info(dest)) {
439 int rc;
440
wdenk42c05472004-03-23 22:14:11 +0000441 puts ("Copy to MMC... ");
wdenk7a428cc2003-06-15 22:40:42 +0000442 switch (rc = mmc_write ((uchar *)addr, dest, count*size)) {
443 case 0:
wdenk42c05472004-03-23 22:14:11 +0000444 putc ('\n');
wdenk7a428cc2003-06-15 22:40:42 +0000445 return 1;
446 case -1:
wdenk42c05472004-03-23 22:14:11 +0000447 puts ("failed\n");
wdenk7a428cc2003-06-15 22:40:42 +0000448 return 1;
449 default:
450 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
451 return 1;
452 }
453 puts ("done\n");
454 return 0;
455 }
456
457 if (mmc2info(addr)) {
458 int rc;
459
wdenk42c05472004-03-23 22:14:11 +0000460 puts ("Copy from MMC... ");
wdenk7a428cc2003-06-15 22:40:42 +0000461 switch (rc = mmc_read (addr, (uchar *)dest, count*size)) {
462 case 0:
wdenk42c05472004-03-23 22:14:11 +0000463 putc ('\n');
wdenk7a428cc2003-06-15 22:40:42 +0000464 return 1;
465 case -1:
wdenk42c05472004-03-23 22:14:11 +0000466 puts ("failed\n");
wdenk7a428cc2003-06-15 22:40:42 +0000467 return 1;
468 default:
469 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
470 return 1;
471 }
472 puts ("done\n");
473 return 0;
474 }
wdenk381669a2003-06-16 23:50:08 +0000475#endif
476
477#ifdef CONFIG_HAS_DATAFLASH
478 /* Check if we are copying from RAM or Flash to DataFlash */
479 if (addr_dataflash(dest) && !addr_dataflash(addr)){
480 int rc;
481
wdenk42c05472004-03-23 22:14:11 +0000482 puts ("Copy to DataFlash... ");
wdenk381669a2003-06-16 23:50:08 +0000483
484 rc = write_dataflash (dest, addr, count*size);
485
486 if (rc != 1) {
487 dataflash_perror (rc);
488 return (1);
489 }
490 puts ("done\n");
491 return 0;
492 }
wdenk57b2d802003-06-27 21:31:46 +0000493
wdenk381669a2003-06-16 23:50:08 +0000494 /* Check if we are copying from DataFlash to RAM */
495 if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){
wdenk86765902003-12-06 23:55:10 +0000496 int rc;
497 rc = read_dataflash(addr, count * size, (char *) dest);
498 if (rc != 1) {
wdenk1ebf41e2004-01-02 14:00:00 +0000499 dataflash_perror (rc);
500 return (1);
501 }
wdenk381669a2003-06-16 23:50:08 +0000502 return 0;
503 }
504
505 if (addr_dataflash(addr) && addr_dataflash(dest)){
wdenk42c05472004-03-23 22:14:11 +0000506 puts ("Unsupported combination of source/destination.\n\r");
wdenk381669a2003-06-16 23:50:08 +0000507 return 1;
508 }
wdenk7a428cc2003-06-15 22:40:42 +0000509#endif
510
Mike Frysingere578d682008-02-04 19:26:56 -0500511#ifdef CONFIG_BLACKFIN
512 /* See if we're copying to/from L1 inst */
513 if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) {
514 memcpy((void *)dest, (void *)addr, count * size);
515 return 0;
516 }
517#endif
518
wdenk38635852002-08-27 05:55:31 +0000519 while (count-- > 0) {
520 if (size == 4)
521 *((ulong *)dest) = *((ulong *)addr);
522 else if (size == 2)
523 *((ushort *)dest) = *((ushort *)addr);
524 else
525 *((u_char *)dest) = *((u_char *)addr);
526 addr += size;
527 dest += size;
528 }
529 return 0;
530}
531
532int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
533{
534 if (argc > 1) {
535 /* Set new base address.
536 */
537 base_address = simple_strtoul(argv[1], NULL, 16);
538 }
539 /* Print the current base address.
540 */
541 printf("Base Address: 0x%08lx\n", base_address);
542 return 0;
543}
544
545int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
546{
wdenk874ac262003-07-24 23:38:38 +0000547 ulong addr, length, i, junk;
548 int size;
wdenk38635852002-08-27 05:55:31 +0000549 volatile uint *longp;
550 volatile ushort *shortp;
551 volatile u_char *cp;
552
553 if (argc < 3) {
554 printf ("Usage:\n%s\n", cmdtp->usage);
555 return 1;
556 }
557
558 /* Check for a size spefication.
559 * Defaults to long if no or incorrect specification.
560 */
wdenk874ac262003-07-24 23:38:38 +0000561 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
562 return 1;
wdenk38635852002-08-27 05:55:31 +0000563
564 /* Address is always specified.
565 */
566 addr = simple_strtoul(argv[1], NULL, 16);
567
568 /* Length is the number of objects, not number of bytes.
569 */
570 length = simple_strtoul(argv[2], NULL, 16);
571
572 /* We want to optimize the loops to run as fast as possible.
573 * If we have only one object, just run infinite loops.
574 */
575 if (length == 1) {
576 if (size == 4) {
577 longp = (uint *)addr;
578 for (;;)
579 i = *longp;
580 }
581 if (size == 2) {
582 shortp = (ushort *)addr;
583 for (;;)
584 i = *shortp;
585 }
586 cp = (u_char *)addr;
587 for (;;)
588 i = *cp;
589 }
590
591 if (size == 4) {
592 for (;;) {
593 longp = (uint *)addr;
594 i = length;
595 while (i-- > 0)
596 junk = *longp++;
597 }
598 }
599 if (size == 2) {
600 for (;;) {
601 shortp = (ushort *)addr;
602 i = length;
603 while (i-- > 0)
604 junk = *shortp++;
605 }
606 }
607 for (;;) {
608 cp = (u_char *)addr;
609 i = length;
610 while (i-- > 0)
611 junk = *cp++;
612 }
613}
614
wdenk64519362004-07-11 17:40:54 +0000615#ifdef CONFIG_LOOPW
616int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
617{
618 ulong addr, length, i, data;
619 int size;
620 volatile uint *longp;
621 volatile ushort *shortp;
622 volatile u_char *cp;
wdenk7dd13292004-07-11 20:04:51 +0000623
wdenk64519362004-07-11 17:40:54 +0000624 if (argc < 4) {
625 printf ("Usage:\n%s\n", cmdtp->usage);
626 return 1;
627 }
628
629 /* Check for a size spefication.
630 * Defaults to long if no or incorrect specification.
631 */
632 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
633 return 1;
634
635 /* Address is always specified.
636 */
637 addr = simple_strtoul(argv[1], NULL, 16);
638
639 /* Length is the number of objects, not number of bytes.
640 */
641 length = simple_strtoul(argv[2], NULL, 16);
642
643 /* data to write */
644 data = simple_strtoul(argv[3], NULL, 16);
wdenk7dd13292004-07-11 20:04:51 +0000645
wdenk64519362004-07-11 17:40:54 +0000646 /* We want to optimize the loops to run as fast as possible.
647 * If we have only one object, just run infinite loops.
648 */
649 if (length == 1) {
650 if (size == 4) {
651 longp = (uint *)addr;
652 for (;;)
653 *longp = data;
654 }
655 if (size == 2) {
656 shortp = (ushort *)addr;
657 for (;;)
658 *shortp = data;
659 }
660 cp = (u_char *)addr;
661 for (;;)
662 *cp = data;
663 }
664
665 if (size == 4) {
666 for (;;) {
667 longp = (uint *)addr;
668 i = length;
669 while (i-- > 0)
670 *longp++ = data;
671 }
672 }
673 if (size == 2) {
674 for (;;) {
675 shortp = (ushort *)addr;
676 i = length;
677 while (i-- > 0)
678 *shortp++ = data;
679 }
680 }
681 for (;;) {
682 cp = (u_char *)addr;
683 i = length;
684 while (i-- > 0)
685 *cp++ = data;
686 }
687}
688#endif /* CONFIG_LOOPW */
689
wdenk38635852002-08-27 05:55:31 +0000690/*
691 * Perform a memory test. A more complete alternative test can be
692 * configured using CFG_ALT_MEMTEST. The complete test loops until
693 * interrupted by ctrl-c or by a failure of one of the sub-tests.
694 */
695int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
696{
697 vu_long *addr, *start, *end;
698 ulong val;
699 ulong readback;
Guennadi Liakhovetski4de85712008-02-13 11:19:19 +0100700 int rcode = 0;
wdenk38635852002-08-27 05:55:31 +0000701
702#if defined(CFG_ALT_MEMTEST)
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100703 vu_long len;
wdenk38635852002-08-27 05:55:31 +0000704 vu_long offset;
705 vu_long test_offset;
706 vu_long pattern;
707 vu_long temp;
708 vu_long anti_pattern;
709 vu_long num_words;
wdenk5958f4a2003-09-18 09:21:33 +0000710#if defined(CFG_MEMTEST_SCRATCH)
711 vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
712#else
Wolfgang Denkf0e38c12006-07-21 11:37:40 +0200713 vu_long *dummy = 0; /* yes, this is address 0x0, not NULL */
wdenk5958f4a2003-09-18 09:21:33 +0000714#endif
wdenk38635852002-08-27 05:55:31 +0000715 int j;
716 int iterations = 1;
717
718 static const ulong bitpattern[] = {
719 0x00000001, /* single bit */
720 0x00000003, /* two adjacent bits */
721 0x00000007, /* three adjacent bits */
722 0x0000000F, /* four adjacent bits */
723 0x00000005, /* two non-adjacent bits */
724 0x00000015, /* three non-adjacent bits */
725 0x00000055, /* four non-adjacent bits */
726 0xaaaaaaaa, /* alternating 1/0 */
727 };
728#else
729 ulong incr;
730 ulong pattern;
wdenk38635852002-08-27 05:55:31 +0000731#endif
732
733 if (argc > 1) {
734 start = (ulong *)simple_strtoul(argv[1], NULL, 16);
735 } else {
736 start = (ulong *)CFG_MEMTEST_START;
737 }
738
739 if (argc > 2) {
740 end = (ulong *)simple_strtoul(argv[2], NULL, 16);
741 } else {
742 end = (ulong *)(CFG_MEMTEST_END);
743 }
744
745 if (argc > 3) {
746 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
747 } else {
748 pattern = 0;
749 }
750
751#if defined(CFG_ALT_MEMTEST)
752 printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
753 PRINTF("%s:%d: start 0x%p end 0x%p\n",
754 __FUNCTION__, __LINE__, start, end);
755
756 for (;;) {
757 if (ctrlc()) {
758 putc ('\n');
759 return 1;
760 }
761
762 printf("Iteration: %6d\r", iterations);
763 PRINTF("Iteration: %6d\n", iterations);
764 iterations++;
765
766 /*
767 * Data line test: write a pattern to the first
768 * location, write the 1's complement to a 'parking'
769 * address (changes the state of the data bus so a
770 * floating bus doen't give a false OK), and then
771 * read the value back. Note that we read it back
772 * into a variable because the next time we read it,
773 * it might be right (been there, tough to explain to
774 * the quality guys why it prints a failure when the
775 * "is" and "should be" are obviously the same in the
776 * error message).
777 *
778 * Rather than exhaustively testing, we test some
779 * patterns by shifting '1' bits through a field of
780 * '0's and '0' bits through a field of '1's (i.e.
781 * pattern and ~pattern).
782 */
783 addr = start;
784 for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
785 val = bitpattern[j];
786 for(; val != 0; val <<= 1) {
787 *addr = val;
788 *dummy = ~val; /* clear the test data off of the bus */
789 readback = *addr;
790 if(readback != val) {
791 printf ("FAILURE (data line): "
792 "expected %08lx, actual %08lx\n",
793 val, readback);
794 }
795 *addr = ~val;
796 *dummy = val;
797 readback = *addr;
798 if(readback != ~val) {
799 printf ("FAILURE (data line): "
800 "Is %08lx, should be %08lx\n",
wdenk391b5742004-10-10 23:27:33 +0000801 readback, ~val);
wdenk38635852002-08-27 05:55:31 +0000802 }
803 }
804 }
805
806 /*
807 * Based on code whose Original Author and Copyright
808 * information follows: Copyright (c) 1998 by Michael
809 * Barr. This software is placed into the public
810 * domain and may be used for any purpose. However,
811 * this notice must not be changed or removed and no
812 * warranty is either expressed or implied by its
813 * publication or distribution.
814 */
815
816 /*
817 * Address line test
818 *
819 * Description: Test the address bus wiring in a
820 * memory region by performing a walking
821 * 1's test on the relevant bits of the
822 * address and checking for aliasing.
823 * This test will find single-bit
824 * address failures such as stuck -high,
825 * stuck-low, and shorted pins. The base
826 * address and size of the region are
827 * selected by the caller.
828 *
829 * Notes: For best results, the selected base
830 * address should have enough LSB 0's to
831 * guarantee single address bit changes.
832 * For example, to test a 64-Kbyte
833 * region, select a base address on a
834 * 64-Kbyte boundary. Also, select the
835 * region size as a power-of-two if at
836 * all possible.
837 *
838 * Returns: 0 if the test succeeds, 1 if the test fails.
wdenk38635852002-08-27 05:55:31 +0000839 */
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100840 len = ((ulong)end - (ulong)start)/sizeof(vu_long);
wdenk38635852002-08-27 05:55:31 +0000841 pattern = (vu_long) 0xaaaaaaaa;
842 anti_pattern = (vu_long) 0x55555555;
843
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100844 PRINTF("%s:%d: length = 0x%.8lx\n",
wdenk38635852002-08-27 05:55:31 +0000845 __FUNCTION__, __LINE__,
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100846 len);
wdenk38635852002-08-27 05:55:31 +0000847 /*
848 * Write the default pattern at each of the
849 * power-of-two offsets.
850 */
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100851 for (offset = 1; offset < len; offset <<= 1) {
wdenk38635852002-08-27 05:55:31 +0000852 start[offset] = pattern;
853 }
854
855 /*
856 * Check for address bits stuck high.
857 */
858 test_offset = 0;
859 start[test_offset] = anti_pattern;
860
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100861 for (offset = 1; offset < len; offset <<= 1) {
wdenk38635852002-08-27 05:55:31 +0000862 temp = start[offset];
863 if (temp != pattern) {
864 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
865 " expected 0x%.8lx, actual 0x%.8lx\n",
866 (ulong)&start[offset], pattern, temp);
867 return 1;
868 }
869 }
870 start[test_offset] = pattern;
871
872 /*
873 * Check for addr bits stuck low or shorted.
874 */
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100875 for (test_offset = 1; test_offset < len; test_offset <<= 1) {
wdenk38635852002-08-27 05:55:31 +0000876 start[test_offset] = anti_pattern;
877
Guennadi Liakhovetskid4e3fb42008-02-08 21:25:58 +0100878 for (offset = 1; offset < len; offset <<= 1) {
wdenk38635852002-08-27 05:55:31 +0000879 temp = start[offset];
880 if ((temp != pattern) && (offset != test_offset)) {
881 printf ("\nFAILURE: Address bit stuck low or shorted @"
882 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
883 (ulong)&start[offset], pattern, temp);
884 return 1;
885 }
886 }
887 start[test_offset] = pattern;
888 }
889
890 /*
891 * Description: Test the integrity of a physical
892 * memory device by performing an
893 * increment/decrement test over the
894 * entire region. In the process every
895 * storage bit in the device is tested
896 * as a zero and a one. The base address
897 * and the size of the region are
898 * selected by the caller.
899 *
900 * Returns: 0 if the test succeeds, 1 if the test fails.
901 */
902 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
903
904 /*
905 * Fill memory with a known pattern.
906 */
907 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
908 start[offset] = pattern;
909 }
910
911 /*
912 * Check each location and invert it for the second pass.
913 */
914 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
915 temp = start[offset];
916 if (temp != pattern) {
917 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
918 " expected 0x%.8lx, actual 0x%.8lx)\n",
919 (ulong)&start[offset], pattern, temp);
920 return 1;
921 }
922
923 anti_pattern = ~pattern;
924 start[offset] = anti_pattern;
925 }
926
927 /*
928 * Check each location for the inverted pattern and zero it.
929 */
930 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
931 anti_pattern = ~pattern;
932 temp = start[offset];
933 if (temp != anti_pattern) {
934 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
935 " expected 0x%.8lx, actual 0x%.8lx)\n",
936 (ulong)&start[offset], anti_pattern, temp);
937 return 1;
938 }
939 start[offset] = 0;
940 }
941 }
942
943#else /* The original, quickie test */
944 incr = 1;
945 for (;;) {
946 if (ctrlc()) {
947 putc ('\n');
948 return 1;
949 }
950
951 printf ("\rPattern %08lX Writing..."
952 "%12s"
953 "\b\b\b\b\b\b\b\b\b\b",
954 pattern, "");
955
956 for (addr=start,val=pattern; addr<end; addr++) {
957 *addr = val;
958 val += incr;
959 }
960
wdenk42c05472004-03-23 22:14:11 +0000961 puts ("Reading...");
wdenk38635852002-08-27 05:55:31 +0000962
963 for (addr=start,val=pattern; addr<end; addr++) {
964 readback = *addr;
965 if (readback != val) {
966 printf ("\nMem error @ 0x%08X: "
967 "found %08lX, expected %08lX\n",
968 (uint)addr, readback, val);
969 rcode = 1;
970 }
971 val += incr;
972 }
973
974 /*
975 * Flip the pattern each time to make lots of zeros and
976 * then, the next time, lots of ones. We decrement
977 * the "negative" patterns and increment the "positive"
978 * patterns to preserve this feature.
979 */
980 if(pattern & 0x80000000) {
981 pattern = -pattern; /* complement & increment */
982 }
983 else {
984 pattern = ~pattern;
985 }
986 incr = -incr;
987 }
wdenk38635852002-08-27 05:55:31 +0000988#endif
Guennadi Liakhovetski4de85712008-02-13 11:19:19 +0100989 return rcode;
wdenk38635852002-08-27 05:55:31 +0000990}
991
992
993/* Modify memory.
994 *
995 * Syntax:
996 * mm{.b, .w, .l} {addr}
997 * nm{.b, .w, .l} {addr}
998 */
999static int
1000mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
1001{
wdenk874ac262003-07-24 23:38:38 +00001002 ulong addr, i;
1003 int nbytes, size;
wdenk38635852002-08-27 05:55:31 +00001004 extern char console_buffer[];
1005
1006 if (argc != 2) {
1007 printf ("Usage:\n%s\n", cmdtp->usage);
1008 return 1;
1009 }
1010
1011#ifdef CONFIG_BOOT_RETRY_TIME
1012 reset_cmd_timeout(); /* got a good command to get here */
1013#endif
1014 /* We use the last specified parameters, unless new ones are
1015 * entered.
1016 */
1017 addr = mm_last_addr;
1018 size = mm_last_size;
1019
1020 if ((flag & CMD_FLAG_REPEAT) == 0) {
1021 /* New command specified. Check for a size specification.
1022 * Defaults to long if no or incorrect specification.
1023 */
wdenk874ac262003-07-24 23:38:38 +00001024 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1025 return 1;
wdenk38635852002-08-27 05:55:31 +00001026
1027 /* Address is specified since argc > 1
1028 */
1029 addr = simple_strtoul(argv[1], NULL, 16);
1030 addr += base_address;
1031 }
1032
wdenk381669a2003-06-16 23:50:08 +00001033#ifdef CONFIG_HAS_DATAFLASH
1034 if (addr_dataflash(addr)){
wdenk42c05472004-03-23 22:14:11 +00001035 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
wdenk381669a2003-06-16 23:50:08 +00001036 return 0;
1037 }
1038#endif
1039
Mike Frysingere578d682008-02-04 19:26:56 -05001040#ifdef CONFIG_BLACKFIN
1041 if (addr_bfin_on_chip_mem(addr)) {
1042 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
1043 return 0;
1044 }
1045#endif
1046
wdenk38635852002-08-27 05:55:31 +00001047 /* Print the address, followed by value. Then accept input for
1048 * the next value. A non-converted value exits.
1049 */
1050 do {
1051 printf("%08lx:", addr);
1052 if (size == 4)
1053 printf(" %08x", *((uint *)addr));
1054 else if (size == 2)
1055 printf(" %04x", *((ushort *)addr));
1056 else
1057 printf(" %02x", *((u_char *)addr));
1058
1059 nbytes = readline (" ? ");
1060 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1061 /* <CR> pressed as only input, don't modify current
1062 * location and move to next. "-" pressed will go back.
1063 */
1064 if (incrflag)
1065 addr += nbytes ? -size : size;
1066 nbytes = 1;
1067#ifdef CONFIG_BOOT_RETRY_TIME
1068 reset_cmd_timeout(); /* good enough to not time out */
1069#endif
1070 }
1071#ifdef CONFIG_BOOT_RETRY_TIME
1072 else if (nbytes == -2) {
1073 break; /* timed out, exit the command */
1074 }
1075#endif
1076 else {
1077 char *endp;
1078 i = simple_strtoul(console_buffer, &endp, 16);
1079 nbytes = endp - console_buffer;
1080 if (nbytes) {
1081#ifdef CONFIG_BOOT_RETRY_TIME
1082 /* good enough to not time out
1083 */
1084 reset_cmd_timeout();
1085#endif
1086 if (size == 4)
1087 *((uint *)addr) = i;
1088 else if (size == 2)
1089 *((ushort *)addr) = i;
1090 else
1091 *((u_char *)addr) = i;
1092 if (incrflag)
1093 addr += size;
1094 }
1095 }
1096 } while (nbytes);
1097
1098 mm_last_addr = addr;
1099 mm_last_size = size;
1100 return 0;
1101}
1102
wdenk6203e402004-04-18 10:13:26 +00001103#ifndef CONFIG_CRC32_VERIFY
1104
wdenk38635852002-08-27 05:55:31 +00001105int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1106{
wdenk7a428cc2003-06-15 22:40:42 +00001107 ulong addr, length;
1108 ulong crc;
1109 ulong *ptr;
wdenk38635852002-08-27 05:55:31 +00001110
1111 if (argc < 3) {
1112 printf ("Usage:\n%s\n", cmdtp->usage);
1113 return 1;
1114 }
1115
wdenk7a428cc2003-06-15 22:40:42 +00001116 addr = simple_strtoul (argv[1], NULL, 16);
wdenk38635852002-08-27 05:55:31 +00001117 addr += base_address;
1118
wdenk7a428cc2003-06-15 22:40:42 +00001119 length = simple_strtoul (argv[2], NULL, 16);
wdenk38635852002-08-27 05:55:31 +00001120
wdenk7a428cc2003-06-15 22:40:42 +00001121 crc = crc32 (0, (const uchar *) addr, length);
wdenk38635852002-08-27 05:55:31 +00001122
1123 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
wdenk7a428cc2003-06-15 22:40:42 +00001124 addr, addr + length - 1, crc);
wdenk38635852002-08-27 05:55:31 +00001125
wdenk7a428cc2003-06-15 22:40:42 +00001126 if (argc > 3) {
1127 ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
1128 *ptr = crc;
1129 }
wdenk38635852002-08-27 05:55:31 +00001130
1131 return 0;
1132}
1133
wdenk6203e402004-04-18 10:13:26 +00001134#else /* CONFIG_CRC32_VERIFY */
1135
1136int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1137{
1138 ulong addr, length;
1139 ulong crc;
1140 ulong *ptr;
wdenk05939202004-04-18 17:39:38 +00001141 ulong vcrc;
wdenk6203e402004-04-18 10:13:26 +00001142 int verify;
1143 int ac;
1144 char **av;
1145
1146 if (argc < 3) {
1147 usage:
1148 printf ("Usage:\n%s\n", cmdtp->usage);
1149 return 1;
1150 }
1151
1152 av = argv + 1;
1153 ac = argc - 1;
1154 if (strcmp(*av, "-v") == 0) {
1155 verify = 1;
1156 av++;
1157 ac--;
1158 if (ac < 3)
1159 goto usage;
1160 } else
1161 verify = 0;
1162
1163 addr = simple_strtoul(*av++, NULL, 16);
1164 addr += base_address;
1165 length = simple_strtoul(*av++, NULL, 16);
1166
1167 crc = crc32(0, (const uchar *) addr, length);
1168
1169 if (!verify) {
1170 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1171 addr, addr + length - 1, crc);
1172 if (ac > 2) {
1173 ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
1174 *ptr = crc;
1175 }
1176 } else {
1177 vcrc = simple_strtoul(*av++, NULL, 16);
1178 if (vcrc != crc) {
1179 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1180 addr, addr + length - 1, crc, vcrc);
1181 return 1;
1182 }
1183 }
1184
1185 return 0;
1186
1187}
1188#endif /* CONFIG_CRC32_VERIFY */
1189
wdenk57b2d802003-06-27 21:31:46 +00001190/**************************************************/
Jon Loeligerd76b5c12007-07-08 18:02:23 -05001191#if defined(CONFIG_CMD_MEMORY)
wdenkf287a242003-07-01 21:06:45 +00001192U_BOOT_CMD(
1193 md, 3, 1, do_mem_md,
wdenk57b2d802003-06-27 21:31:46 +00001194 "md - memory display\n",
1195 "[.b, .w, .l] address [# of objects]\n - memory display\n"
1196);
1197
1198
wdenkf287a242003-07-01 21:06:45 +00001199U_BOOT_CMD(
1200 mm, 2, 1, do_mem_mm,
wdenk57b2d802003-06-27 21:31:46 +00001201 "mm - memory modify (auto-incrementing)\n",
1202 "[.b, .w, .l] address\n" " - memory modify, auto increment address\n"
1203);
1204
1205
wdenkf287a242003-07-01 21:06:45 +00001206U_BOOT_CMD(
1207 nm, 2, 1, do_mem_nm,
wdenk57b2d802003-06-27 21:31:46 +00001208 "nm - memory modify (constant address)\n",
1209 "[.b, .w, .l] address\n - memory modify, read and keep address\n"
1210);
1211
wdenkf287a242003-07-01 21:06:45 +00001212U_BOOT_CMD(
1213 mw, 4, 1, do_mem_mw,
wdenk57b2d802003-06-27 21:31:46 +00001214 "mw - memory write (fill)\n",
1215 "[.b, .w, .l] address value [count]\n - write memory\n"
1216);
1217
wdenkf287a242003-07-01 21:06:45 +00001218U_BOOT_CMD(
1219 cp, 4, 1, do_mem_cp,
wdenk57b2d802003-06-27 21:31:46 +00001220 "cp - memory copy\n",
1221 "[.b, .w, .l] source target count\n - copy memory\n"
1222);
1223
wdenkf287a242003-07-01 21:06:45 +00001224U_BOOT_CMD(
1225 cmp, 4, 1, do_mem_cmp,
wdenk57b2d802003-06-27 21:31:46 +00001226 "cmp - memory compare\n",
1227 "[.b, .w, .l] addr1 addr2 count\n - compare memory\n"
1228);
1229
wdenk6203e402004-04-18 10:13:26 +00001230#ifndef CONFIG_CRC32_VERIFY
1231
wdenkf287a242003-07-01 21:06:45 +00001232U_BOOT_CMD(
1233 crc32, 4, 1, do_mem_crc,
wdenk57b2d802003-06-27 21:31:46 +00001234 "crc32 - checksum calculation\n",
1235 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1236);
1237
wdenk6203e402004-04-18 10:13:26 +00001238#else /* CONFIG_CRC32_VERIFY */
1239
1240U_BOOT_CMD(
1241 crc32, 5, 1, do_mem_crc,
1242 "crc32 - checksum calculation\n",
1243 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1244 "-v address count crc\n - verify crc of memory area\n"
1245);
1246
1247#endif /* CONFIG_CRC32_VERIFY */
1248
wdenkf287a242003-07-01 21:06:45 +00001249U_BOOT_CMD(
1250 base, 2, 1, do_mem_base,
wdenk57b2d802003-06-27 21:31:46 +00001251 "base - print or set address offset\n",
1252 "\n - print address offset for memory commands\n"
1253 "base off\n - set address offset for memory commands to 'off'\n"
1254);
1255
wdenkf287a242003-07-01 21:06:45 +00001256U_BOOT_CMD(
1257 loop, 3, 1, do_mem_loop,
wdenk57b2d802003-06-27 21:31:46 +00001258 "loop - infinite loop on address range\n",
1259 "[.b, .w, .l] address number_of_objects\n"
1260 " - loop on a set of addresses\n"
1261);
wdenk64519362004-07-11 17:40:54 +00001262
1263#ifdef CONFIG_LOOPW
1264U_BOOT_CMD(
1265 loopw, 4, 1, do_mem_loopw,
1266 "loopw - infinite write loop on address range\n",
1267 "[.b, .w, .l] address number_of_objects data_to_write\n"
1268 " - loop on a set of addresses\n"
1269);
1270#endif /* CONFIG_LOOPW */
wdenk57b2d802003-06-27 21:31:46 +00001271
wdenkf287a242003-07-01 21:06:45 +00001272U_BOOT_CMD(
1273 mtest, 4, 1, do_mem_mtest,
wdenk57b2d802003-06-27 21:31:46 +00001274 "mtest - simple RAM test\n",
1275 "[start [end [pattern]]]\n"
1276 " - simple RAM read/write test\n"
1277);
stroesefb5e0ac2004-12-16 17:42:39 +00001278
1279#ifdef CONFIG_MX_CYCLIC
1280U_BOOT_CMD(
1281 mdc, 4, 1, do_mem_mdc,
1282 "mdc - memory display cyclic\n",
1283 "[.b, .w, .l] address count delay(ms)\n - memory display cyclic\n"
1284);
1285
1286U_BOOT_CMD(
1287 mwc, 4, 1, do_mem_mwc,
1288 "mwc - memory write cyclic\n",
1289 "[.b, .w, .l] address value delay(ms)\n - memory write cyclic\n"
1290);
1291#endif /* CONFIG_MX_CYCLIC */
wdenk57b2d802003-06-27 21:31:46 +00001292
1293#endif
Jon Loeligerd704d912007-07-10 11:02:44 -05001294#endif