[U-Boot] [PATCH] mmc: Implement card detection.

Thierry Reding thierry.reding at avionic-design.de
Tue Nov 22 19:13:00 CET 2011


* 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 <thierry.reding at avionic-design.de>
> ---
>  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: <http://lists.denx.de/pipermail/u-boot/attachments/20111122/fcccb6db/attachment.pgp>


More information about the U-Boot mailing list