diff options
Diffstat (limited to 'cmd/mmc.c')
-rw-r--r-- | cmd/mmc.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cmd/mmc.c b/cmd/mmc.c index c0c23ee24b6..fe7899ec793 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -8,6 +8,7 @@ #include <command.h> #include <console.h> #include <display_options.h> +#include <mapmem.h> #include <memalign.h> #include <mmc.h> #include <part.h> @@ -350,12 +351,12 @@ static int do_mmc_read(struct cmd_tbl *cmdtp, int flag, { struct mmc *mmc; u32 blk, cnt, n; - void *addr; + void *ptr; if (argc != 4) return CMD_RET_USAGE; - addr = (void *)hextoul(argv[1], NULL); + ptr = map_sysmem(hextoul(argv[1], NULL), 0); blk = hextoul(argv[2], NULL); cnt = hextoul(argv[3], NULL); @@ -366,8 +367,9 @@ static int do_mmc_read(struct cmd_tbl *cmdtp, int flag, printf("MMC read: dev # %d, block # %d, count %d ... ", curr_device, blk, cnt); - n = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, addr); + n = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, ptr); printf("%d blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR"); + unmap_sysmem(ptr); return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE; } @@ -443,12 +445,12 @@ static int do_mmc_write(struct cmd_tbl *cmdtp, int flag, { struct mmc *mmc; u32 blk, cnt, n; - void *addr; + void *ptr; if (argc != 4) return CMD_RET_USAGE; - addr = (void *)hextoul(argv[1], NULL); + ptr = map_sysmem(hextoul(argv[1], NULL), 0); blk = hextoul(argv[2], NULL); cnt = hextoul(argv[3], NULL); @@ -463,8 +465,9 @@ static int do_mmc_write(struct cmd_tbl *cmdtp, int flag, printf("Error: card is write protected!\n"); return CMD_RET_FAILURE; } - n = blk_dwrite(mmc_get_blk_desc(mmc), blk, cnt, addr); + n = blk_dwrite(mmc_get_blk_desc(mmc), blk, cnt, ptr); printf("%d blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR"); + unmap_sysmem(ptr); return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE; } |