[U-Boot] [PATCH 4/4] cmd_mmc: use new mmc_select_hwpart() function

Pantelis Antoniou panto at antoniou-consulting.com
Fri May 23 11:24:20 CEST 2014


Hi Stephen,

On May 7, 2014, at 9:19 PM, Stephen Warren wrote:

> From: Stephen Warren <swarren at nvidia.com>
> 
> The implementation of mmc_select_hwpart() was cribbed from do_mmcops().
> Update do_mmcops() to call mmc_select_hwpart() to avoid duplication.
> 
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
> ---
> common/cmd_mmc.c | 19 +++++--------------
> 1 file changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
> index c1916c9b56a6..572aa895fa1c 100644
> --- a/common/cmd_mmc.c
> +++ b/common/cmd_mmc.c
> @@ -193,7 +193,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> 		print_mmc_devices('\n');
> 		return 0;
> 	} else if (strcmp(argv[1], "dev") == 0) {
> -		int dev, part = -1;
> +		int dev, part = -1, ret;
> 		struct mmc *mmc;
> 
> 		if (argc == 2)
> @@ -219,20 +219,11 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> 
> 		mmc_init(mmc);
> 		if (part != -1) {
> -			int ret;
> -			if (mmc->part_config == MMCPART_NOAVAILABLE) {
> -				printf("Card doesn't support part_switch\n");
> +			ret = mmc_select_hwpart(dev, part);
> +			printf("switch to partitions #%d, %s\n",
> +			       part, (!ret) ? "OK" : "ERROR");
> +			if (ret)
> 				return 1;
> -			}
> -
> -			if (part != mmc->part_num) {
> -				ret = mmc_switch_part(dev, part);
> -				if (!ret)
> -					mmc->part_num = part;
> -
> -				printf("switch to partitions #%d, %s\n",
> -						part, (!ret) ? "OK" : "ERROR");
> -			}
> 		}
> 		curr_device = dev;
> 		if (mmc->part_config == MMCPART_NOAVAILABLE)
> -- 
> 1.8.1.5
> 

Due to patch order mangling, I've applied but with some manual placement. Please verify that
it works properly on your end after the patches land at u-boot-mmc.

Thanks

-- Pantelis

Acked-by: Pantelis Antoniou <panto at antoniou-consulting.com>



More information about the U-Boot mailing list