diff options
Diffstat (limited to 'common/cmd_mem.c')
-rw-r--r-- | common/cmd_mem.c | 66 |
1 files changed, 54 insertions, 12 deletions
diff --git a/common/cmd_mem.c b/common/cmd_mem.c index d77b047..bbfe958 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -30,6 +30,9 @@ #include <common.h> #include <command.h> #include <cmd_mem.h> +#if (CONFIG_COMMANDS & CFG_CMD_MMC) +#include <mmc.h> +#endif #if (CONFIG_COMMANDS & (CFG_CMD_MEMORY | CFG_CMD_PCI | CFG_CMD_I2C\ | CMD_CMD_PORTIO)) @@ -323,6 +326,46 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } #endif +#if (CONFIG_COMMANDS & CFG_CMD_MMC) + if (mmc2info(dest)) { + int rc; + + printf ("Copy to MMC... "); + switch (rc = mmc_write ((uchar *)addr, dest, count*size)) { + case 0: + printf ("\n"); + return 1; + case -1: + printf("failed\n"); + return 1; + default: + printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc); + return 1; + } + puts ("done\n"); + return 0; + } + + if (mmc2info(addr)) { + int rc; + + printf ("Copy from MMC... "); + switch (rc = mmc_read (addr, (uchar *)dest, count*size)) { + case 0: + printf ("\n"); + return 1; + case -1: + printf("failed\n"); + return 1; + default: + printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc); + return 1; + } + puts ("done\n"); + return 0; + } +#endif + while (count-- > 0) { if (size == 4) *((ulong *)dest) = *((ulong *)addr); @@ -820,30 +863,29 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { - ulong addr, length; - ulong crc; - ulong *ptr; + ulong addr, length; + ulong crc; + ulong *ptr; if (argc < 3) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; } - addr = simple_strtoul(argv[1], NULL, 16); + addr = simple_strtoul (argv[1], NULL, 16); addr += base_address; - length = simple_strtoul(argv[2], NULL, 16); + length = simple_strtoul (argv[2], NULL, 16); - crc = crc32 (0, (const uchar *)addr, length); + crc = crc32 (0, (const uchar *) addr, length); printf ("CRC32 for %08lx ... %08lx ==> %08lx\n", - addr, addr + length -1, crc); + addr, addr + length - 1, crc); - if (argc > 3) - { - ptr = (ulong *)simple_strtoul(argv[3], NULL, 16); - *ptr = crc; - } + if (argc > 3) { + ptr = (ulong *) simple_strtoul (argv[3], NULL, 16); + *ptr = crc; + } return 0; } |