public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc
@ 2010-09-06 13:59 Lei Wen
  2010-09-06 14:07 ` Reinhard Meyer
  0 siblings, 1 reply; 9+ messages in thread
From: Lei Wen @ 2010-09-06 13:59 UTC (permalink / raw)
  To: u-boot

According spec, high capacity mmc should be calculated by sector
number multiply by sector size.

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
 drivers/mmc/mmc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index ea398a5..bb97171 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -441,6 +441,11 @@ int mmc_change_freq(struct mmc *mmc)
 	if (!ext_csd[185])
 		return 0;
 
+	if (!IS_SD(mmc) && mmc->high_capacity) {
+		mmc->capacity = ext_csd[212] | (ext_csd[213] << 8)
+			| (ext_csd[214] << 16) | (ext_csd[215] << 24);
+		mmc->capacity *= mmc->read_bl_len;
+	}
 	/* High Speed is set, there are two types: 52MHz and 26MHz */
 	if (cardtype & MMC_HS_52MHZ)
 		mmc->card_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc
  2010-09-06 13:59 [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc Lei Wen
@ 2010-09-06 14:07 ` Reinhard Meyer
  2010-09-06 14:11   ` Lei Wen
  0 siblings, 1 reply; 9+ messages in thread
From: Reinhard Meyer @ 2010-09-06 14:07 UTC (permalink / raw)
  To: u-boot

Dear Lei Wen,
> According spec, high capacity mmc should be calculated by sector
> number multiply by sector size.
> 
> Signed-off-by: Lei Wen <leiwen@marvell.com>
> ---
>  drivers/mmc/mmc.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index ea398a5..bb97171 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -441,6 +441,11 @@ int mmc_change_freq(struct mmc *mmc)
>  	if (!ext_csd[185])
>  		return 0;
>  
> +	if (!IS_SD(mmc) && mmc->high_capacity) {
> +		mmc->capacity = ext_csd[212] | (ext_csd[213] << 8)
> +			| (ext_csd[214] << 16) | (ext_csd[215] << 24);
> +		mmc->capacity *= mmc->read_bl_len;
> +	}
>  	/* High Speed is set, there are two types: 52MHz and 26MHz */
>  	if (cardtype & MMC_HS_52MHZ)
>  		mmc->card_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;

Sorry to kick in again...

a) this calculation is already done in line 717, and certainly does not belong
in a function called "mmc_change_freq".

b) the current Top-Of-Tree code already calculates the capacity correctly:

32GB SDHC Card:

Device: mci
Manufacturer ID: 3
OEM: 5344
Name: SD32G
Tran Speed: 25000000
Rd Block Len: 512
SD version 2.0
High Capacity: Yes
Capacity: 31914983424
Bus Width: 4-bit

c) is that now an incremental patch to the one you sent previously?

Best Regards,
Reinhard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc
  2010-09-06 14:07 ` Reinhard Meyer
@ 2010-09-06 14:11   ` Lei Wen
  2010-09-13  4:04     ` Lei Wen
  0 siblings, 1 reply; 9+ messages in thread
From: Lei Wen @ 2010-09-06 14:11 UTC (permalink / raw)
  To: u-boot

Hi Reinhard ,

On Mon, Sep 6, 2010 at 10:07 PM, Reinhard Meyer
<u-boot@emk-elektronik.de> wrote:
> Dear Lei Wen,
>> According spec, high capacity mmc should be calculated by sector
>> number multiply by sector size.
>>
>> Signed-off-by: Lei Wen <leiwen@marvell.com>
>> ---
>> ?drivers/mmc/mmc.c | ? ?5 +++++
>> ?1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
>> index ea398a5..bb97171 100644
>> --- a/drivers/mmc/mmc.c
>> +++ b/drivers/mmc/mmc.c
>> @@ -441,6 +441,11 @@ int mmc_change_freq(struct mmc *mmc)
>> ? ? ? if (!ext_csd[185])
>> ? ? ? ? ? ? ? return 0;
>>
>> + ? ? if (!IS_SD(mmc) && mmc->high_capacity) {
>> + ? ? ? ? ? ? mmc->capacity = ext_csd[212] | (ext_csd[213] << 8)
>> + ? ? ? ? ? ? ? ? ? ? | (ext_csd[214] << 16) | (ext_csd[215] << 24);
>> + ? ? ? ? ? ? mmc->capacity *= mmc->read_bl_len;
>> + ? ? }
>> ? ? ? /* High Speed is set, there are two types: 52MHz and 26MHz */
>> ? ? ? if (cardtype & MMC_HS_52MHZ)
>> ? ? ? ? ? ? ? mmc->card_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
>
> Sorry to kick in again...
>
> a) this calculation is already done in line 717, and certainly does not belong
> in a function called "mmc_change_freq".
>
> b) the current Top-Of-Tree code already calculates the capacity correctly:
>
> 32GB SDHC Card:
>
> Device: mci
> Manufacturer ID: 3
> OEM: 5344
> Name: SD32G
> Tran Speed: 25000000
> Rd Block Len: 512
> SD version 2.0
> High Capacity: Yes
> Capacity: 31914983424
> Bus Width: 4-bit

