wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1 | /* |
| 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 Loeliger | c76fe47 | 2007-07-08 18:02:23 -0500 | [diff] [blame] | 32 | #if defined(CONFIG_CMD_MMC) |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 33 | #include <mmc.h> |
| 34 | #endif |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 35 | #ifdef CONFIG_HAS_DATAFLASH |
| 36 | #include <dataflash.h> |
| 37 | #endif |
Sergei Poselenov | a6e6fc6 | 2008-04-09 16:09:41 +0200 | [diff] [blame] | 38 | #include <watchdog.h> |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 39 | |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 40 | #ifdef CMD_MEM_DEBUG |
| 41 | #define PRINTF(fmt,args...) printf (fmt ,##args) |
| 42 | #else |
| 43 | #define PRINTF(fmt,args...) |
| 44 | #endif |
| 45 | |
| 46 | static int mod_mem(cmd_tbl_t *, int, int, int, char *[]); |
| 47 | |
| 48 | /* Display values from last command. |
| 49 | * Memory modify remembered values are different from display memory. |
| 50 | */ |
| 51 | uint dp_last_addr, dp_last_size; |
| 52 | uint dp_last_length = 0x40; |
| 53 | uint mm_last_addr, mm_last_size; |
| 54 | |
| 55 | static ulong base_address = 0; |
| 56 | |
| 57 | /* Memory Display |
| 58 | * |
| 59 | * Syntax: |
| 60 | * md{.b, .w, .l} {addr} {len} |
| 61 | */ |
| 62 | #define DISP_LINE_LEN 16 |
| 63 | int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 64 | { |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 65 | ulong addr, length; |
Grant Likely | c95c428 | 2007-02-20 09:05:00 +0100 | [diff] [blame] | 66 | #if defined(CONFIG_HAS_DATAFLASH) |
| 67 | ulong nbytes, linebytes; |
| 68 | #endif |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 69 | int size; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 70 | int rc = 0; |
| 71 | |
| 72 | /* We use the last specified parameters, unless new ones are |
| 73 | * entered. |
| 74 | */ |
| 75 | addr = dp_last_addr; |
| 76 | size = dp_last_size; |
| 77 | length = dp_last_length; |
| 78 | |
| 79 | if (argc < 2) { |
| 80 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 81 | return 1; |
| 82 | } |
| 83 | |
| 84 | if ((flag & CMD_FLAG_REPEAT) == 0) { |
| 85 | /* New command specified. Check for a size specification. |
| 86 | * Defaults to long if no or incorrect specification. |
| 87 | */ |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 88 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
| 89 | return 1; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 90 | |
| 91 | /* Address is specified since argc > 1 |
| 92 | */ |
| 93 | addr = simple_strtoul(argv[1], NULL, 16); |
| 94 | addr += base_address; |
| 95 | |
| 96 | /* If another parameter, it is the length to display. |
| 97 | * Length is the number of objects, not number of bytes. |
| 98 | */ |
| 99 | if (argc > 2) |
| 100 | length = simple_strtoul(argv[2], NULL, 16); |
| 101 | } |
| 102 | |
Grant Likely | c95c428 | 2007-02-20 09:05:00 +0100 | [diff] [blame] | 103 | #if defined(CONFIG_HAS_DATAFLASH) |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 104 | /* Print the lines. |
| 105 | * |
| 106 | * We buffer all read data, so we can make sure data is read only |
| 107 | * once, and all accesses are with the specified bus width. |
| 108 | */ |
| 109 | nbytes = length * size; |
| 110 | do { |
| 111 | char linebuf[DISP_LINE_LEN]; |
Grant Likely | c95c428 | 2007-02-20 09:05:00 +0100 | [diff] [blame] | 112 | void* p; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 113 | linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes; |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 114 | |
Grant Likely | c95c428 | 2007-02-20 09:05:00 +0100 | [diff] [blame] | 115 | rc = read_dataflash(addr, (linebytes/size)*size, linebuf); |
| 116 | p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr; |
| 117 | print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 118 | |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 119 | nbytes -= linebytes; |
Grant Likely | c95c428 | 2007-02-20 09:05:00 +0100 | [diff] [blame] | 120 | addr += linebytes; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 121 | if (ctrlc()) { |
| 122 | rc = 1; |
| 123 | break; |
| 124 | } |
| 125 | } while (nbytes > 0); |
Grant Likely | c95c428 | 2007-02-20 09:05:00 +0100 | [diff] [blame] | 126 | #else |
Mike Frysinger | 4c727c7 | 2008-02-04 19:26:56 -0500 | [diff] [blame] | 127 | |
| 128 | # if defined(CONFIG_BLACKFIN) |
| 129 | /* See if we're trying to display L1 inst */ |
| 130 | if (addr_bfin_on_chip_mem(addr)) { |
| 131 | char linebuf[DISP_LINE_LEN]; |
| 132 | ulong linebytes, nbytes = length * size; |
| 133 | do { |
| 134 | linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes; |
| 135 | memcpy(linebuf, (void *)addr, linebytes); |
| 136 | print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size); |
| 137 | |
| 138 | nbytes -= linebytes; |
| 139 | addr += linebytes; |
| 140 | if (ctrlc()) { |
| 141 | rc = 1; |
| 142 | break; |
| 143 | } |
| 144 | } while (nbytes > 0); |
| 145 | } else |
| 146 | # endif |
| 147 | |
| 148 | { |
| 149 | /* Print the lines. */ |
| 150 | print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size); |
| 151 | addr += size*length; |
| 152 | } |
Grant Likely | c95c428 | 2007-02-20 09:05:00 +0100 | [diff] [blame] | 153 | #endif |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 154 | |
| 155 | dp_last_addr = addr; |
| 156 | dp_last_length = length; |
| 157 | dp_last_size = size; |
| 158 | return (rc); |
| 159 | } |
| 160 | |
| 161 | int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 162 | { |
| 163 | return mod_mem (cmdtp, 1, flag, argc, argv); |
| 164 | } |
| 165 | int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 166 | { |
| 167 | return mod_mem (cmdtp, 0, flag, argc, argv); |
| 168 | } |
| 169 | |
| 170 | int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 171 | { |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 172 | ulong addr, writeval, count; |
| 173 | int size; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 174 | |
| 175 | if ((argc < 3) || (argc > 4)) { |
| 176 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 177 | return 1; |
| 178 | } |
| 179 | |
| 180 | /* Check for size specification. |
| 181 | */ |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 182 | if ((size = cmd_get_data_size(argv[0], 4)) < 1) |
| 183 | return 1; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 184 | |
| 185 | /* Address is specified since argc > 1 |
| 186 | */ |
| 187 | addr = simple_strtoul(argv[1], NULL, 16); |
| 188 | addr += base_address; |
| 189 | |
| 190 | /* Get the value to write. |
| 191 | */ |
| 192 | writeval = simple_strtoul(argv[2], NULL, 16); |
| 193 | |
| 194 | /* Count ? */ |
| 195 | if (argc == 4) { |
| 196 | count = simple_strtoul(argv[3], NULL, 16); |
| 197 | } else { |
| 198 | count = 1; |
| 199 | } |
| 200 | |
| 201 | while (count-- > 0) { |
| 202 | if (size == 4) |
| 203 | *((ulong *)addr) = (ulong )writeval; |
| 204 | else if (size == 2) |
| 205 | *((ushort *)addr) = (ushort)writeval; |
| 206 | else |
| 207 | *((u_char *)addr) = (u_char)writeval; |
| 208 | addr += size; |
| 209 | } |
| 210 | return 0; |
| 211 | } |
| 212 | |
stroese | 4aaf29b | 2004-12-16 17:42:39 +0000 | [diff] [blame] | 213 | #ifdef CONFIG_MX_CYCLIC |
| 214 | int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 215 | { |
| 216 | int i; |
| 217 | ulong count; |
| 218 | |
| 219 | if (argc < 4) { |
| 220 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 221 | return 1; |
| 222 | } |
| 223 | |
| 224 | count = simple_strtoul(argv[3], NULL, 10); |
| 225 | |
| 226 | for (;;) { |
| 227 | do_mem_md (NULL, 0, 3, argv); |
| 228 | |
| 229 | /* delay for <count> ms... */ |
| 230 | for (i=0; i<count; i++) |
| 231 | udelay (1000); |
| 232 | |
| 233 | /* check for ctrl-c to abort... */ |
| 234 | if (ctrlc()) { |
| 235 | puts("Abort\n"); |
| 236 | return 0; |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | return 0; |
| 241 | } |
| 242 | |
| 243 | int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 244 | { |
| 245 | int i; |
| 246 | ulong count; |
| 247 | |
| 248 | if (argc < 4) { |
| 249 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 250 | return 1; |
| 251 | } |
| 252 | |
| 253 | count = simple_strtoul(argv[3], NULL, 10); |
| 254 | |
| 255 | for (;;) { |
| 256 | do_mem_mw (NULL, 0, 3, argv); |
| 257 | |
| 258 | /* delay for <count> ms... */ |
| 259 | for (i=0; i<count; i++) |
| 260 | udelay (1000); |
| 261 | |
| 262 | /* check for ctrl-c to abort... */ |
| 263 | if (ctrlc()) { |
| 264 | puts("Abort\n"); |
| 265 | return 0; |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | return 0; |
| 270 | } |
| 271 | #endif /* CONFIG_MX_CYCLIC */ |
| 272 | |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 273 | int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 274 | { |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 275 | ulong addr1, addr2, count, ngood; |
| 276 | int size; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 277 | int rcode = 0; |
| 278 | |
| 279 | if (argc != 4) { |
| 280 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 281 | return 1; |
| 282 | } |
| 283 | |
| 284 | /* Check for size specification. |
| 285 | */ |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 286 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
| 287 | return 1; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 288 | |
| 289 | addr1 = simple_strtoul(argv[1], NULL, 16); |
| 290 | addr1 += base_address; |
| 291 | |
| 292 | addr2 = simple_strtoul(argv[2], NULL, 16); |
| 293 | addr2 += base_address; |
| 294 | |
| 295 | count = simple_strtoul(argv[3], NULL, 16); |
| 296 | |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 297 | #ifdef CONFIG_HAS_DATAFLASH |
| 298 | if (addr_dataflash(addr1) | addr_dataflash(addr2)){ |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 299 | puts ("Comparison with DataFlash space not supported.\n\r"); |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 300 | return 0; |
| 301 | } |
| 302 | #endif |
| 303 | |
Mike Frysinger | 4c727c7 | 2008-02-04 19:26:56 -0500 | [diff] [blame] | 304 | #ifdef CONFIG_BLACKFIN |
| 305 | if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) { |
| 306 | puts ("Comparison with L1 instruction memory not supported.\n\r"); |
| 307 | return 0; |
| 308 | } |
| 309 | #endif |
| 310 | |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 311 | ngood = 0; |
| 312 | |
| 313 | while (count-- > 0) { |
| 314 | if (size == 4) { |
| 315 | ulong word1 = *(ulong *)addr1; |
| 316 | ulong word2 = *(ulong *)addr2; |
| 317 | if (word1 != word2) { |
| 318 | printf("word at 0x%08lx (0x%08lx) " |
| 319 | "!= word at 0x%08lx (0x%08lx)\n", |
| 320 | addr1, word1, addr2, word2); |
| 321 | rcode = 1; |
| 322 | break; |
| 323 | } |
| 324 | } |
| 325 | else if (size == 2) { |
| 326 | ushort hword1 = *(ushort *)addr1; |
| 327 | ushort hword2 = *(ushort *)addr2; |
| 328 | if (hword1 != hword2) { |
| 329 | printf("halfword at 0x%08lx (0x%04x) " |
| 330 | "!= halfword at 0x%08lx (0x%04x)\n", |
| 331 | addr1, hword1, addr2, hword2); |
| 332 | rcode = 1; |
| 333 | break; |
| 334 | } |
| 335 | } |
| 336 | else { |
| 337 | u_char byte1 = *(u_char *)addr1; |
| 338 | u_char byte2 = *(u_char *)addr2; |
| 339 | if (byte1 != byte2) { |
| 340 | printf("byte at 0x%08lx (0x%02x) " |
| 341 | "!= byte at 0x%08lx (0x%02x)\n", |
| 342 | addr1, byte1, addr2, byte2); |
| 343 | rcode = 1; |
| 344 | break; |
| 345 | } |
| 346 | } |
| 347 | ngood++; |
| 348 | addr1 += size; |
| 349 | addr2 += size; |
| 350 | } |
| 351 | |
| 352 | printf("Total of %ld %s%s were the same\n", |
| 353 | ngood, size == 4 ? "word" : size == 2 ? "halfword" : "byte", |
| 354 | ngood == 1 ? "" : "s"); |
| 355 | return rcode; |
| 356 | } |
| 357 | |
| 358 | int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 359 | { |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 360 | ulong addr, dest, count; |
| 361 | int size; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 362 | |
| 363 | if (argc != 4) { |
| 364 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 365 | return 1; |
| 366 | } |
| 367 | |
| 368 | /* Check for size specification. |
| 369 | */ |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 370 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
| 371 | return 1; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 372 | |
| 373 | addr = simple_strtoul(argv[1], NULL, 16); |
| 374 | addr += base_address; |
| 375 | |
| 376 | dest = simple_strtoul(argv[2], NULL, 16); |
| 377 | dest += base_address; |
| 378 | |
| 379 | count = simple_strtoul(argv[3], NULL, 16); |
| 380 | |
| 381 | if (count == 0) { |
| 382 | puts ("Zero length ???\n"); |
| 383 | return 1; |
| 384 | } |
| 385 | |
| 386 | #ifndef CFG_NO_FLASH |
| 387 | /* check if we are copying to Flash */ |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 388 | if ( (addr2info(dest) != NULL) |
| 389 | #ifdef CONFIG_HAS_DATAFLASH |
Kim B. Heino | 84d0c2f | 2008-03-03 10:39:13 +0200 | [diff] [blame] | 390 | && (!addr_dataflash(dest)) |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 391 | #endif |
| 392 | ) { |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 393 | int rc; |
| 394 | |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 395 | puts ("Copy to Flash... "); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 396 | |
Wolfgang Denk | 77ddac9 | 2005-10-13 16:45:02 +0200 | [diff] [blame] | 397 | rc = flash_write ((char *)addr, dest, count*size); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 398 | if (rc != 0) { |
| 399 | flash_perror (rc); |
| 400 | return (1); |
| 401 | } |
| 402 | puts ("done\n"); |
| 403 | return 0; |
| 404 | } |
| 405 | #endif |
| 406 | |
Jon Loeliger | c76fe47 | 2007-07-08 18:02:23 -0500 | [diff] [blame] | 407 | #if defined(CONFIG_CMD_MMC) |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 408 | if (mmc2info(dest)) { |
| 409 | int rc; |
| 410 | |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 411 | puts ("Copy to MMC... "); |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 412 | switch (rc = mmc_write ((uchar *)addr, dest, count*size)) { |
| 413 | case 0: |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 414 | putc ('\n'); |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 415 | return 1; |
| 416 | case -1: |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 417 | puts ("failed\n"); |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 418 | return 1; |
| 419 | default: |
| 420 | printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc); |
| 421 | return 1; |
| 422 | } |
| 423 | puts ("done\n"); |
| 424 | return 0; |
| 425 | } |
| 426 | |
| 427 | if (mmc2info(addr)) { |
| 428 | int rc; |
| 429 | |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 430 | puts ("Copy from MMC... "); |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 431 | switch (rc = mmc_read (addr, (uchar *)dest, count*size)) { |
| 432 | case 0: |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 433 | putc ('\n'); |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 434 | return 1; |
| 435 | case -1: |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 436 | puts ("failed\n"); |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 437 | return 1; |
| 438 | default: |
| 439 | printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc); |
| 440 | return 1; |
| 441 | } |
| 442 | puts ("done\n"); |
| 443 | return 0; |
| 444 | } |
| 445 | #endif |
| 446 | |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 447 | #ifdef CONFIG_HAS_DATAFLASH |
| 448 | /* Check if we are copying from RAM or Flash to DataFlash */ |
| 449 | if (addr_dataflash(dest) && !addr_dataflash(addr)){ |
| 450 | int rc; |
| 451 | |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 452 | puts ("Copy to DataFlash... "); |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 453 | |
| 454 | rc = write_dataflash (dest, addr, count*size); |
| 455 | |
| 456 | if (rc != 1) { |
| 457 | dataflash_perror (rc); |
| 458 | return (1); |
| 459 | } |
| 460 | puts ("done\n"); |
| 461 | return 0; |
| 462 | } |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 463 | |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 464 | /* Check if we are copying from DataFlash to RAM */ |
Stelian Pop | 880cc43 | 2008-03-26 22:52:35 +0100 | [diff] [blame] | 465 | if (addr_dataflash(addr) && !addr_dataflash(dest) |
| 466 | #ifndef CFG_NO_FLASH |
| 467 | && (addr2info(dest) == NULL) |
| 468 | #endif |
| 469 | ){ |
wdenk | 5779d8d | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 470 | int rc; |
| 471 | rc = read_dataflash(addr, count * size, (char *) dest); |
| 472 | if (rc != 1) { |
wdenk | d4ca31c | 2004-01-02 14:00:00 +0000 | [diff] [blame] | 473 | dataflash_perror (rc); |
| 474 | return (1); |
| 475 | } |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 476 | return 0; |
| 477 | } |
| 478 | |
| 479 | if (addr_dataflash(addr) && addr_dataflash(dest)){ |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 480 | puts ("Unsupported combination of source/destination.\n\r"); |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 481 | return 1; |
| 482 | } |
| 483 | #endif |
| 484 | |
Mike Frysinger | 4c727c7 | 2008-02-04 19:26:56 -0500 | [diff] [blame] | 485 | #ifdef CONFIG_BLACKFIN |
| 486 | /* See if we're copying to/from L1 inst */ |
| 487 | if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) { |
| 488 | memcpy((void *)dest, (void *)addr, count * size); |
| 489 | return 0; |
| 490 | } |
| 491 | #endif |
| 492 | |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 493 | while (count-- > 0) { |
| 494 | if (size == 4) |
| 495 | *((ulong *)dest) = *((ulong *)addr); |
| 496 | else if (size == 2) |
| 497 | *((ushort *)dest) = *((ushort *)addr); |
| 498 | else |
| 499 | *((u_char *)dest) = *((u_char *)addr); |
| 500 | addr += size; |
| 501 | dest += size; |
| 502 | } |
| 503 | return 0; |
| 504 | } |
| 505 | |
| 506 | int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 507 | { |
| 508 | if (argc > 1) { |
| 509 | /* Set new base address. |
| 510 | */ |
| 511 | base_address = simple_strtoul(argv[1], NULL, 16); |
| 512 | } |
| 513 | /* Print the current base address. |
| 514 | */ |
| 515 | printf("Base Address: 0x%08lx\n", base_address); |
| 516 | return 0; |
| 517 | } |
| 518 | |
| 519 | int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 520 | { |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 521 | ulong addr, length, i, junk; |
| 522 | int size; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 523 | volatile uint *longp; |
| 524 | volatile ushort *shortp; |
| 525 | volatile u_char *cp; |
| 526 | |
| 527 | if (argc < 3) { |
| 528 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 529 | return 1; |
| 530 | } |
| 531 | |
| 532 | /* Check for a size spefication. |
| 533 | * Defaults to long if no or incorrect specification. |
| 534 | */ |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 535 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
| 536 | return 1; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 537 | |
| 538 | /* Address is always specified. |
| 539 | */ |
| 540 | addr = simple_strtoul(argv[1], NULL, 16); |
| 541 | |
| 542 | /* Length is the number of objects, not number of bytes. |
| 543 | */ |
| 544 | length = simple_strtoul(argv[2], NULL, 16); |
| 545 | |
| 546 | /* We want to optimize the loops to run as fast as possible. |
| 547 | * If we have only one object, just run infinite loops. |
| 548 | */ |
| 549 | if (length == 1) { |
| 550 | if (size == 4) { |
| 551 | longp = (uint *)addr; |
| 552 | for (;;) |
| 553 | i = *longp; |
| 554 | } |
| 555 | if (size == 2) { |
| 556 | shortp = (ushort *)addr; |
| 557 | for (;;) |
| 558 | i = *shortp; |
| 559 | } |
| 560 | cp = (u_char *)addr; |
| 561 | for (;;) |
| 562 | i = *cp; |
| 563 | } |
| 564 | |
| 565 | if (size == 4) { |
| 566 | for (;;) { |
| 567 | longp = (uint *)addr; |
| 568 | i = length; |
| 569 | while (i-- > 0) |
| 570 | junk = *longp++; |
| 571 | } |
| 572 | } |
| 573 | if (size == 2) { |
| 574 | for (;;) { |
| 575 | shortp = (ushort *)addr; |
| 576 | i = length; |
| 577 | while (i-- > 0) |
| 578 | junk = *shortp++; |
| 579 | } |
| 580 | } |
| 581 | for (;;) { |
| 582 | cp = (u_char *)addr; |
| 583 | i = length; |
| 584 | while (i-- > 0) |
| 585 | junk = *cp++; |
| 586 | } |
| 587 | } |
| 588 | |
wdenk | 56523f1 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 589 | #ifdef CONFIG_LOOPW |
| 590 | int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 591 | { |
| 592 | ulong addr, length, i, data; |
| 593 | int size; |
| 594 | volatile uint *longp; |
| 595 | volatile ushort *shortp; |
| 596 | volatile u_char *cp; |
wdenk | 8105092 | 2004-07-11 20:04:51 +0000 | [diff] [blame] | 597 | |
wdenk | 56523f1 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 598 | if (argc < 4) { |
| 599 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 600 | return 1; |
| 601 | } |
| 602 | |
| 603 | /* Check for a size spefication. |
| 604 | * Defaults to long if no or incorrect specification. |
| 605 | */ |
| 606 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
| 607 | return 1; |
| 608 | |
| 609 | /* Address is always specified. |
| 610 | */ |
| 611 | addr = simple_strtoul(argv[1], NULL, 16); |
| 612 | |
| 613 | /* Length is the number of objects, not number of bytes. |
| 614 | */ |
| 615 | length = simple_strtoul(argv[2], NULL, 16); |
| 616 | |
| 617 | /* data to write */ |
| 618 | data = simple_strtoul(argv[3], NULL, 16); |
wdenk | 8105092 | 2004-07-11 20:04:51 +0000 | [diff] [blame] | 619 | |
wdenk | 56523f1 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 620 | /* We want to optimize the loops to run as fast as possible. |
| 621 | * If we have only one object, just run infinite loops. |
| 622 | */ |
| 623 | if (length == 1) { |
| 624 | if (size == 4) { |
| 625 | longp = (uint *)addr; |
| 626 | for (;;) |
| 627 | *longp = data; |
| 628 | } |
| 629 | if (size == 2) { |
| 630 | shortp = (ushort *)addr; |
| 631 | for (;;) |
| 632 | *shortp = data; |
| 633 | } |
| 634 | cp = (u_char *)addr; |
| 635 | for (;;) |
| 636 | *cp = data; |
| 637 | } |
| 638 | |
| 639 | if (size == 4) { |
| 640 | for (;;) { |
| 641 | longp = (uint *)addr; |
| 642 | i = length; |
| 643 | while (i-- > 0) |
| 644 | *longp++ = data; |
| 645 | } |
| 646 | } |
| 647 | if (size == 2) { |
| 648 | for (;;) { |
| 649 | shortp = (ushort *)addr; |
| 650 | i = length; |
| 651 | while (i-- > 0) |
| 652 | *shortp++ = data; |
| 653 | } |
| 654 | } |
| 655 | for (;;) { |
| 656 | cp = (u_char *)addr; |
| 657 | i = length; |
| 658 | while (i-- > 0) |
| 659 | *cp++ = data; |
| 660 | } |
| 661 | } |
| 662 | #endif /* CONFIG_LOOPW */ |
| 663 | |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 664 | /* |
| 665 | * Perform a memory test. A more complete alternative test can be |
| 666 | * configured using CFG_ALT_MEMTEST. The complete test loops until |
| 667 | * interrupted by ctrl-c or by a failure of one of the sub-tests. |
| 668 | */ |
| 669 | int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 670 | { |
| 671 | vu_long *addr, *start, *end; |
| 672 | ulong val; |
| 673 | ulong readback; |
Guennadi Liakhovetski | 1f780aa | 2008-02-13 11:19:19 +0100 | [diff] [blame] | 674 | int rcode = 0; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 675 | |
| 676 | #if defined(CFG_ALT_MEMTEST) |
Guennadi Liakhovetski | 6f4abee | 2008-02-08 21:25:58 +0100 | [diff] [blame] | 677 | vu_long len; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 678 | vu_long offset; |
| 679 | vu_long test_offset; |
| 680 | vu_long pattern; |
| 681 | vu_long temp; |
| 682 | vu_long anti_pattern; |
| 683 | vu_long num_words; |
wdenk | 5f535fe | 2003-09-18 09:21:33 +0000 | [diff] [blame] | 684 | #if defined(CFG_MEMTEST_SCRATCH) |
| 685 | vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH; |
| 686 | #else |
Wolfgang Denk | 029b6dc | 2006-07-21 11:37:40 +0200 | [diff] [blame] | 687 | vu_long *dummy = 0; /* yes, this is address 0x0, not NULL */ |
wdenk | 5f535fe | 2003-09-18 09:21:33 +0000 | [diff] [blame] | 688 | #endif |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 689 | int j; |
| 690 | int iterations = 1; |
| 691 | |
| 692 | static const ulong bitpattern[] = { |
| 693 | 0x00000001, /* single bit */ |
| 694 | 0x00000003, /* two adjacent bits */ |
| 695 | 0x00000007, /* three adjacent bits */ |
| 696 | 0x0000000F, /* four adjacent bits */ |
| 697 | 0x00000005, /* two non-adjacent bits */ |
| 698 | 0x00000015, /* three non-adjacent bits */ |
| 699 | 0x00000055, /* four non-adjacent bits */ |
| 700 | 0xaaaaaaaa, /* alternating 1/0 */ |
| 701 | }; |
| 702 | #else |
| 703 | ulong incr; |
| 704 | ulong pattern; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 705 | #endif |
| 706 | |
| 707 | if (argc > 1) { |
| 708 | start = (ulong *)simple_strtoul(argv[1], NULL, 16); |
| 709 | } else { |
| 710 | start = (ulong *)CFG_MEMTEST_START; |
| 711 | } |
| 712 | |
| 713 | if (argc > 2) { |
| 714 | end = (ulong *)simple_strtoul(argv[2], NULL, 16); |
| 715 | } else { |
| 716 | end = (ulong *)(CFG_MEMTEST_END); |
| 717 | } |
| 718 | |
| 719 | if (argc > 3) { |
| 720 | pattern = (ulong)simple_strtoul(argv[3], NULL, 16); |
| 721 | } else { |
| 722 | pattern = 0; |
| 723 | } |
| 724 | |
| 725 | #if defined(CFG_ALT_MEMTEST) |
| 726 | printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end); |
| 727 | PRINTF("%s:%d: start 0x%p end 0x%p\n", |
| 728 | __FUNCTION__, __LINE__, start, end); |
| 729 | |
| 730 | for (;;) { |
| 731 | if (ctrlc()) { |
| 732 | putc ('\n'); |
| 733 | return 1; |
| 734 | } |
| 735 | |
| 736 | printf("Iteration: %6d\r", iterations); |
| 737 | PRINTF("Iteration: %6d\n", iterations); |
| 738 | iterations++; |
| 739 | |
| 740 | /* |
| 741 | * Data line test: write a pattern to the first |
| 742 | * location, write the 1's complement to a 'parking' |
| 743 | * address (changes the state of the data bus so a |
| 744 | * floating bus doen't give a false OK), and then |
| 745 | * read the value back. Note that we read it back |
| 746 | * into a variable because the next time we read it, |
| 747 | * it might be right (been there, tough to explain to |
| 748 | * the quality guys why it prints a failure when the |
| 749 | * "is" and "should be" are obviously the same in the |
| 750 | * error message). |
| 751 | * |
| 752 | * Rather than exhaustively testing, we test some |
| 753 | * patterns by shifting '1' bits through a field of |
| 754 | * '0's and '0' bits through a field of '1's (i.e. |
| 755 | * pattern and ~pattern). |
| 756 | */ |
| 757 | addr = start; |
| 758 | for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) { |
| 759 | val = bitpattern[j]; |
| 760 | for(; val != 0; val <<= 1) { |
| 761 | *addr = val; |
| 762 | *dummy = ~val; /* clear the test data off of the bus */ |
| 763 | readback = *addr; |
| 764 | if(readback != val) { |
| 765 | printf ("FAILURE (data line): " |
| 766 | "expected %08lx, actual %08lx\n", |
| 767 | val, readback); |
| 768 | } |
| 769 | *addr = ~val; |
| 770 | *dummy = val; |
| 771 | readback = *addr; |
| 772 | if(readback != ~val) { |
| 773 | printf ("FAILURE (data line): " |
| 774 | "Is %08lx, should be %08lx\n", |
wdenk | e1599e8 | 2004-10-10 23:27:33 +0000 | [diff] [blame] | 775 | readback, ~val); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 776 | } |
| 777 | } |
| 778 | } |
| 779 | |
| 780 | /* |
| 781 | * Based on code whose Original Author and Copyright |
| 782 | * information follows: Copyright (c) 1998 by Michael |
| 783 | * Barr. This software is placed into the public |
| 784 | * domain and may be used for any purpose. However, |
| 785 | * this notice must not be changed or removed and no |
| 786 | * warranty is either expressed or implied by its |
| 787 | * publication or distribution. |
| 788 | */ |
| 789 | |
| 790 | /* |
| 791 | * Address line test |
| 792 | * |
| 793 | * Description: Test the address bus wiring in a |
| 794 | * memory region by performing a walking |
| 795 | * 1's test on the relevant bits of the |
| 796 | * address and checking for aliasing. |
| 797 | * This test will find single-bit |
| 798 | * address failures such as stuck -high, |
| 799 | * stuck-low, and shorted pins. The base |
| 800 | * address and size of the region are |
| 801 | * selected by the caller. |
| 802 | * |
| 803 | * Notes: For best results, the selected base |
| 804 | * address should have enough LSB 0's to |
| 805 | * guarantee single address bit changes. |
| 806 | * For example, to test a 64-Kbyte |
| 807 | * region, select a base address on a |
| 808 | * 64-Kbyte boundary. Also, select the |
| 809 | * region size as a power-of-two if at |
| 810 | * all possible. |
| 811 | * |
| 812 | * Returns: 0 if the test succeeds, 1 if the test fails. |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 813 | */ |
Guennadi Liakhovetski | 6f4abee | 2008-02-08 21:25:58 +0100 | [diff] [blame] | 814 | len = ((ulong)end - (ulong)start)/sizeof(vu_long); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 815 | pattern = (vu_long) 0xaaaaaaaa; |
| 816 | anti_pattern = (vu_long) 0x55555555; |
| 817 | |
Guennadi Liakhovetski | 6f4abee | 2008-02-08 21:25:58 +0100 | [diff] [blame] | 818 | PRINTF("%s:%d: length = 0x%.8lx\n", |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 819 | __FUNCTION__, __LINE__, |
Guennadi Liakhovetski | 6f4abee | 2008-02-08 21:25:58 +0100 | [diff] [blame] | 820 | len); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 821 | /* |
| 822 | * Write the default pattern at each of the |
| 823 | * power-of-two offsets. |
| 824 | */ |
Guennadi Liakhovetski | 6f4abee | 2008-02-08 21:25:58 +0100 | [diff] [blame] | 825 | for (offset = 1; offset < len; offset <<= 1) { |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 826 | start[offset] = pattern; |
| 827 | } |
| 828 | |
| 829 | /* |
| 830 | * Check for address bits stuck high. |
| 831 | */ |
| 832 | test_offset = 0; |
| 833 | start[test_offset] = anti_pattern; |
| 834 | |
Guennadi Liakhovetski | 6f4abee | 2008-02-08 21:25:58 +0100 | [diff] [blame] | 835 | for (offset = 1; offset < len; offset <<= 1) { |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 836 | temp = start[offset]; |
| 837 | if (temp != pattern) { |
| 838 | printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:" |
| 839 | " expected 0x%.8lx, actual 0x%.8lx\n", |
| 840 | (ulong)&start[offset], pattern, temp); |
| 841 | return 1; |
| 842 | } |
| 843 | } |
| 844 | start[test_offset] = pattern; |
Sergei Poselenov | a6e6fc6 | 2008-04-09 16:09:41 +0200 | [diff] [blame] | 845 | WATCHDOG_RESET(); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 846 | |
| 847 | /* |
| 848 | * Check for addr bits stuck low or shorted. |
| 849 | */ |
Guennadi Liakhovetski | 6f4abee | 2008-02-08 21:25:58 +0100 | [diff] [blame] | 850 | for (test_offset = 1; test_offset < len; test_offset <<= 1) { |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 851 | start[test_offset] = anti_pattern; |
| 852 | |
Guennadi Liakhovetski | 6f4abee | 2008-02-08 21:25:58 +0100 | [diff] [blame] | 853 | for (offset = 1; offset < len; offset <<= 1) { |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 854 | temp = start[offset]; |
| 855 | if ((temp != pattern) && (offset != test_offset)) { |
| 856 | printf ("\nFAILURE: Address bit stuck low or shorted @" |
| 857 | " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n", |
| 858 | (ulong)&start[offset], pattern, temp); |
| 859 | return 1; |
| 860 | } |
| 861 | } |
| 862 | start[test_offset] = pattern; |
| 863 | } |
| 864 | |
| 865 | /* |
| 866 | * Description: Test the integrity of a physical |
| 867 | * memory device by performing an |
| 868 | * increment/decrement test over the |
| 869 | * entire region. In the process every |
| 870 | * storage bit in the device is tested |
| 871 | * as a zero and a one. The base address |
| 872 | * and the size of the region are |
| 873 | * selected by the caller. |
| 874 | * |
| 875 | * Returns: 0 if the test succeeds, 1 if the test fails. |
| 876 | */ |
| 877 | num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1; |
| 878 | |
| 879 | /* |
| 880 | * Fill memory with a known pattern. |
| 881 | */ |
| 882 | for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { |
Sergei Poselenov | a6e6fc6 | 2008-04-09 16:09:41 +0200 | [diff] [blame] | 883 | WATCHDOG_RESET(); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 884 | start[offset] = pattern; |
| 885 | } |
| 886 | |
| 887 | /* |
| 888 | * Check each location and invert it for the second pass. |
| 889 | */ |
| 890 | for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { |
Sergei Poselenov | a6e6fc6 | 2008-04-09 16:09:41 +0200 | [diff] [blame] | 891 | WATCHDOG_RESET(); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 892 | temp = start[offset]; |
| 893 | if (temp != pattern) { |
| 894 | printf ("\nFAILURE (read/write) @ 0x%.8lx:" |
| 895 | " expected 0x%.8lx, actual 0x%.8lx)\n", |
| 896 | (ulong)&start[offset], pattern, temp); |
| 897 | return 1; |
| 898 | } |
| 899 | |
| 900 | anti_pattern = ~pattern; |
| 901 | start[offset] = anti_pattern; |
| 902 | } |
| 903 | |
| 904 | /* |
| 905 | * Check each location for the inverted pattern and zero it. |
| 906 | */ |
| 907 | for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { |
Sergei Poselenov | a6e6fc6 | 2008-04-09 16:09:41 +0200 | [diff] [blame] | 908 | WATCHDOG_RESET(); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 909 | anti_pattern = ~pattern; |
| 910 | temp = start[offset]; |
| 911 | if (temp != anti_pattern) { |
| 912 | printf ("\nFAILURE (read/write): @ 0x%.8lx:" |
| 913 | " expected 0x%.8lx, actual 0x%.8lx)\n", |
| 914 | (ulong)&start[offset], anti_pattern, temp); |
| 915 | return 1; |
| 916 | } |
| 917 | start[offset] = 0; |
| 918 | } |
| 919 | } |
| 920 | |
| 921 | #else /* The original, quickie test */ |
| 922 | incr = 1; |
| 923 | for (;;) { |
| 924 | if (ctrlc()) { |
| 925 | putc ('\n'); |
| 926 | return 1; |
| 927 | } |
| 928 | |
| 929 | printf ("\rPattern %08lX Writing..." |
| 930 | "%12s" |
| 931 | "\b\b\b\b\b\b\b\b\b\b", |
| 932 | pattern, ""); |
| 933 | |
| 934 | for (addr=start,val=pattern; addr<end; addr++) { |
Sergei Poselenov | a6e6fc6 | 2008-04-09 16:09:41 +0200 | [diff] [blame] | 935 | WATCHDOG_RESET(); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 936 | *addr = val; |
| 937 | val += incr; |
| 938 | } |
| 939 | |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 940 | puts ("Reading..."); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 941 | |
| 942 | for (addr=start,val=pattern; addr<end; addr++) { |
Sergei Poselenov | a6e6fc6 | 2008-04-09 16:09:41 +0200 | [diff] [blame] | 943 | WATCHDOG_RESET(); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 944 | readback = *addr; |
| 945 | if (readback != val) { |
| 946 | printf ("\nMem error @ 0x%08X: " |
| 947 | "found %08lX, expected %08lX\n", |
| 948 | (uint)addr, readback, val); |
| 949 | rcode = 1; |
| 950 | } |
| 951 | val += incr; |
| 952 | } |
| 953 | |
| 954 | /* |
| 955 | * Flip the pattern each time to make lots of zeros and |
| 956 | * then, the next time, lots of ones. We decrement |
| 957 | * the "negative" patterns and increment the "positive" |
| 958 | * patterns to preserve this feature. |
| 959 | */ |
| 960 | if(pattern & 0x80000000) { |
| 961 | pattern = -pattern; /* complement & increment */ |
| 962 | } |
| 963 | else { |
| 964 | pattern = ~pattern; |
| 965 | } |
| 966 | incr = -incr; |
| 967 | } |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 968 | #endif |
Guennadi Liakhovetski | 1f780aa | 2008-02-13 11:19:19 +0100 | [diff] [blame] | 969 | return rcode; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 970 | } |
| 971 | |
| 972 | |
| 973 | /* Modify memory. |
| 974 | * |
| 975 | * Syntax: |
| 976 | * mm{.b, .w, .l} {addr} |
| 977 | * nm{.b, .w, .l} {addr} |
| 978 | */ |
| 979 | static int |
| 980 | mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) |
| 981 | { |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 982 | ulong addr, i; |
| 983 | int nbytes, size; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 984 | extern char console_buffer[]; |
| 985 | |
| 986 | if (argc != 2) { |
| 987 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 988 | return 1; |
| 989 | } |
| 990 | |
| 991 | #ifdef CONFIG_BOOT_RETRY_TIME |
| 992 | reset_cmd_timeout(); /* got a good command to get here */ |
| 993 | #endif |
| 994 | /* We use the last specified parameters, unless new ones are |
| 995 | * entered. |
| 996 | */ |
| 997 | addr = mm_last_addr; |
| 998 | size = mm_last_size; |
| 999 | |
| 1000 | if ((flag & CMD_FLAG_REPEAT) == 0) { |
| 1001 | /* New command specified. Check for a size specification. |
| 1002 | * Defaults to long if no or incorrect specification. |
| 1003 | */ |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 1004 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
| 1005 | return 1; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1006 | |
| 1007 | /* Address is specified since argc > 1 |
| 1008 | */ |
| 1009 | addr = simple_strtoul(argv[1], NULL, 16); |
| 1010 | addr += base_address; |
| 1011 | } |
| 1012 | |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 1013 | #ifdef CONFIG_HAS_DATAFLASH |
| 1014 | if (addr_dataflash(addr)){ |
wdenk | 4b9206e | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 1015 | puts ("Can't modify DataFlash in place. Use cp instead.\n\r"); |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 1016 | return 0; |
| 1017 | } |
| 1018 | #endif |
| 1019 | |
Mike Frysinger | 4c727c7 | 2008-02-04 19:26:56 -0500 | [diff] [blame] | 1020 | #ifdef CONFIG_BLACKFIN |
| 1021 | if (addr_bfin_on_chip_mem(addr)) { |
| 1022 | puts ("Can't modify L1 instruction in place. Use cp instead.\n\r"); |
| 1023 | return 0; |
| 1024 | } |
| 1025 | #endif |
| 1026 | |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1027 | /* Print the address, followed by value. Then accept input for |
| 1028 | * the next value. A non-converted value exits. |
| 1029 | */ |
| 1030 | do { |
| 1031 | printf("%08lx:", addr); |
| 1032 | if (size == 4) |
| 1033 | printf(" %08x", *((uint *)addr)); |
| 1034 | else if (size == 2) |
| 1035 | printf(" %04x", *((ushort *)addr)); |
| 1036 | else |
| 1037 | printf(" %02x", *((u_char *)addr)); |
| 1038 | |
| 1039 | nbytes = readline (" ? "); |
| 1040 | if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) { |
| 1041 | /* <CR> pressed as only input, don't modify current |
| 1042 | * location and move to next. "-" pressed will go back. |
| 1043 | */ |
| 1044 | if (incrflag) |
| 1045 | addr += nbytes ? -size : size; |
| 1046 | nbytes = 1; |
| 1047 | #ifdef CONFIG_BOOT_RETRY_TIME |
| 1048 | reset_cmd_timeout(); /* good enough to not time out */ |
| 1049 | #endif |
| 1050 | } |
| 1051 | #ifdef CONFIG_BOOT_RETRY_TIME |
| 1052 | else if (nbytes == -2) { |
| 1053 | break; /* timed out, exit the command */ |
| 1054 | } |
| 1055 | #endif |
| 1056 | else { |
| 1057 | char *endp; |
| 1058 | i = simple_strtoul(console_buffer, &endp, 16); |
| 1059 | nbytes = endp - console_buffer; |
| 1060 | if (nbytes) { |
| 1061 | #ifdef CONFIG_BOOT_RETRY_TIME |
| 1062 | /* good enough to not time out |
| 1063 | */ |
| 1064 | reset_cmd_timeout(); |
| 1065 | #endif |
| 1066 | if (size == 4) |
| 1067 | *((uint *)addr) = i; |
| 1068 | else if (size == 2) |
| 1069 | *((ushort *)addr) = i; |
| 1070 | else |
| 1071 | *((u_char *)addr) = i; |
| 1072 | if (incrflag) |
| 1073 | addr += size; |
| 1074 | } |
| 1075 | } |
| 1076 | } while (nbytes); |
| 1077 | |
| 1078 | mm_last_addr = addr; |
| 1079 | mm_last_size = size; |
| 1080 | return 0; |
| 1081 | } |
| 1082 | |
wdenk | c26e454 | 2004-04-18 10:13:26 +0000 | [diff] [blame] | 1083 | #ifndef CONFIG_CRC32_VERIFY |
| 1084 | |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1085 | int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 1086 | { |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 1087 | ulong addr, length; |
| 1088 | ulong crc; |
| 1089 | ulong *ptr; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1090 | |
| 1091 | if (argc < 3) { |
| 1092 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 1093 | return 1; |
| 1094 | } |
| 1095 | |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 1096 | addr = simple_strtoul (argv[1], NULL, 16); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1097 | addr += base_address; |
| 1098 | |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 1099 | length = simple_strtoul (argv[2], NULL, 16); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1100 | |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 1101 | crc = crc32 (0, (const uchar *) addr, length); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1102 | |
| 1103 | printf ("CRC32 for %08lx ... %08lx ==> %08lx\n", |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 1104 | addr, addr + length - 1, crc); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1105 | |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 1106 | if (argc > 3) { |
| 1107 | ptr = (ulong *) simple_strtoul (argv[3], NULL, 16); |
| 1108 | *ptr = crc; |
| 1109 | } |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1110 | |
| 1111 | return 0; |
| 1112 | } |
| 1113 | |
wdenk | c26e454 | 2004-04-18 10:13:26 +0000 | [diff] [blame] | 1114 | #else /* CONFIG_CRC32_VERIFY */ |
| 1115 | |
| 1116 | int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 1117 | { |
| 1118 | ulong addr, length; |
| 1119 | ulong crc; |
| 1120 | ulong *ptr; |
wdenk | 6e59238 | 2004-04-18 17:39:38 +0000 | [diff] [blame] | 1121 | ulong vcrc; |
wdenk | c26e454 | 2004-04-18 10:13:26 +0000 | [diff] [blame] | 1122 | int verify; |
| 1123 | int ac; |
| 1124 | char **av; |
| 1125 | |
| 1126 | if (argc < 3) { |
| 1127 | usage: |
| 1128 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 1129 | return 1; |
| 1130 | } |
| 1131 | |
| 1132 | av = argv + 1; |
| 1133 | ac = argc - 1; |
| 1134 | if (strcmp(*av, "-v") == 0) { |
| 1135 | verify = 1; |
| 1136 | av++; |
| 1137 | ac--; |
| 1138 | if (ac < 3) |
| 1139 | goto usage; |
| 1140 | } else |
| 1141 | verify = 0; |
| 1142 | |
| 1143 | addr = simple_strtoul(*av++, NULL, 16); |
| 1144 | addr += base_address; |
| 1145 | length = simple_strtoul(*av++, NULL, 16); |
| 1146 | |
| 1147 | crc = crc32(0, (const uchar *) addr, length); |
| 1148 | |
| 1149 | if (!verify) { |
| 1150 | printf ("CRC32 for %08lx ... %08lx ==> %08lx\n", |
| 1151 | addr, addr + length - 1, crc); |
| 1152 | if (ac > 2) { |
| 1153 | ptr = (ulong *) simple_strtoul (*av++, NULL, 16); |
| 1154 | *ptr = crc; |
| 1155 | } |
| 1156 | } else { |
| 1157 | vcrc = simple_strtoul(*av++, NULL, 16); |
| 1158 | if (vcrc != crc) { |
| 1159 | printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n", |
| 1160 | addr, addr + length - 1, crc, vcrc); |
| 1161 | return 1; |
| 1162 | } |
| 1163 | } |
| 1164 | |
| 1165 | return 0; |
| 1166 | |
| 1167 | } |
| 1168 | #endif /* CONFIG_CRC32_VERIFY */ |
| 1169 | |
Harald Welte | fe2ce55 | 2008-07-06 15:56:38 +0800 | [diff] [blame] | 1170 | |
| 1171 | #ifdef CONFIG_CMD_UNZIP |
| 1172 | int gunzip (void *, int, unsigned char *, unsigned long *); |
| 1173 | |
| 1174 | int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
| 1175 | { |
| 1176 | unsigned long src, dst; |
| 1177 | unsigned long src_len = ~0UL, dst_len = ~0UL; |
| 1178 | int err; |
| 1179 | |
| 1180 | switch (argc) { |
| 1181 | case 4: |
| 1182 | dst_len = simple_strtoul(argv[3], NULL, 16); |
| 1183 | /* fall through */ |
| 1184 | case 3: |
| 1185 | src = simple_strtoul(argv[1], NULL, 16); |
| 1186 | dst = simple_strtoul(argv[2], NULL, 16); |
| 1187 | break; |
| 1188 | default: |
| 1189 | printf ("Usage:\n%s\n", cmdtp->usage); |
| 1190 | return 1; |
| 1191 | } |
| 1192 | |
| 1193 | return !!gunzip((void *) dst, dst_len, (void *) src, &src_len); |
| 1194 | } |
| 1195 | #endif /* CONFIG_CMD_UNZIP */ |
| 1196 | |
| 1197 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1198 | /**************************************************/ |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 1199 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1200 | md, 3, 1, do_mem_md, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1201 | "md - memory display\n", |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1202 | "[.b, .w, .l] address [# of objects]\n - memory display\n" |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1203 | ); |
| 1204 | |
| 1205 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 1206 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1207 | mm, 2, 1, do_mem_mm, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1208 | "mm - memory modify (auto-incrementing)\n", |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1209 | "[.b, .w, .l] address\n" " - memory modify, auto increment address\n" |
| 1210 | ); |
| 1211 | |
| 1212 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 1213 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1214 | nm, 2, 1, do_mem_nm, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1215 | "nm - memory modify (constant address)\n", |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1216 | "[.b, .w, .l] address\n - memory modify, read and keep address\n" |
| 1217 | ); |
| 1218 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 1219 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1220 | mw, 4, 1, do_mem_mw, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1221 | "mw - memory write (fill)\n", |
| 1222 | "[.b, .w, .l] address value [count]\n - write memory\n" |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1223 | ); |
| 1224 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 1225 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1226 | cp, 4, 1, do_mem_cp, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1227 | "cp - memory copy\n", |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1228 | "[.b, .w, .l] source target count\n - copy memory\n" |
| 1229 | ); |
| 1230 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 1231 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1232 | cmp, 4, 1, do_mem_cmp, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1233 | "cmp - memory compare\n", |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1234 | "[.b, .w, .l] addr1 addr2 count\n - compare memory\n" |
| 1235 | ); |
| 1236 | |
wdenk | c26e454 | 2004-04-18 10:13:26 +0000 | [diff] [blame] | 1237 | #ifndef CONFIG_CRC32_VERIFY |
| 1238 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 1239 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1240 | crc32, 4, 1, do_mem_crc, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1241 | "crc32 - checksum calculation\n", |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1242 | "address count [addr]\n - compute CRC32 checksum [save at addr]\n" |
| 1243 | ); |
| 1244 | |
wdenk | c26e454 | 2004-04-18 10:13:26 +0000 | [diff] [blame] | 1245 | #else /* CONFIG_CRC32_VERIFY */ |
| 1246 | |
| 1247 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1248 | crc32, 5, 1, do_mem_crc, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1249 | "crc32 - checksum calculation\n", |
wdenk | c26e454 | 2004-04-18 10:13:26 +0000 | [diff] [blame] | 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 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 1256 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1257 | base, 2, 1, do_mem_base, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1258 | "base - print or set address offset\n", |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1259 | "\n - print address offset for memory commands\n" |
| 1260 | "base off\n - set address offset for memory commands to 'off'\n" |
| 1261 | ); |
| 1262 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 1263 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1264 | loop, 3, 1, do_mem_loop, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1265 | "loop - infinite loop on address range\n", |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1266 | "[.b, .w, .l] address number_of_objects\n" |
| 1267 | " - loop on a set of addresses\n" |
| 1268 | ); |
| 1269 | |
wdenk | 56523f1 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 1270 | #ifdef CONFIG_LOOPW |
| 1271 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1272 | loopw, 4, 1, do_mem_loopw, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1273 | "loopw - infinite write loop on address range\n", |
wdenk | 56523f1 | 2004-07-11 17:40:54 +0000 | [diff] [blame] | 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 */ |
| 1278 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 1279 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1280 | mtest, 4, 1, do_mem_mtest, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1281 | "mtest - simple RAM test\n", |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1282 | "[start [end [pattern]]]\n" |
| 1283 | " - simple RAM read/write test\n" |
| 1284 | ); |
| 1285 | |
stroese | 4aaf29b | 2004-12-16 17:42:39 +0000 | [diff] [blame] | 1286 | #ifdef CONFIG_MX_CYCLIC |
| 1287 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1288 | mdc, 4, 1, do_mem_mdc, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1289 | "mdc - memory display cyclic\n", |
stroese | 4aaf29b | 2004-12-16 17:42:39 +0000 | [diff] [blame] | 1290 | "[.b, .w, .l] address count delay(ms)\n - memory display cyclic\n" |
| 1291 | ); |
| 1292 | |
| 1293 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 1294 | mwc, 4, 1, do_mem_mwc, |
Wolfgang Denk | 19f1014 | 2008-08-26 13:14:34 +0200 | [diff] [blame] | 1295 | "mwc - memory write cyclic\n", |
stroese | 4aaf29b | 2004-12-16 17:42:39 +0000 | [diff] [blame] | 1296 | "[.b, .w, .l] address value delay(ms)\n - memory write cyclic\n" |
| 1297 | ); |
| 1298 | #endif /* CONFIG_MX_CYCLIC */ |
| 1299 | |
Harald Welte | fe2ce55 | 2008-07-06 15:56:38 +0800 | [diff] [blame] | 1300 | #ifdef CONFIG_CMD_UNZIP |
| 1301 | U_BOOT_CMD( |
| 1302 | unzip, 4, 1, do_unzip, |
| 1303 | "unzip - unzip a memory region\n", |
| 1304 | "srcaddr dstaddr [dstsize]\n" |
| 1305 | ); |
| 1306 | #endif /* CONFIG_CMD_UNZIP */ |