[U-Boot] [PATCH 2/2] mmc: Skip changing bus width for MMC cards earlier than version 4.0

Pantelis Antoniou pantelis.antoniou at gmail.com
Mon Jan 19 15:45:22 CET 2015


Hi Andrew,

> On Dec 25, 2014, at 18:22 , Andrew Gabbasov <andrew_gabbasov at mentor.com> wrote:
> 
> Wider bus widths (larger than default 1 bit) appeared in MMC standard
> version 4.0. So, for MMC cards of any earlier version trying to change
> the bus width (including ext_csd comparison) does not make any sense.
> It may work incorrectly and at least cause unnecessary timeouts.
> So, just skip the entire bus width related activity for earlier versions.
> 
> Signed-off-by: Andrew Gabbasov <andrew_gabbasov at mentor.com>
> Tested-by: Alexey Brodkin <abrodkin at synopsys.com>
> ---
> drivers/mmc/mmc.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index c0cf318..14d6a13 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -486,7 +486,7 @@ static int mmc_change_freq(struct mmc *mmc)
> 	char cardtype;
> 	int err;
> 
> -	mmc->card_caps = MMC_MODE_4BIT | MMC_MODE_8BIT;
> +	mmc->card_caps = 0;
> 
> 	if (mmc_host_is_spi(mmc))
> 		return 0;
> @@ -495,6 +495,8 @@ static int mmc_change_freq(struct mmc *mmc)
> 	if (mmc->version < MMC_VERSION_4)
> 		return 0;
> 
> +	mmc->card_caps |= MMC_MODE_4BIT | MMC_MODE_8BIT;
> +
> 	err = mmc_send_ext_csd(mmc, ext_csd);
> 
> 	if (err)
> @@ -1107,7 +1109,8 @@ static int mmc_startup(struct mmc *mmc)
> 			mmc->tran_speed = 50000000;
> 		else
> 			mmc->tran_speed = 25000000;
> -	} else {
> +	} else if (mmc->version >= MMC_VERSION_4) {
> +		/* Only version 4 of MMC supports wider bus widths */
> 		int idx;
> 
> 		/* An array of possible bus widths in order of preference */
> -- 
> 2.1.0

Applied, thanks.

— Pantelis



More information about the U-Boot mailing list