Yes, for sd card, the calculation method is right.
But for mmc with high capacity, the calculation is wrong. You could
try a mmc card with high capacity, like emmc card.
>
> c) is that now an incremental patch to the one you sent previously?
It is a separate one. :-)

Best regards,
Lei

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc
  2010-09-06 14:11   ` Lei Wen
@ 2010-09-13  4:04     ` Lei Wen
  2010-09-18 21:49       ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Lei Wen @ 2010-09-13  4:04 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

How about merge this patch? :-)

Best regards,
Lei

On Mon, Sep 6, 2010 at 10:11 PM, Lei Wen <adrian.wenl@gmail.com> wrote:
> Hi Reinhard ,
>
> On Mon, Sep 6, 2010 at 10:07 PM, Reinhard Meyer
> <u-boot@emk-elektronik.de> wrote:
>> Dear Lei Wen,
>>> According spec, high capacity mmc should be calculated by sector
>>> number multiply by sector size.
>>>
>>> Signed-off-by: Lei Wen <leiwen@marvell.com>
>>> ---
>>> ?drivers/mmc/mmc.c | ? ?5 +++++
>>> ?1 files changed, 5 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
>>> index ea398a5..bb97171 100644
>>> --- a/drivers/mmc/mmc.c
>>> +++ b/drivers/mmc/mmc.c
>>> @@ -441,6 +441,11 @@ int mmc_change_freq(struct mmc *mmc)
>>> ? ? ? if (!ext_csd[185])
>>> ? ? ? ? ? ? ? return 0;
>>>
>>> + ? ? if (!IS_SD(mmc) && mmc->high_capacity) {
>>> + ? ? ? ? ? ? mmc->capacity = ext_csd[212] | (ext_csd[213] << 8)
>>> + ? ? ? ? ? ? ? ? ? ? | (ext_csd[214] << 16) | (ext_csd[215] << 24);
>>> + ? ? ? ? ? ? mmc->capacity *= mmc->read_bl_len;
>>> + ? ? }
>>> ? ? ? /* High Speed is set, there are two types: 52MHz and 26MHz */
>>> ? ? ? if (cardtype & MMC_HS_52MHZ)
>>> ? ? ? ? ? ? ? mmc->card_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
>>
>> Sorry to kick in again...
>>
>> a) this calculation is already done in line 717, and certainly does not belong
>> in a function called "mmc_change_freq".
>>
>> b) the current Top-Of-Tree code already calculates the capacity correctly:
>>
>> 32GB SDHC Card:
>>
>> Device: mci
>> Manufacturer ID: 3
>> OEM: 5344
>> Name: SD32G
>> Tran Speed: 25000000
>> Rd Block Len: 512
>> SD version 2.0
>> High Capacity: Yes
>> Capacity: 31914983424
>> Bus Width: 4-bit
>
> Yes, for sd card, the calculation method is right.
> But for mmc with high capacity, the calculation is wrong. You could
> try a mmc card with high capacity, like emmc card.
>>
>> c) is that now an incremental patch to the one you sent previously?
> It is a separate one. :-)
>
> Best regards,
> Lei
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc
  2010-09-13  4:04     ` Lei Wen
@ 2010-09-18 21:49       ` Wolfgang Denk
  2010-09-19  4:32         ` Reinhard Meyer
  2010-09-21 14:45         ` John Rigby
  0 siblings, 2 replies; 9+ messages in thread
From: Wolfgang Denk @ 2010-09-18 21:49 UTC (permalink / raw)
  To: u-boot

Dear Lei Wen,

In message <AANLkTimaQtTCJf52DjF-AhdEfFQbHfwyeJD3024VwFWu@mail.gmail.com> you wrote:
> 
> How about merge this patch? :-)

I will wait for a pull request from the responsible custodian.

Maybe you should have put him on cc: ...  (done now).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Status quo. Latin for "the mess we're in."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc
  2010-09-18 21:49       ` Wolfgang Denk
@ 2010-09-19  4:32         ` Reinhard Meyer
  2010-09-19  8:27           ` Lei Wen
  2010-09-21 14:45         ` John Rigby
  1 sibling, 1 reply; 9+ messages in thread
From: Reinhard Meyer @ 2010-09-19  4:32 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang Denk, Lei Wen, Andy Fleming,
> Dear Lei Wen,
>
> In message<AANLkTimaQtTCJf52DjF-AhdEfFQbHfwyeJD3024VwFWu@mail.gmail.com>  you wrote:
>>
>> How about merge this patch? :-)
>
> I will wait for a pull request from the responsible custodian.
>
> Maybe you should have put him on cc: ...  (done now).
@@ -441,6 +441,11 @@ int mmc_change_freq(struct mmc *mmc)
 >>>       if (!ext_csd[185])
 >>>               return 0;
 >>>
 >>> +     if (!IS_SD(mmc) && mmc->high_capacity) {
 >>> +             mmc->capacity = ext_csd[212] | (ext_csd[213] << 8)
 >>> +                     | (ext_csd[214] << 16) | (ext_csd[215] << 24);
 >>> +             mmc->capacity *= mmc->read_bl_len;
 >>> +     }
 >>>       /* High Speed is set, there are two types: 52MHz and 26MHz */
 >>>
