On Wed, Apr 7, 2010 at 10:36 PM, Jae hoon Chung <jh80.ch...@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 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot