[U-Boot] [PATCH 2/4] MMC Card Capacity Bug Fix
Sudhakar Rajashekhara
sudhakar.raj at ti.com
Fri May 14 10:16:23 CEST 2010
Hi Alagu,
On Wed, May 12, 2010 at 15:08:25, Alagu Sankar wrote:
> Fixed a bug in card capacity calculation for MMC high-capacity cards.
>
> Signed-off-by: Alagu Sankar <alagusankar at embwise.com>
> ---
> drivers/mmc/mmc.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 959d8ad..e7abf94 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -393,6 +393,7 @@ int mmc_change_freq(struct mmc *mmc)
> char ext_csd[512];
> char cardtype;
> int err;
> + unsigned int sec_count;
>
This can be uint too or you can use unsigned int to typecast below.
Regards,
Sudhakar
> mmc->card_caps = 0;
>
> @@ -407,8 +408,14 @@ int mmc_change_freq(struct mmc *mmc)
> if (err)
> return err;
>
> - if (ext_csd[212] || ext_csd[213] || ext_csd[214] || ext_csd[215])
> + sec_count = ((uint)ext_csd[212] |
> + ((uint)ext_csd[213] << 8) |
> + ((uint)ext_csd[214] << 16) |
> + ((uint)ext_csd[215] << 24));
> + if (sec_count) {
> mmc->high_capacity = 1;
> + mmc->capacity = sec_count * 512;
> + }
>
> cardtype = ext_csd[196] & 0xf;
>
> --
> 1.6.0.6
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
More information about the U-Boot
mailing list