* 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.red...@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

Attachment: pgpezs9eUlz4e.pgp
Description: PGP signature

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to