mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
cmd_mmc: add force_init parameter to init_mmc_device()
This allows callers to inject mmc->has_init = 0 between finding the MMC device, and calling mmc_init(), which forces mmc_init() to rescan the HW. Future changes will use this feature. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
This commit is contained in:
parent
ecdd57e274
commit
1ae24a5041
1 changed files with 14 additions and 12 deletions
|
@ -92,7 +92,7 @@ static void print_mmcinfo(struct mmc *mmc)
|
||||||
|
|
||||||
printf("Bus Width: %d-bit\n", mmc->bus_width);
|
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;
|
struct mmc *mmc;
|
||||||
mmc = find_mmc_device(dev);
|
mmc = find_mmc_device(dev);
|
||||||
|
@ -100,6 +100,8 @@ static struct mmc *init_mmc_device(int dev)
|
||||||
printf("no mmc device at slot %x\n", dev);
|
printf("no mmc device at slot %x\n", dev);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (force_init)
|
||||||
|
mmc->has_init = 0;
|
||||||
if (mmc_init(mmc))
|
if (mmc_init(mmc))
|
||||||
return NULL;
|
return NULL;
|
||||||
return mmc;
|
return mmc;
|
||||||
|
@ -117,7 +119,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)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
@ -247,7 +249,7 @@ static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag,
|
||||||
if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
|
if (flag == CMD_FLAG_REPEAT && !cp->repeatable)
|
||||||
return CMD_RET_SUCCESS;
|
return CMD_RET_SUCCESS;
|
||||||
|
|
||||||
mmc = init_mmc_device(curr_device);
|
mmc = init_mmc_device(curr_device, false);
|
||||||
if (!mmc)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
@ -292,7 +294,7 @@ static int do_mmc_read(cmd_tbl_t *cmdtp, int flag,
|
||||||
blk = simple_strtoul(argv[2], NULL, 16);
|
blk = simple_strtoul(argv[2], NULL, 16);
|
||||||
cnt = simple_strtoul(argv[3], NULL, 16);
|
cnt = simple_strtoul(argv[3], NULL, 16);
|
||||||
|
|
||||||
mmc = init_mmc_device(curr_device);
|
mmc = init_mmc_device(curr_device, false);
|
||||||
if (!mmc)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
@ -320,7 +322,7 @@ static int do_mmc_write(cmd_tbl_t *cmdtp, int flag,
|
||||||
blk = simple_strtoul(argv[2], NULL, 16);
|
blk = simple_strtoul(argv[2], NULL, 16);
|
||||||
cnt = simple_strtoul(argv[3], NULL, 16);
|
cnt = simple_strtoul(argv[3], NULL, 16);
|
||||||
|
|
||||||
mmc = init_mmc_device(curr_device);
|
mmc = init_mmc_device(curr_device, false);
|
||||||
if (!mmc)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
@ -348,7 +350,7 @@ static int do_mmc_erase(cmd_tbl_t *cmdtp, int flag,
|
||||||
blk = simple_strtoul(argv[1], NULL, 16);
|
blk = simple_strtoul(argv[1], NULL, 16);
|
||||||
cnt = simple_strtoul(argv[2], NULL, 16);
|
cnt = simple_strtoul(argv[2], NULL, 16);
|
||||||
|
|
||||||
mmc = init_mmc_device(curr_device);
|
mmc = init_mmc_device(curr_device, false);
|
||||||
if (!mmc)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
@ -387,7 +389,7 @@ static int do_mmc_part(cmd_tbl_t *cmdtp, int flag,
|
||||||
block_dev_desc_t *mmc_dev;
|
block_dev_desc_t *mmc_dev;
|
||||||
struct mmc *mmc;
|
struct mmc *mmc;
|
||||||
|
|
||||||
mmc = init_mmc_device(curr_device);
|
mmc = init_mmc_device(curr_device, false);
|
||||||
if (!mmc)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
@ -422,7 +424,7 @@ static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag,
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mmc = init_mmc_device(dev);
|
mmc = init_mmc_device(dev, false);
|
||||||
if (!mmc)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
@ -462,7 +464,7 @@ static int do_mmc_bootbus(cmd_tbl_t *cmdtp, int flag,
|
||||||
reset = simple_strtoul(argv[3], NULL, 10);
|
reset = simple_strtoul(argv[3], NULL, 10);
|
||||||
mode = simple_strtoul(argv[4], NULL, 10);
|
mode = simple_strtoul(argv[4], NULL, 10);
|
||||||
|
|
||||||
mmc = init_mmc_device(dev);
|
mmc = init_mmc_device(dev, false);
|
||||||
if (!mmc)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
@ -487,7 +489,7 @@ static int do_mmc_boot_resize(cmd_tbl_t *cmdtp, int flag,
|
||||||
bootsize = simple_strtoul(argv[2], NULL, 10);
|
bootsize = simple_strtoul(argv[2], NULL, 10);
|
||||||
rpmbsize = simple_strtoul(argv[3], NULL, 10);
|
rpmbsize = simple_strtoul(argv[3], NULL, 10);
|
||||||
|
|
||||||
mmc = init_mmc_device(dev);
|
mmc = init_mmc_device(dev, false);
|
||||||
if (!mmc)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
@ -520,7 +522,7 @@ static int do_mmc_partconf(cmd_tbl_t *cmdtp, int flag,
|
||||||
part_num = simple_strtoul(argv[3], NULL, 10);
|
part_num = simple_strtoul(argv[3], NULL, 10);
|
||||||
access = simple_strtoul(argv[4], NULL, 10);
|
access = simple_strtoul(argv[4], NULL, 10);
|
||||||
|
|
||||||
mmc = init_mmc_device(dev);
|
mmc = init_mmc_device(dev, false);
|
||||||
if (!mmc)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
@ -555,7 +557,7 @@ static int do_mmc_rst_func(cmd_tbl_t *cmdtp, int flag,
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mmc = init_mmc_device(dev);
|
mmc = init_mmc_device(dev, false);
|
||||||
if (!mmc)
|
if (!mmc)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue