summaryrefslogtreecommitdiff
path: root/common/cmd_mem.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-06-15 22:40:42 +0000
committerwdenk <wdenk>2003-06-15 22:40:42 +0000
commit71f9511803de65a3b98d2f592d418da1d1539f13 (patch)
tree4be38a22fc4f588a80aa8cc350ecd5617a211389 /common/cmd_mem.c
parent487778b781257831aa9b9140dd3c7ad4176e8314 (diff)
* Fix CONFIG_NET_MULTI support in include/net.hLABEL_2003_06_16_0055
* Patches by Kyle Harris, 13 Mar 2003: - Add FAT partition support - Add command support for FAT - Add command support for MMC ---- - Add Intel PXA support for video - Add Intel PXA support for MMC ---- - Enable MMC and FAT for lubbock board - Other misc changes for lubbock board
Diffstat (limited to 'common/cmd_mem.c')
-rw-r--r--common/cmd_mem.c66
1 files changed, 54 insertions, 12 deletions
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index d77b04728a8..bbfe958482c 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;
}