public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [Patch] MMC: modified calculated mmc-capacity & set mmc trans speed
@ 2010-03-02 10:13 Jae hoon Chung
  2010-03-02 12:35 ` Wolfgang Denk
  0 siblings, 1 reply; 10+ messages in thread
From: Jae hoon Chung @ 2010-03-02 10:13 UTC (permalink / raw)
  To: u-boot

The patches do the following
1. ? ? If mmc is size is more than 2GB, need to calculate using the
ext_csd register.

2. ? ? mmc_set_clock() is hard setting, that is not good solution.

If mmc is not MMC_MODE_HS, mmc will set card is tran_speed



Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>



---

drivers/mmc/mmc.c | ? 13 +++++++++----

1 files changed, 9 insertions(+), 4 deletions(-)



diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c

index b69ce15..13fa5c9 100644

--- a/drivers/mmc/mmc.c

+++ b/drivers/mmc/mmc.c

@@ -395,6 +395,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]));

+

? ? ? ? ?cardtype = ext_csd[196] & 0xf;



? ? ? ? ?err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);

@@ -779,11 +783,12 @@ int mmc_startup(struct mmc *mmc)



? ? ? ? ? ? ? ? ? ? if (mmc->card_caps & MMC_MODE_HS) {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (mmc->card_caps & MMC_MODE_HS_52MHz)

- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc_set_clock(mmc, 52000000);

+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc->tran_speed = 52000000;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?else

- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc_set_clock(mmc, 26000000);

- ? ? ? ? ? ? ? ? ? ?} else

- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc_set_clock(mmc, 20000000);

+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc->tran_speed = 26000000;

+ ? ? ? ? ? ? ? ? ? }

+

+ ? ? ? ? ? ? ? ? ? mmc_set_clock(mmc, mmc->tran_speed);

? ? ? ? ?}



? ? ? ? ?/* fill in device description */

--

1.6.0.4

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

* [U-Boot] [Patch] MMC: modified calculated mmc-capacity & set mmc trans speed
  2010-03-02 10:13 [U-Boot] [Patch] MMC: modified calculated mmc-capacity & set mmc trans speed Jae hoon Chung
@ 2010-03-02 12:35 ` Wolfgang Denk
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2010-03-02 12:35 UTC (permalink / raw)
  To: u-boot

Dear Jae hoon Chung,

In message <91990fe21003020213s793b09acx4cde328f7555c594@mail.gmail.com> you wrote:
> The patches do the following
> 1. =A0 =A0 If mmc is size is more than 2GB, need to calculate using the
> ext_csd register.
> 
> 2. =A0 =A0 mmc_set_clock() is hard setting, that is not good solution.
> 
> If mmc is not MMC_MODE_HS, mmc will set card is tran_speed
> 
> 
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>

