From a6e2415cc4b2f026f7c6dfa3cc55dd2c6a9180d8 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Fri, 23 Aug 2013 15:07:54 +0000 Subject: [PATCH] Don't give up so easily on failure of CMD55 to put the card into app-cmd mode. We don't know why it failed, so we can't know that a retry will also fail (the low-level driver might have reset the controller state machine or something similar that would allow a retry to work). --- sys/dev/mmc/mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c index 3e307cb4a96c..2ca087533887 100644 --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -106,7 +106,7 @@ struct mmc_ivars { #define CMD_RETRIES 3 -#define CARD_ID_FREQUENCY 400000 /* Spec requires 400KHz max during ID phase. */ +#define CARD_ID_FREQUENCY 400000 /* Spec requires 400kHz max during ID phase. */ static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver"); @@ -447,8 +447,8 @@ mmc_wait_for_app_cmd(struct mmc_softc *sc, uint32_t rca, err = appcmd.error; if (err == MMC_ERR_NONE) { if (!(appcmd.resp[0] & R1_APP_CMD)) - return MMC_ERR_FAILED; /* Retries won't help. */ - if (mmc_wait_for_cmd(sc, cmd, 0) != 0) + err = MMC_ERR_FAILED; + else if (mmc_wait_for_cmd(sc, cmd, 0) != 0) err = MMC_ERR_FAILED; else err = cmd->error;