[U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed

Alagu Sankar alagusankar at embwise.com
Thu May 13 07:14:00 CEST 2010


As part of few other fixes and enhancements to u-boot MMC code, I sent a 
similar but slightly different patch yesterday.  I have an eMMC 
High-Capacity card (4GB) and it works fine with this patch.  But I do 
believe there are 4GB MMC cards that don't advertise them as 
High-Capacity cards and work with the byte addressing.  By the way, how 
do I make sure that the fixes and enhancements that I submit are in line 
with what is expected and becomes part of the mainline code.

- Alagu Sankar

Minkyu Kang wrote:
> Dear Andy,
>
> On 7 May 2010 16:52, Andy Fleming <afleming at gmail.com> wrote:
>   
>> On Fri, May 7, 2010 at 1:45 AM, Jae hoon Chung <jh80.chung at gmail.com> wrote:
>>     
>>> Dear Andy
>>>
>>> Thanks for your comment..
>>> but i have some question...
>>>
>>> 2010/5/7 Andy Fleming <afleming at gmail.com>:
>>>       
>>>> On Wed, Apr 7, 2010 at 10:36 PM, Jae hoon Chung <jh80.chung at gmail.com> wrote:
>>>>         
>>>>> The patches do the following
>>>>> 1. If mmc size is more than 2GB , we need to calculated using the
>>>>> extended csd register.
>>>>>           
>>>> This description is slightly inaccurate.  I have encountered MMC cards
>>>> with 4GB capacity, which are not actually high-capacity cards.  But
>>>> certainly there's a bug in the current code where high-capacity MMC
>>>> cards are not getting proper size calculations.
>>>>
>>>>         
>>> that means 4GB capacity is not high-capacity cards, right?
>>> i understood that higher than 2GB is supported high-capacity..
>>> if i mis-understood, i'll check the spec.
>>>       
>> Well, the spec says anything over 2GB is high capacity, and should be
>> accessed using block addressing.  However, the 4GB card I used
>> reported itself as not high-capacity, and was addressable via byte
>> addressing.  This works, because 4GB is addressable that way, but it's
>> technically in violation of the spec.
>>
>>
>>     
>>>>> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
>>>>> index cf4ea16..c985924 100644
>>>>> --- a/drivers/mmc/mmc.c
>>>>> +++ b/drivers/mmc/mmc.c
>>>>> @@ -410,6 +410,10 @@ int mmc_change_freq(struct mmc *mmc)
>>>>>        if (ext_csd[212] || ext_csd[213] || ext_csd[214] || ext_csd[215])
>>>>>                mmc->high_capacity = 1;
>>>>>
>>>>> +       if (mmc->high_capacity)
>>>>> +               mmc->capacity = ((ext_csd[215] << 24) | (ext_csd[214] << 16) |
>>>>> +                               (ext_csd[213] << 8) | ext_csd[212]);
>>>>> +
>>>>>           
>>>> This is off by a factor of block size.  Capacity is supposed to be the
>>>> size in bytes, and this sets it to the size in blocks, I believe.
>>>>
>>>> Hmm... I don't like that we are now doing the calculation twice for
>>>> high-capacity MMC cards, but I guess that's fine for now, as this only
>>>> affects v4 and higher, and extracting it is a bit more of a pain than
>>>> I originally thought.
>>>>
>>>> On a side note, does this mean you have a high-capacity MMC card?  And
>>>> can you point me to a place to get one?  We've been trying to test MMC
>>>> high-capacity for a while, and have yet to find a real one (we found
>>>> that 4GB one I mentioned, and it does normal byte-addressing).
>>>>
>>>>         
>>> didn't you have high-capacity card?
>>> we tested with 8GB moviNAND card, below is mmc card information using
>>> that code..
>>>       
>> Hmm...I'm not managing to find an actual card online for sale.  Do you
>> have a link?  We had a high-capacity SD card, but no MMC card.
>>
>>
>>     
>>> Tran Speed: 52000000
>>> Rd Block Len: 512
>>> MMC version 4.3
>>> High Capacity: Yes
>>> Capacity: 7840 MByte
>>> Bus Width: 4-bit
>>>
>>> and if card is higher than 2GB, access mode selected sector mode..
>>> why does card do normal byte-addressing?
>>>       
>> Yours is clearly a proper high-capacity card.  :)
>>     
>
> So, what is the conclusion or this patch?
> Modify the patch? or NAK this patch?
> Please let him know.
>
> Thanks
> Minkyu Kang
>   


More information about the U-Boot mailing list