Your patch is line wrapped and white space damaged. Please make sure
to use git-send-email to submit your patches (or fix your mailer
configuration.  Do NOT copy & paste patches, this will not work.

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
You are in a maze of UUCP connections, all alike.

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

* [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed
@ 2010-04-08  3:36 Jae hoon Chung
  2010-04-08 12:34 ` Minkyu Kang
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jae hoon Chung @ 2010-04-08  3:36 UTC (permalink / raw)
  To: u-boot

The patches do the following
1. If mmc size is more than 2GB , we need to calculated using the
extended csd register.
2. mmc_set_clock() is hard setting, that is not good solution.

If mmc is not MMC_MODE_HS, mmc will set card's trans_speed.


Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>

---
 drivers/mmc/mmc.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

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]);
+
 	cardtype = ext_csd[196] & 0xf;

 	err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);
@@ -794,12 +798,11 @@ int mmc_startup(struct mmc *mmc)

 		if (mmc->card_caps & MMC_MODE_HS) {
 			if (mmc->card_caps & MMC_MODE_HS_52MHz)
-				mmc_set_clock(mmc, 52000000);
+				mmc->tran_speed = 52000000;
 			else
-				mmc_set_clock(mmc, 26000000);
-		} else
-			mmc_set_clock(mmc, 20000000);
-	}
+				mmc->tran_speed = 26000000;
+		}
+		mmc_set_clock(mmc, mmc->tran_speed);

 	/* fill in device description */
 	mmc->block_dev.lun = 0;
-- 
1.6.0.4

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

* [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed
  2010-04-08  3:36 [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed Jae hoon Chung
@ 2010-04-08 12:34 ` Minkyu Kang
  2010-05-05 22:03 ` Wolfgang Denk
  2010-05-06 15:35 ` Andy Fleming
  2 siblings, 0 replies; 10+ messages in thread
From: Minkyu Kang @ 2010-04-08 12:34 UTC (permalink / raw)
  To: u-boot

On 8 April 2010 12:36, Jae hoon Chung <jh80.chung@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.
> 2. mmc_set_clock() is hard setting, that is not good solution.
>
> If mmc is not MMC_MODE_HS, mmc will set card's trans_speed.
>
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>
> ---
> ?drivers/mmc/mmc.c | ? 13 ++++++++-----
> ?1 files changed, 8 insertions(+), 5 deletions(-)
>

I tested it on SMDK board.
It works fine.

Tested-by: Minkyu Kang <mk7.kang@samsung.com>

Thanks
Minkyu Kang
-- 
from. prom.
www.promsoft.net

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

* [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed
  2010-04-08  3:36 [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed Jae hoon Chung
  2010-04-08 12:34 ` Minkyu Kang
@ 2010-05-05 22:03 ` Wolfgang Denk
  2010-05-06 15:35 ` Andy Fleming
  2 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2010-05-05 22:03 UTC (permalink / raw)
  To: u-boot

Dear Andy,

In message <n2l91990fe21004072036kacf48a2aqf28a92c8d4dd6237@mail.gmail.com> Jae hoon Chung wrote:
> The patches do the following
> 1. If mmc size is more than 2GB , we need to calculated using the
> extended csd register.
> 2. mmc_set_clock() is hard setting, that is not good solution.
> 
> If mmc is not MMC_MODE_HS, mmc will set card's trans_speed.
> 
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> 
> ---
>  drivers/mmc/mmc.c |   13 ++++++++-----
>  1 files changed, 8 insertions(+), 5 deletions(-)

Is this patch somewhere in your queue?

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
"There are things that are so serious that you can  only  joke  about
them"                                                    - Heisenberg

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

* [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed
  2010-04-08  3:36 [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed Jae hoon Chung
  2010-04-08 12:34 ` Minkyu Kang
  2010-05-05 22:03 ` Wolfgang Denk
@ 2010-05-06 15:35 ` Andy Fleming
  2010-05-07  6:45   ` Jae hoon Chung
  2 siblings, 1 reply; 10+ messages in thread
From: Andy Fleming @ 2010-05-06 15:35 UTC (permalink / raw)
  To: u-boot

On Wed, Apr 7, 2010 at 10:36 PM, Jae hoon Chung <jh80.chung@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.


> 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).

So just multiply capacity by block size, and we can apply this.


> ? ? ? ?cardtype = ext_csd[196] & 0xf;
>
> ? ? ? ?err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);
> @@ -794,12 +798,11 @@ int mmc_startup(struct mmc *mmc)
>
> ? ? ? ? ? ? ? ?if (mmc->card_caps & MMC_MODE_HS) {
> ? ? ? ? ? ? ? ? ? ? ? ?if (mmc->card_caps & MMC_MODE_HS_52MHz)
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc_set_clock(mmc, 52000000);
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc->tran_speed = 52000000;
> ? ? ? ? ? ? ? ? ? ? ? ?else
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc_set_clock(mmc, 26000000);
> - ? ? ? ? ? ? ? } else
> - ? ? ? ? ? ? ? ? ? ? ? mmc_set_clock(mmc, 20000000);
> - ? ? ? }
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc->tran_speed = 26000000;
> + ? ? ? ? ? ? ? }
> + ? ? ? ? ? ? ? mmc_set_clock(mmc, mmc->tran_speed);

This looks good.


Andy

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

* [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed
  2010-05-06 15:35 ` Andy Fleming
@ 2010-05-07  6:45   ` Jae hoon Chung
  2010-05-07  7:52     ` Andy Fleming
  0 siblings, 1 reply; 10+ messages in thread
From: Jae hoon Chung @ 2010-05-07  6:45 UTC (permalink / raw)
  To: u-boot

Dear Andy

Thanks for your comment..
but i have some question...

2010/5/7 Andy Fleming <afleming@gmail.com>:
> On Wed, Apr 7, 2010 at 10:36 PM, Jae hoon Chung <jh80.chung@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.

>
>> 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..

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?

> So just multiply capacity by block size, and we can apply this.
>
>
>> ? ? ? ?cardtype = ext_csd[196] & 0xf;
>>
>> ? ? ? ?err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);
>> @@ -794,12 +798,11 @@ int mmc_startup(struct mmc *mmc)
>>
>> ? ? ? ? ? ? ? ?if (mmc->card_caps & MMC_MODE_HS) {
>> ? ? ? ? ? ? ? ? ? ? ? ?if (mmc->card_caps & MMC_MODE_HS_52MHz)
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc_set_clock(mmc, 52000000);
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc->tran_speed = 52000000;
>> ? ? ? ? ? ? ? ? ? ? ? ?else
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc_set_clock(mmc, 26000000);
>> - ? ? ? ? ? ? ? } else
>> - ? ? ? ? ? ? ? ? ? ? ? mmc_set_clock(mmc, 20000000);
>> - ? ? ? }
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc->tran_speed = 26000000;
>> + ? ? ? ? ? ? ? }
>> + ? ? ? ? ? ? ? mmc_set_clock(mmc, mmc->tran_speed);
>
> This looks good.
>
>
> Andy
>

Thanks

Jaehoon Chung

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

* [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed
  2010-05-07  6:45   ` Jae hoon Chung
@ 2010-05-07  7:52     ` Andy Fleming
  2010-05-12 14:48       ` Minkyu Kang
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Fleming @ 2010-05-07  7:52 UTC (permalink / raw)
  To: u-boot

On Fri, May 7, 2010 at 1:45 AM, Jae hoon Chung <jh80.chung@gmail.com> wrote:
> Dear Andy
>
> Thanks for your comment..
> but i have some question...
>
> 2010/5/7 Andy Fleming <afleming@gmail.com>:
>> On Wed, Apr 7, 2010 at 10:36 PM, Jae hoon Chung <jh80.chung@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.  :)

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

* [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed
  2010-05-07  7:52     ` Andy Fleming
@ 2010-05-12 14:48       ` Minkyu Kang
  2010-05-13  5:14         ` Alagu Sankar
  0 siblings, 1 reply; 10+ messages in thread
From: Minkyu Kang @ 2010-05-12 14:48 UTC (permalink / raw)
  To: u-boot

Dear Andy,

On 7 May 2010 16:52, Andy Fleming <afleming@gmail.com> wrote:
> On Fri, May 7, 2010 at 1:45 AM, Jae hoon Chung <jh80.chung@gmail.com> wrote:
>> Dear Andy
>>
>> Thanks for your comment..
>> but i have some question...
>>
>> 2010/5/7 Andy Fleming <afleming@gmail.com>:
>>> On Wed, Apr 7, 2010 at 10:36 PM, Jae hoon Chung <jh80.chung@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
-- 
from. prom.
www.promsoft.net

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

* [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed
  2010-05-12 14:48       ` Minkyu Kang
@ 2010-05-13  5:14         ` Alagu Sankar
  0 siblings, 0 replies; 10+ messages in thread
From: Alagu Sankar @ 2010-05-13  5:14 UTC (permalink / raw)
  To: u-boot

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@gmail.com> wrote:
>   
>> On Fri, May 7, 2010 at 1:45 AM, Jae hoon Chung <jh80.chung@gmail.com> wrote:
>>     
>>> Dear Andy
>>>
>>> Thanks for your comment..
>>> but i have some question...
>>>
>>> 2010/5/7 Andy Fleming <afleming@gmail.com>:
>>>       
>>>> On Wed, Apr 7, 2010 at 10:36 PM, Jae hoon Chung <jh80.chung@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
>   

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

end of thread, other threads:[~2010-05-13  5:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08  3:36 [U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed Jae hoon Chung
2010-04-08 12:34 ` Minkyu Kang
2010-05-05 22:03 ` Wolfgang Denk
2010-05-06 15:35 ` Andy Fleming
2010-05-07  6:45   ` Jae hoon Chung
2010-05-07  7:52     ` Andy Fleming
2010-05-12 14:48       ` Minkyu Kang
2010-05-13  5:14         ` Alagu Sankar
  -- strict thread matches above, loose matches on Subject: below --
2010-03-02 10:13 [U-Boot] [Patch] MMC: modified calculated mmc-capacity & set mmc trans speed Jae hoon Chung
2010-03-02 12:35 ` Wolfgang Denk

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