[U-Boot] [PATCH] mmc: test mmc bus width on startup

Marek Vasut marek.vasut at gmail.com
Mon Oct 3 12:41:34 CEST 2011


On Monday, October 03, 2011 11:03:56 AM Lei Wen wrote:
> For we don't know mmc bus width from reading registers, the only way
> to check is to test.
> 
> Change-Id: Ia50df480bd14349e36ac8217d8d290cf732db089
> Signed-off-by: Lei Wen <leiwen at marvell.com>
> ---

[...]

> +			if (!err && ext_csd[160] == test_csd[160]
> +			    && ext_csd[175] == test_csd[175]
> +			    && ext_csd[192] == test_csd[192]
> +			    && ext_csd[224] == test_csd[224]
> +			    && memcmp(&ext_csd[212], &test_csd[212], 4) == 0) {
> +				mmc->card_caps |= width;
> +				break;
> +			}
>  		}
> 
>  		if (mmc->card_caps & MMC_MODE_HS) {

Hi Lei,

I see you're accessing the ext_csd via some magic constants. Can you possibly 
convert it to structure-based access ? Like struct ext_csd csd; csd->member ... 
?

Cheers


More information about the U-Boot mailing list