printf("Bus Width: %d-bit\n", mmc->bus_width);
}
-static struct mmc *init_mmc_device(int dev)
+static struct mmc *init_mmc_device(int dev, bool force_init)
{
struct mmc *mmc;
mmc = find_mmc_device(dev);
printf("no mmc device at slot %x\n", dev);
return NULL;
}
+ if (force_init)
+ mmc->has_init = 0;
if (mmc_init(mmc))
return NULL;
return mmc;
}
}
- mmc = init_mmc_device(curr_device);
+ mmc = init_mmc_device(curr_device, false);
if (!mmc)
return CMD_RET_FAILURE;
if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
return CMD_RET_SUCCESS;
- mmc = init_mmc_device(curr_device);
+ mmc = init_mmc_device(curr_device, false);
if (!mmc)
return CMD_RET_FAILURE;
blk = simple_strtoul(argv[2], NULL, 16);
cnt = simple_strtoul(argv[3], NULL, 16);
- mmc = init_mmc_device(curr_device);
+ mmc = init_mmc_device(curr_device, false);
if (!mmc)
return CMD_RET_FAILURE;
blk = simple_strtoul(argv[2], NULL, 16);
cnt = simple_strtoul(argv[3], NULL, 16);
- mmc = init_mmc_device(curr_device);
+ mmc = init_mmc_device(curr_device, false);
if (!mmc)
return CMD_RET_FAILURE;
blk = simple_strtoul(argv[1], NULL, 16);
cnt = simple_strtoul(argv[2], NULL, 16);
- mmc = init_mmc_device(curr_device);
+ mmc = init_mmc_device(curr_device, false);
if (!mmc)
return CMD_RET_FAILURE;
{
struct mmc *mmc;
- mmc = find_mmc_device(curr_device);
- if (!mmc) {
- printf("no mmc device at slot %x\n", curr_device);
+ mmc = init_mmc_device(curr_device, true);
+ if (!mmc)
return CMD_RET_FAILURE;
- }
- mmc->has_init = 0;
-
- if (mmc_init(mmc))
- return CMD_RET_FAILURE;
return CMD_RET_SUCCESS;
}
static int do_mmc_part(cmd_tbl_t *cmdtp, int flag,
block_dev_desc_t *mmc_dev;
struct mmc *mmc;
- mmc = init_mmc_device(curr_device);
+ mmc = init_mmc_device(curr_device, false);
if (!mmc)
return CMD_RET_FAILURE;
static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
{
- int dev, part = -1;
+ int dev, part = 0, ret;
struct mmc *mmc;
if (argc == 1) {
return CMD_RET_USAGE;
}
- mmc = init_mmc_device(dev);
+ mmc = init_mmc_device(dev, true);
if (!mmc)
return CMD_RET_FAILURE;
- if (part != -1) {
- int ret;
- if (mmc->part_config == MMCPART_NOAVAILABLE) {
- printf("Card doesn't support part_switch\n");
- return CMD_RET_FAILURE;
- }
-
- if (part != mmc->part_num) {
- ret = mmc_switch_part(dev, part);
- if (!ret)
- mmc->part_num = part;
+ ret = mmc_select_hwpart(dev, part);
+ printf("switch to partitions #%d, %s\n",
+ part, (!ret) ? "OK" : "ERROR");
+ if (ret)
+ return 1;
- printf("switch to partitions #%d, %s\n",
- part, (!ret) ? "OK" : "ERROR");
- }
- }
curr_device = dev;
if (mmc->part_config == MMCPART_NOAVAILABLE)
printf("mmc%d is current device\n", curr_device);
reset = simple_strtoul(argv[3], NULL, 10);
mode = simple_strtoul(argv[4], NULL, 10);
- mmc = init_mmc_device(dev);
+ mmc = init_mmc_device(dev, false);
if (!mmc)
return CMD_RET_FAILURE;
bootsize = simple_strtoul(argv[2], NULL, 10);
rpmbsize = simple_strtoul(argv[3], NULL, 10);
- mmc = init_mmc_device(dev);
+ mmc = init_mmc_device(dev, false);
if (!mmc)
return CMD_RET_FAILURE;
part_num = simple_strtoul(argv[3], NULL, 10);
access = simple_strtoul(argv[4], NULL, 10);
- mmc = init_mmc_device(dev);
+ mmc = init_mmc_device(dev, false);
if (!mmc)
return CMD_RET_FAILURE;
return CMD_RET_USAGE;
}
- mmc = init_mmc_device(dev);
+ mmc = init_mmc_device(dev, false);
if (!mmc)
return CMD_RET_FAILURE;
U_BOOT_CMD_MKENT(list, 1, 1, do_mmc_list, "", ""),
#ifdef CONFIG_SUPPORT_EMMC_BOOT
U_BOOT_CMD_MKENT(bootbus, 5, 0, do_mmc_bootbus, "", ""),
- U_BOOT_CMD_MKENT(bootpart-resize, 3, 0, do_mmc_boot_resize, "", ""),
+ U_BOOT_CMD_MKENT(bootpart-resize, 4, 0, do_mmc_boot_resize, "", ""),
U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""),
U_BOOT_CMD_MKENT(rst-function, 3, 0, do_mmc_rst_func, "", ""),
#endif