}
}
}
-static struct mmc *init_mmc_device(int dev, bool force_init)
+
+static struct mmc *__init_mmc_device(int dev, bool force_init,
+ enum bus_mode speed_mode)
{
struct mmc *mmc;
mmc = find_mmc_device(dev);
if (force_init)
mmc->has_init = 0;
+
+ if (IS_ENABLED(CONFIG_MMC_SPEED_MODE_SET))
+ mmc->user_speed_mode = speed_mode;
+
if (mmc_init(mmc))
return NULL;
return mmc;
}
+static struct mmc *init_mmc_device(int dev, bool force_init)
+{
+ return __init_mmc_device(dev, force_init, MMC_MODES_END);
+}
+
static int do_mmcinfo(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
int argc, char *const argv[])
{
struct mmc *mmc;
+ enum bus_mode speed_mode = MMC_MODES_END;
+
+ if (argc == 1) {
+ mmc = init_mmc_device(curr_device, true);
+ } else if (argc == 2) {
+ speed_mode = (int)dectoul(argv[1], NULL);
+ mmc = __init_mmc_device(curr_device, true, speed_mode);
+ } else {
+ return CMD_RET_USAGE;
+ }
- mmc = init_mmc_device(curr_device, true);
if (!mmc)
return CMD_RET_FAILURE;
{
int dev, part = 0, ret;
struct mmc *mmc;
+ enum bus_mode speed_mode = MMC_MODES_END;
if (argc == 1) {
dev = curr_device;
+ mmc = init_mmc_device(dev, true);
} else if (argc == 2) {
- dev = dectoul(argv[1], NULL);
+ dev = (int)dectoul(argv[1], NULL);
+ mmc = init_mmc_device(dev, true);
} else if (argc == 3) {
dev = (int)dectoul(argv[1], NULL);
part = (int)dectoul(argv[2], NULL);
PART_ACCESS_MASK);
return CMD_RET_FAILURE;
}
+ mmc = init_mmc_device(dev, true);
+ } else if (argc == 4) {
+ dev = (int)dectoul(argv[1], NULL);
+ part = (int)dectoul(argv[2], NULL);
+ if (part > PART_ACCESS_MASK) {
+ printf("#part_num shouldn't be larger than %d\n",
+ PART_ACCESS_MASK);
+ return CMD_RET_FAILURE;
+ }
+ speed_mode = (int)dectoul(argv[3], NULL);
+ mmc = __init_mmc_device(dev, true, speed_mode);
} else {
return CMD_RET_USAGE;
}
- mmc = init_mmc_device(dev, true);
if (!mmc)
return CMD_RET_FAILURE;
#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
#endif
- U_BOOT_CMD_MKENT(rescan, 1, 1, do_mmc_rescan, "", ""),
+ U_BOOT_CMD_MKENT(rescan, 2, 1, do_mmc_rescan, "", ""),
U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""),
- U_BOOT_CMD_MKENT(dev, 3, 0, do_mmc_dev, "", ""),
+ U_BOOT_CMD_MKENT(dev, 4, 0, do_mmc_dev, "", ""),
U_BOOT_CMD_MKENT(list, 1, 1, do_mmc_list, "", ""),
#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""),
"mmc swrite addr blk#\n"
#endif
"mmc erase blk# cnt\n"
- "mmc rescan\n"
+ "mmc rescan [mode]\n"
"mmc part - lists available partition on current mmc device\n"
- "mmc dev [dev] [part] - show or set current mmc device [partition]\n"
+ "mmc dev [dev] [part] [mode] - show or set current mmc device [partition] and set mode\n"
+ " - the required speed mode is passed as the index from the following list\n"
+ " [MMC_LEGACY, MMC_HS, SD_HS, MMC_HS_52, MMC_DDR_52, UHS_SDR12, UHS_SDR25,\n"
+ " UHS_SDR50, UHS_DDR50, UHS_SDR104, MMC_HS_200, MMC_HS_400, MMC_HS_400_ES]\n"
"mmc list - lists available devices\n"
"mmc wp - power on write protect boot partitions\n"
#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)