X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=common%2Fcmd_mmc.c;h=cdcbf5f80f9be5b718a52ecefeccc6796ccfbb07;hb=c5f0d3f1c5078870926ebbc84af92f0f66133cb3;hp=eea337506c3f21829c3a4dff9e832f26d505ac93;hpb=cc49da249cf2f380d2fed5571fad65ce6494fc95;p=karo-tx-uboot.git diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index eea337506c..cdcbf5f80f 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -73,6 +73,8 @@ U_BOOT_CMD( static void print_mmcinfo(struct mmc *mmc) { + int i; + printf("Device: %s\n", mmc->cfg->name); printf("Manufacturer ID: %x\n", mmc->cid[0] >> 24); printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xffff); @@ -90,9 +92,25 @@ static void print_mmcinfo(struct mmc *mmc) puts("Capacity: "); print_size(mmc->capacity, "\n"); - printf("Bus Width: %d-bit\n", mmc->bus_width); + printf("Bus Width: %d-bit%s\n", mmc->bus_width, + mmc->ddr_mode ? " DDR" : ""); + + if (!IS_SD(mmc) && mmc->version >= MMC_VERSION_4) { + puts("User Capacity: "); + print_size(mmc->capacity_user, "\n"); + puts("Boot Capacity: "); + print_size(mmc->capacity_boot, "\n"); + puts("RPMB Capacity: "); + print_size(mmc->capacity_rpmb, "\n"); + for (i = 0; i < ARRAY_SIZE(mmc->capacity_gp); i++) { + if (mmc->capacity_gp[i]) { + printf("GP%i Capacity: ", i); + print_size(mmc->capacity_gp[i], "\n"); + } + } + } } -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); @@ -100,6 +118,8 @@ static struct mmc *init_mmc_device(int 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; @@ -117,7 +137,7 @@ static int do_mmcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } } - mmc = init_mmc_device(curr_device); + mmc = init_mmc_device(curr_device, false); if (!mmc) return CMD_RET_FAILURE; @@ -247,7 +267,7 @@ static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag, 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; @@ -292,7 +312,7 @@ static int do_mmc_read(cmd_tbl_t *cmdtp, int flag, 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; @@ -320,7 +340,7 @@ static int do_mmc_write(cmd_tbl_t *cmdtp, int flag, 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; @@ -348,7 +368,7 @@ static int do_mmc_erase(cmd_tbl_t *cmdtp, int flag, 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; @@ -369,16 +389,10 @@ static int do_mmc_rescan(cmd_tbl_t *cmdtp, int flag, { 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, @@ -387,7 +401,7 @@ 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; @@ -403,7 +417,7 @@ static int do_mmc_part(cmd_tbl_t *cmdtp, int flag, static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - int dev, part = -1, ret; + int dev, part = 0, ret; struct mmc *mmc; if (argc == 1) { @@ -422,17 +436,16 @@ static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag, return CMD_RET_USAGE; } - mmc = init_mmc_device(dev); + mmc = init_mmc_device(dev, true); if (!mmc) return CMD_RET_FAILURE; - if (part != -1) { - ret = mmc_select_hwpart(dev, part); - printf("switch to partitions #%d, %s\n", - part, (!ret) ? "OK" : "ERROR"); - if (ret) - return 1; - } + ret = mmc_select_hwpart(dev, part); + printf("switch to partitions #%d, %s\n", + part, (!ret) ? "OK" : "ERROR"); + if (ret) + return 1; + curr_device = dev; if (mmc->part_config == MMCPART_NOAVAILABLE) printf("mmc%d is current device\n", curr_device); @@ -463,7 +476,7 @@ static int do_mmc_bootbus(cmd_tbl_t *cmdtp, int flag, 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; @@ -488,7 +501,7 @@ static int do_mmc_boot_resize(cmd_tbl_t *cmdtp, int flag, 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; @@ -521,7 +534,7 @@ static int do_mmc_partconf(cmd_tbl_t *cmdtp, int flag, 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; @@ -556,7 +569,7 @@ static int do_mmc_rst_func(cmd_tbl_t *cmdtp, int flag, return CMD_RET_USAGE; } - mmc = init_mmc_device(dev); + mmc = init_mmc_device(dev, false); if (!mmc) return CMD_RET_FAILURE; @@ -607,7 +620,7 @@ static cmd_tbl_t cmd_mmc[] = { 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