From: Thierry Reding Date: Tue, 22 Nov 2011 19:13:00 +0100 Subject: [U-Boot] [PATCH] mmc: Implement card detection. In-Reply-To: <1321530687-18334-1-git-send-email-thierry.reding@avionic-design.de> References: <1321530687-18334-1-git-send-email-thierry.reding@avionic-design.de> Message-ID: <20111122181300.GB6554@avionic-0098.adnet.avionic-design.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de * Thierry Reding wrote: > Check for board-specific card detect each time an MMC/SD device is > initialized. If card detection is not implemented, this code behaves as > before and continues assuming a card is present. If no card is detected, > has_init is reset for the MMC/SD device (to force initialization next > time) and an error is returned. > > Signed-off-by: Thierry Reding > --- > drivers/mmc/mmc.c | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c > index 37ce6e8..d18c095 100644 > --- a/drivers/mmc/mmc.c > +++ b/drivers/mmc/mmc.c > @@ -1191,6 +1191,15 @@ block_dev_desc_t *mmc_get_dev(int dev) > int mmc_init(struct mmc *mmc) > { > int err, retry = 3; > + u8 card_detect = 0; > + > + if (board_mmc_getcd(&card_detect, mmc) == 0) { > + if (!card_detect) { > + mmc->has_init = 0; > + printf("MMC: no card present\n"); > + return NO_CARD_ERR; > + } > + } > > if (mmc->has_init) > return 0; > -- > 1.7.7.3 I'm adding Andy Fleming to Cc with the official email address as listed on http://www.denx.de/wiki/U-Boot/Custodians. Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: