mmc: modified calculated mmc-capacity & set mmc trans_speed
PATCH 1/1 mmc: modified calculated mmc-capacity & set mmc trans_speed
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.
--- drivers/mmc/mmc.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/mmc/mmc.c +8 -5
@@ -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 ;
Signature · 1 line
1.6.0.4
PATCH 1/1 mmc: modified calculated mmc-capacity & set mmc trans_speed
Quoted 5 lines · Jae hoon Chung
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.
Quoted 9 lines
If mmc is not
MMC_MODE_HS, mmc will set card'strans_speed.Signed-off-by Jaehoon Chung <[email protected]>---
?drivers/mmc/mmc.c | ? 13 ++++++++-----
?1 files changed, 8 insertions(+), 5 deletions(-)
I tested it on SMDK board.
It works fine.
Thanks
Minkyu Kang
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 1/1 mmc: modified calculated mmc-capacity & set mmc trans_speed
In reply to Jae hoon ChungDear Andy,
Quoted 5 lines · In message <[email protected]>…
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.
Quoted 8 lines
If mmc is not
MMC_MODE_HS, mmc will set card'strans_speed.Signed-off-by Jaehoon Chung <[email protected]>--- drivers/mmc/mmc.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
Is this patch somewhere in your queue?
Best regards,
Wolfgang Denk
Signature · 5 lines
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
PATCH 1/1 mmc: modified calculated mmc-capacity & set mmc trans_speed
In reply to Jae hoon ChungQuoted 3 lines · Jae hoon Chung
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.
drivers/mmc/mmc.c int mmc_change_freq(struct mmc *mmc) · line 416
Quoted 12 lines
drivers/mmc/mmc.c +4
-0@@ -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.
Quoted 9 lines
drivers/mmc/mmc.c +1
-1? ? ? ?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;
Quoted 8 lines
? ? ? ? ? ? ? ? ? ? ? ?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
PATCH 1/1 mmc: modified calculated mmc-capacity & set mmc trans_speed
Dear Andy
Thanks for your comment..
but i have some question...
2010/5/7 Andy Fleming <[email protected]>:
Quoted 10 lines · Jae hoon Chung
Quoted 3 lines
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.
Quoted 23 lines
drivers/mmc/mmc.c int mmc_change_freq(struct mmc *mmc) · line 416
Quoted 13 lines
drivers/mmc/mmc.c +4
-0@@ -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.
Quoted 5 lines
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?
Quoted 24 lines
So just multiply capacity by block size, and we can apply this.
Quoted 9 lines
drivers/mmc/mmc.c +1
-1? ? ? ?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;Quoted 8 lines
? ? ? ? ? ? ? ? ? ? ? ?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.
Quoted 2 lines
Andy
Thanks
Jaehoon Chung
PATCH 1/1 mmc: modified calculated mmc-capacity & set mmc trans_speed
Quoted 17 lines · Jae hoon Chung
Dear Andy
Thanks for your comment..
but i have some question...2010/5/7 Andy Fleming <[email protected]>:
Quoted 10 lines · Jae hoon Chung
Quoted 3 lines
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.
Quoted 3 lines
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.
Quoted 30 lines
Quoted 24 lines
Quoted 7 lines
drivers/mmc/mmc.c +0
-0drivers/mmc/mmc.c int mmc_change_freq(struct mmc *mmc) · line 416
Quoted 7 lines
drivers/mmc/mmc.c +4
-0@@ -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.
Quoted 5 lines
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).
Quoted 3 lines
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.
Quoted 10 lines
Tran Speed: 52000000
Rd Block Len: 512
MMC version 4.3
High Capacity: Yes
Capacity: 7840 MByte
Bus Width: 4-bitand 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. :)
PATCH 1/1 mmc: modified calculated mmc-capacity & set mmc trans_speed
Dear Andy,
Quoted 77 lines · Andy Fleming
Quoted 17 lines · Jae hoon Chung
Dear Andy
Thanks for your comment..
but i have some question...2010/5/7 Andy Fleming <[email protected]>:
Quoted 10 lines · Jae hoon Chung
Quoted 3 lines
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.
Quoted 3 lines
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.
Quoted 30 lines
Quoted 24 lines
Quoted 7 lines
drivers/mmc/mmc.c +0
-0drivers/mmc/mmc.c int mmc_change_freq(struct mmc *mmc) · line 416
Quoted 7 lines
drivers/mmc/mmc.c +4
-0@@ -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.
Quoted 5 lines
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).
Quoted 3 lines
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.
Quoted 8 lines
Tran Speed: 52000000
Rd Block Len: 512
MMC version 4.3
High Capacity: Yes
Capacity: 7840 MByte
Bus Width: 4-bit
Quoted 4 lines
Quoted 2 lines
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
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 1/1 mmc: modified calculated mmc-capacity & set mmc trans_speed
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
Quoted 93 lines · Minkyu Kang
Dear Andy,
Quoted 76 lines · Andy Fleming
Quoted 19 lines · Jae hoon Chung
Dear Andy
Thanks for your comment..
but i have some question...2010/5/7 Andy Fleming <[email protected]>:
Quoted 12 lines · Jae hoon Chung
Quoted 5 lines
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.
Quoted 4 lines
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.
Quoted 27 lines
Quoted 21 lines
drivers/mmc/mmc.c int mmc_change_freq(struct mmc *mmc) · line 417
Quoted 13 lines
drivers/mmc/mmc.c +4
-0@@ -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.
Quoted 6 lines
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).
Quoted 4 lines
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.
Quoted 7 lines
Tran Speed: 52000000
Rd Block Len: 512
MMC version 4.3
High Capacity: Yes
Capacity: 7840 MByte
Bus Width: 4-bitQuoted 5 lines
Quoted 3 lines
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