X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=common%2Fcmd_mmc.c;h=1c7156f19c5939867c30d52fdba0ffdcf3583c55;hb=0ac8b1f437aa71c205f498d068d9d097cf72ce03;hp=1335e3d344c4eb48f1227e53e519f2ef4b45c9e5;hpb=e1cc4d31f889428a4ca73120951389c756404184;p=u-boot diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 1335e3d344..1c7156f19c 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -7,6 +7,7 @@ #include #include +#include #include static int curr_device = -1; @@ -311,20 +312,14 @@ static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag, return CMD_RET_FAILURE; } /* Switch to the RPMB partition */ - original_part = mmc->part_num; - if (mmc->part_num != MMC_PART_RPMB) { - if (mmc_switch_part(curr_device, MMC_PART_RPMB) != 0) - return CMD_RET_FAILURE; - mmc->part_num = MMC_PART_RPMB; - } + original_part = mmc->block_dev.part_num; + if (mmc_select_hwpart(curr_device, MMC_PART_RPMB) != 0) + return CMD_RET_FAILURE; ret = cp->cmd(cmdtp, flag, argc, argv); /* Return to original partition */ - if (mmc->part_num != original_part) { - if (mmc_switch_part(curr_device, original_part) != 0) - return CMD_RET_FAILURE; - mmc->part_num = original_part; - } + if (mmc_select_hwpart(curr_device, original_part) != 0) + return CMD_RET_FAILURE; return ret; } #endif @@ -350,7 +345,7 @@ static int do_mmc_read(cmd_tbl_t *cmdtp, int flag, printf("\nMMC read: dev # %d, block # %d, count %d ... ", curr_device, blk, cnt); - n = mmc->block_dev.block_read(curr_device, blk, cnt, addr); + n = mmc->block_dev.block_read(&mmc->block_dev, blk, cnt, addr); /* flush cache after read */ flush_cache((ulong)addr, cnt * 512); /* FIXME */ printf("%d blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR"); @@ -382,7 +377,7 @@ static int do_mmc_write(cmd_tbl_t *cmdtp, int flag, printf("Error: card is write protected!\n"); return CMD_RET_FAILURE; } - n = mmc->block_dev.block_write(curr_device, blk, cnt, addr); + n = mmc->block_dev.block_write(&mmc->block_dev, blk, cnt, addr); printf("%d blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR"); return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE; @@ -410,7 +405,7 @@ static int do_mmc_erase(cmd_tbl_t *cmdtp, int flag, printf("Error: card is write protected!\n"); return CMD_RET_FAILURE; } - n = mmc->block_dev.block_erase(curr_device, blk, cnt); + n = mmc->block_dev.block_erase(&mmc->block_dev, blk, cnt); printf("%d blocks erased: %s\n", n, (n == cnt) ? "OK" : "ERROR"); return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE; @@ -482,7 +477,7 @@ static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag, printf("mmc%d is current device\n", curr_device); else printf("mmc%d(part %d) is current device\n", - curr_device, mmc->part_num); + curr_device, mmc->block_dev.hwpart); return CMD_RET_SUCCESS; } @@ -746,7 +741,7 @@ static int do_mmc_rst_func(cmd_tbl_t *cmdtp, int flag, dev = simple_strtoul(argv[1], NULL, 10); enable = simple_strtoul(argv[2], NULL, 10); - if (enable > 2 || enable < 0) { + if (enable > 2) { puts("Invalid RST_n_ENABLE value\n"); return CMD_RET_USAGE; }