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

Lei Wen adrian.wenl at gmail.com
Mon Oct 3 13:45:16 CEST 2011


Hi Marek,

On Mon, Oct 3, 2011 at 6:41 PM, Marek Vasut <marek.vasut at gmail.com> wrote:
> 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 ...

This suggestion is reasonable, I would do a magic number clean up in
the mmc.c together
with this patch.

Thanks,
Lei


More information about the U-Boot mailing list