Re: [BUG] CMD52 sent as first command not CMD0

Philip Rakity
2011-02-06T01:35:52Z

proposed solution: I cannot verify this fix until Monday.
=====

CMD52 is a reset for SDIO cards. CMD0 is not sufficient when
the card is being re-initialized. Only send CMD52 if
a) doing a reinitialize
b) card is SDIO or SDIO_COMBO

Signed-off-by: Philip Rakity <prakity@marvell.com>
---
drivers/mmc/core/core.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 30d4da4..f0ce6f6 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1521,7 +1521,12 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
mmc_hostname(host), __func__, host->f_init);
#endif
mmc_power_up(host);
- sdio_reset(host);
+
+ /* reset sdio before CMD0 when card is being reinitialized */
+ if (host->card &&
+ (host->card->type == MMC_TYPE_SDIO ||
+ host->card->type == MMC_TYPE_SD_COMBO))
+ sdio_reset(host);
mmc_go_idle(host);
mmc_hwungate_clock(host);

--
1.7.0.4

On Feb 5, 2011, at 5:15 PM, Chris Ball wrote:

> On Sat, Feb 05, 2011 at 04:52:12PM -0800, Philip Rakity wrote:
>> nothing negative but reset is meant to reinit the card. This is the power up sequence for the 1st time a card is detected.
>> There is no reason to do this if no card has yet enumerated. If a sdio card was there I completely agree with the mod since we need to reset
>> the card.
>>
>> CMD0 should be the 1st command on an initial power up sequence. Does my code suggestion work for you ?
>
> Okay -- yes, looks fine. Let's add a comment beforehand; something like:
>
> /* If reinitalizing, we must send CMD52 before CMD0 for SDIO. */
>
> --
> Chris Ball <cjb@laptop.org> <http://printf.net/>
> One Laptop Per Child