I am still convinced "mmc_change_freq()" is the wrong place to do that
calculation. All other card types do it around line 700...

Best Regards,
Reinhard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc
  2010-09-19  4:32         ` Reinhard Meyer
@ 2010-09-19  8:27           ` Lei Wen
  0 siblings, 0 replies; 9+ messages in thread
From: Lei Wen @ 2010-09-19  8:27 UTC (permalink / raw)
  To: u-boot

Dear Reinhard,

On Sun, Sep 19, 2010 at 12:32 PM, Reinhard Meyer
<u-boot@emk-elektronik.de> wrote:
> Dear Wolfgang Denk, Lei Wen, Andy Fleming,
>>
>> Dear Lei Wen,
>>
>> In message<AANLkTimaQtTCJf52DjF-AhdEfFQbHfwyeJD3024VwFWu@mail.gmail.com>
>> ?you wrote:
>>>
>>> How about merge this patch? :-)
>>
>> I will wait for a pull request from the responsible custodian.
>>
>> Maybe you should have put him on cc: ... ?(done now).
>
> @@ -441,6 +441,11 @@ int mmc_change_freq(struct mmc *mmc)
>>>> ? ? ? if (!ext_csd[185])
>>>> ? ? ? ? ? ? ? return 0;
>>>>
>>>> + ? ? if (!IS_SD(mmc) && mmc->high_capacity) {
>>>> + ? ? ? ? ? ? mmc->capacity = ext_csd[212] | (ext_csd[213] << 8)
>>>> + ? ? ? ? ? ? ? ? ? ? | (ext_csd[214] << 16) | (ext_csd[215] << 24);
>>>> + ? ? ? ? ? ? mmc->capacity *= mmc->read_bl_len;
>>>> + ? ? }
>>>> ? ? ? /* High Speed is set, there are two types: 52MHz and 26MHz */
>>>>
> I am still convinced "mmc_change_freq()" is the wrong place to do that
> calculation. All other card types do it around line 700...
>
But in other place, how could we get the ext_csd info? If you could let me
get this line at the line, as you said 700, I am fine to put this code
to there...

Thanks,
Lei

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc
  2010-09-18 21:49       ` Wolfgang Denk
  2010-09-19  4:32         ` Reinhard Meyer
@ 2010-09-21 14:45         ` John Rigby
  2010-09-24 10:49           ` Marek Vasut
  1 sibling, 1 reply; 9+ messages in thread
From: John Rigby @ 2010-09-21 14:45 UTC (permalink / raw)
  To: u-boot

On Sat, Sep 18, 2010 at 3:49 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Lei Wen,
>
> In message <AANLkTimaQtTCJf52DjF-AhdEfFQbHfwyeJD3024VwFWu@mail.gmail.com> you wrote:
>>
>> How about merge this patch? :-)
>
> I will wait for a pull request from the responsible custodian.
>
> Maybe you should have put him on cc: ... ?(done now).
>

I pinged Andy about some mmc patches that he replied "Applied" to back
in May but never made it into the repo.  I see no emails from him to
the u-boot list for sometime.

Andy, are you still around?  Freescalers, any info?

Thanks
John

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc
  2010-09-21 14:45         ` John Rigby
@ 2010-09-24 10:49           ` Marek Vasut
  0 siblings, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2010-09-24 10:49 UTC (permalink / raw)
  To: u-boot

Dne ?t 21. z??? 2010 16:45:25 John Rigby napsal(a):
> On Sat, Sep 18, 2010 at 3:49 PM, Wolfgang Denk <wd@denx.de> wrote:
> > Dear Lei Wen,
> > 
> > In message <AANLkTimaQtTCJf52DjF-AhdEfFQbHfwyeJD3024VwFWu@mail.gmail.com> 
you wrote:
> >> How about merge this patch? :-)
> > 
> > I will wait for a pull request from the responsible custodian.
> > 
> > Maybe you should have put him on cc: ...  (done now).
> 
> I pinged Andy about some mmc patches that he replied "Applied" to back
> in May but never made it into the repo.  I see no emails from him to
> the u-boot list for sometime.
> 
> Andy, are you still around?  Freescalers, any info?

Andy's around, but he's slow sometimes ... definition of "slow" is relative 
though :)
> 
> Thanks
> John
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-09-24 10:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-06 13:59 [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc Lei Wen
2010-09-06 14:07 ` Reinhard Meyer
2010-09-06 14:11   ` Lei Wen
2010-09-13  4:04     ` Lei Wen
2010-09-18 21:49       ` Wolfgang Denk
2010-09-19  4:32         ` Reinhard Meyer
2010-09-19  8:27           ` Lei Wen
2010-09-21 14:45         ` John Rigby
2010-09-24 10:49           ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox